Learn R Programming

BVAR (version 0.2.2)

plot.bvar_irf: Plotting method for Bayesian VAR impulse responses

Description

Plotting method for impulse responses obtained from bvar or irf.bvar. Impulse responses of all or a subset of the available variables can be plotted.

Usage

# S3 method for bvar_irf
plot(
  x,
  conf_bands,
  vars_response = NULL,
  vars_impulse = NULL,
  variables = NULL,
  mar = c(2, 2, 2, 0.5),
  ...
)

bv_plot_irf( x, conf_bands = 0.16, variables = NULL, vars_impulse = NULL, vars_response = NULL, mar = c(2, 2, 2, 0.5), ... )

Arguments

x

A bvar / bvar_irf object, obtained from bvar / irf.bvar.

conf_bands

Deprecated. Use irf.bvar. Numeric vector of desired confidence bands.

vars_impulse, vars_response

Optional numeric or character vector. Used to subset the plot's impulses / responses to certain variables by position or name (must be available). Defaults to NULL, i.e. all variables.

variables

Optional character vector. Names of all variables in the object. Used to subset and title. Taken from x$variables if available.

mar

Numeric vector. Margins for par.

...

Other graphical parameters for par.

Value

Returns x invisibly.

See Also

bvar; irf.bvar

Examples

Run this code
# NOT RUN {
data <- matrix(rnorm(400), ncol = 4)
x <- bvar(data, lags = 2, irf = bv_irf())

# Plot impulse responses for all available variables
plot(irf(x))
# Alternatively
plot(x$irf)

# Subset to impulse variables in positions 2 and 4 via position and name
plot(x$irf, vars_impulse = c(2, 4))
plot(x$irf,
  variables = c("solved", "for", "many", "decades"),
  vars_impulse = c("for", "decades")
)

# Adjust confidence bands via irf
plot(irf(x, conf_bands = c(0.01, 0.05)))
# }

Run the code above in your browser using DataLab