Learn R Programming

BVAR (version 1.0.5)

hist_decomp.bvar: Historical decomposition

Description

Function to compute a historical variance decomposition of a VAR.

Usage

# S3 method for bvar
hist_decomp(x, type = c("mean", "quantile"), ...)

hist_decomp(x, ...)

# S3 method for default hist_decomp(x, ...)

Value

Returns a numerical array (time, variable, shock) with the results of the historical decomposition.

Arguments

x

A bvar object, obtained from bvar.

type

Character scalar. Whether to use median or mean values.

...

Not used.

Examples

Run this code
# \donttest{
# 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 = 600L, n_burn = 100L, verbose = FALSE)

# Compute historical decomposition
hist_decomp(x, type = "mean")
# }

Run the code above in your browser using DataLab