plot.bvarprd: Plotting Forecasts of BVAR Models

View source: R/plot.bvarprd.R

plot.bvarprdR Documentation

Plotting Forecasts of BVAR Models

Description

A plot function for objects of class "bvarprd".

Usage

## S3 method for class 'bvarprd'
plot(x, n.pre = NULL, ...)

Arguments

x

an object of class "bvarprd", usually, a result of a call to predict.bvar.

n.pre

number of plotted observations that precede the forecasts. If NULL (default), all available obervations will be plotted.

...

further graphical parameters.

Examples


# Load data
data("e1")
e1 <- diff(log(e1)) * 100

# Generate model data
model <- gen_var(e1, p = 2, deterministic = 2,
                 iterations = 100, burnin = 10)

# Add prior specifications
model <- add_priors(model)

# Obtain posterior draws
object <- draw_posterior(model)

# Calculate forecasts
pred <- predict(object, new_d = rep(1, 10))

# Plot forecasts
plot(pred)


bvartools documentation built on Aug. 31, 2023, 1:09 a.m.