
Plots the median and an interval between two specified percentiles for a sequence of K random variables
Source: R/plot.R
plot_ribbon.RdPlots the median and an interval between two specified percentiles
for a sequence of K random variables based on the S posterior
draws provided for each of them.
Usage
plot_ribbon(
draws,
probability = 0.9,
col = "#ff69b4",
ylim,
ylab,
xlab,
start_at = 0,
add = FALSE,
...
)Arguments
- draws
a
K x Smatrix withSposterior draws ofKrandom variables, or aK x S x Narray withNsuch matrices- probability
a number from interval
(0,1)denoting the probability content of the plotted interval. The interval stretches from the0.5 * (1 - probability)to1 - 0.5 * (1 - probability)percentile of the posterior distribution.- col
a colour of the plot
- ylim
the range of the
yaxis- ylab
the label of the
yaxis- xlab
the label of the
xaxis- start_at
an integer to denote the beginning of the
xaxis range- add
a logical value. If
TRUEthe current ribbon plot is added to an existing plot- ...
other graphical parameters to be passed to
base::plot
Author
Tomasz Woźniak wozniak.tom@pm.me
Examples
data(us_fiscal_lsuw) # upload data
set.seed(123) # set seed
specification = specify_bsvar$new(us_fiscal_lsuw) # specify model
#> The identification is set to the default option of lower-triangular structural matrix.
burn_in = estimate(specification, 10) # run the burn-in
#> **************************************************|
#> bsvars: Bayesian Structural Vector Autoregressions|
#> **************************************************|
#> Gibbs sampler for the SVAR model |
#> **************************************************|
#> Progress of the MCMC simulation for 10 draws
#> Every draw is saved via MCMC thinning
#> Press Esc to interrupt the computations
#> **************************************************|
posterior = estimate(burn_in, 20, thin = 1) # estimate the model
#> **************************************************|
#> bsvars: Bayesian Structural Vector Autoregressions|
#> **************************************************|
#> Gibbs sampler for the SVAR model |
#> **************************************************|
#> Progress of the MCMC simulation for 20 draws
#> Every draw is saved via MCMC thinning
#> Press Esc to interrupt the computations
#> **************************************************|
irf = compute_impulse_responses(posterior, horizon = 4) # impulse responses
plot_ribbon(irf[1,1,,])