Learn R Programming

BVAR (version 0.1.5)

plot.bvar_fcast: Forecast plot

Description

Plotting method for forecasts obtained from bvar. Forecasts of all or a subset of the available variables can be plotted.

Usage

# S3 method for bvar_fcast
plot(x, conf_bands = 0.16, variables = NULL,
  vars = NULL, orientation = c("vertical", "horizontal"), mar = c(2,
  2, 2, 0.5), ...)

bv_plot_fcast(x, conf_bands = 0.16, variables = NULL, vars = NULL, orientation = c("vertical", "horizontal"), mar = c(2, 2, 2, 0.5), ...)

Arguments

x

A bvar / bvar_fcast object, obtained from bvar.

conf_bands

Numeric vector of desired confidence bands. E.g. for bands at 5%, 10%, 90% and 95% set this to c(0.05, 0.1).

variables

Optional character vector. Names of all variables in the object. Taken from x$variables if available.

vars

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

orientation

String indicating the orientation of the plots. Defaults to "v" (i.e. vertical); may be set to "h" (i.e. horizontal).

mar

Numeric vector. Margins for par.

...

Other graphical parameters for par.

Examples

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

# Plot forecasts for all available variables
bv_plot_fcast(x)

# Subset to variables in positions 1, 2 and 4 via position and name
bv_plot_fcast(x, vars = c(1, 2, 4))

# Use the method to plot, adjust confidence bands and orientation
plot(x$fcast, conf_bands = c(0.01, 0.05), orientation = "h")
# }

Run the code above in your browser using DataLab