View source: R/70_hist_decomp.R
hist_decomp.bvar | R Documentation |
Function to compute a historical variance decomposition of a VAR.
## S3 method for class 'bvar'
hist_decomp(x, type = c("mean", "quantile"), ...)
hist_decomp(x, ...)
## Default S3 method:
hist_decomp(x, ...)
x |
A |
type |
Character scalar. Whether to use median or mean values. |
... |
Not used. |
Returns a numerical array (time, variable, shock) with the results of the historical decomposition.
# 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.