View source: R/calibrated-smoother.R
| calibrated_smoother | R Documentation |
Convenience wrapper that runs the Kalman smoother, smoothed-shock
recovery, and historical shock decomposition on a calibrated
dsge_solution object together with observed data. Analogous to
Dynare's calibrated_smoother command.
calibrated_smoother(sol, data, what = c("states", "shocks", "decomposition"))
sol |
A |
data |
Matrix or data frame of observed variables. Column names
must match |
what |
Character vector of outputs to compute. Any subset of
|
A named list containing the requested smoothed-output objects.
Elements are themselves objects of the same classes returned by
smooth_states, smooth_shocks, and
shock_decomposition, so all existing print and plot
methods apply.
smooth_states.dsge_solution,
smooth_shocks.dsge_solution,
shock_decomposition.dsge_solution.
m <- dsge_model(
obs(y ~ z),
state(z ~ rho * z),
fixed = list(rho = 0.8))
sol <- solve_dsge(m, params = c(rho = 0.8), shock_sd = c(z = 1))
set.seed(1)
e <- rnorm(100)
z_path <- numeric(100)
for (i in 2:100) z_path[i] <- 0.8 * z_path[i - 1] + e[i]
out <- calibrated_smoother(sol, data = data.frame(y = z_path))
plot(out$states)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.