calibrated_smoother: Run the Kalman Smoother on a Calibrated Model

View source: R/calibrated-smoother.R

calibrated_smootherR Documentation

Run the Kalman Smoother on a Calibrated Model

Description

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.

Usage

calibrated_smoother(sol, data, what = c("states", "shocks", "decomposition"))

Arguments

sol

A dsge_solution object (from solve_dsge).

data

Matrix or data frame of observed variables. Column names must match rownames(sol$D) (the observable names).

what

Character vector of outputs to compute. Any subset of c("states", "shocks", "decomposition"). Default is all three.

Value

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.

See Also

smooth_states.dsge_solution, smooth_shocks.dsge_solution, shock_decomposition.dsge_solution.

Examples


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)



dsge documentation built on Sept. 25, 2026, 5:08 p.m.