View source: R/model-covariance.R
| model_covariance | R Documentation |
Computes the unconditional (model-implied) covariance and correlation matrices of observable variables from a solved or estimated DSGE model. These are the theoretical second moments implied by the model at the given parameter values.
model_covariance(x, variables = NULL, n_lags = 0L, ...)
x |
A fitted model ( |
variables |
Character vector of variable names to include.
Default |
n_lags |
Integer. If positive, also compute autocovariances at lags 1, ..., n_lags. Default 0 (contemporaneous only). |
... |
Additional arguments (currently unused). |
An object of class "dsge_covariance" containing:
Covariance matrix of selected variables.
Correlation matrix of selected variables.
Standard deviations (square root of diagonal).
List of lagged autocovariance matrices
(empty if n_lags = 0).
Variable names.
Number of autocovariance lags computed.
mod <- dsge_model(
obs(pi ~ beta * lead(pi) + kappa * x),
unobs(x ~ lead(x) - (r - lead(pi) - g)),
obs(r ~ psi * pi + u),
state(u ~ rhou * u),
state(g ~ rhog * g),
fixed = list(beta = 0.99),
start = list(kappa = 0.1, psi = 1.5, rhou = 0.5, rhog = 0.5)
)
p <- list(kappa = 0.1, psi = 1.5, rhou = 0.5, rhog = 0.5)
s <- c(u = 0.5, g = 0.5)
sol <- solve_dsge(mod, params = p, shock_sd = s)
model_covariance(sol)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.