Plotting method for Bayesian VARs
Method to plot trace and densities of coefficient, hyperparameter and
marginal likelihood draws obtained from bvar
. Several types of
plot are available via the argument type, including traces, densities,
plots of forecasts and impulse responses.
## S3 method for class 'bvar' plot( x, type = c("full", "trace", "density", "irf", "fcast"), vars = NULL, vars_response = NULL, vars_impulse = NULL, chains = list(), mar = c(2, 2, 2, 0.5), ... )
x |
A |
type |
A string with the type of plot desired. The default option
|
vars |
Character vector used to select variables. Elements are matched
to hyperparameters or coefficients. Coefficients may be matched based on
the dependent variable (by providing the name or position) or the
explanatory variables (by providing the name and the desired lag). See the
example section for a demonstration. Defaults to |
vars_response, vars_impulse |
Optional character or integer vectors used to select coefficents. Dependent variables are specified with vars_response, explanatory ones with vars_impulse. See the example section for a demonstration. |
chains |
List of |
mar |
Numeric vector. Margins for |
... |
Other graphical parameters for |
Returns x invisibly.
# Access a subset of the fred_qd dataset data <- fred_qd[, c("CPIAUCSL", "UNRATE", "FEDFUNDS")] # Transform it to be stationary data <- fred_transform(data, codes = c(5, 5, 1), lag = 4) # Estimate a BVAR using one lag, default settings and very few draws x <- bvar(data, lags = 1, n_draw = 1000L, n_burn = 200L, verbose = FALSE) # Plot full traces and densities plot(x) # Only plot the marginal likelihood's trace plot(x, "trace", "ml") # Access IRF and forecast plotting functions plot(x, type = "irf", vars_response = 2) plot(x, type = "fcast", vars = 2)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.