hist_decomp.bvar: Historical decomposition

View source: R/70_hist_decomp.R

hist_decomp.bvarR Documentation

Historical decomposition

Description

Function to compute a historical variance decomposition of a VAR.

Usage

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

hist_decomp(x, ...)

## Default S3 method:
hist_decomp(x, ...)

Arguments

x

A bvar object, obtained from bvar.

type

Character scalar. Whether to use median or mean values.

...

Not used.

Value

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

Examples


# 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")


BVAR documentation built on May 29, 2024, 5:34 a.m.