| smooth_states.dsge_solution | R Documentation |
Computes the Rauch-Tung-Striebel (RTS) smoother to produce optimal state estimates using all available observations. Compared to the filtered states (which only use past data), smoothed states also incorporate future observations.
## S3 method for class 'dsge_solution'
smooth_states(x, data, ...)
smooth_states(x, ...)
## S3 method for class 'dsge_fit'
smooth_states(x, ...)
## S3 method for class 'dsge_bayes'
smooth_states(x, ...)
x |
A |
data |
Matrix or data frame of observed data with columns matching
the model's observable names. Required when |
... |
Additional arguments (currently unused). |
The smoother uses the state-space representation:
x_{t+1} = H x_t + M \varepsilon_{t+1}
y_t = Z x_t
where Z = D \cdot G. The smoothed states are the expectation of the
state vector conditional on all observations: x_{t|T} = E[x_t | y_1, \ldots, y_T].
For Bayesian models, the smoother is evaluated at the posterior mean.
An object of class "dsge_smoothed" containing:
T x n_s matrix of smoothed state estimates.
T x n_s matrix of filtered state estimates.
T x n_obs matrix of smoothed observable fits.
T x n_obs matrix of observation residuals.
Character vector of state variable names.
Character vector of observed variable names.
Steady-state values (if available).
m <- dsge_model(
obs(y ~ z),
state(z ~ rho * z),
start = list(rho = 0.5)
)
set.seed(1)
e <- rnorm(100)
z <- numeric(100); for (i in 2:100) z[i] <- 0.8 * z[i-1] + e[i]
fit <- estimate(m, data = data.frame(y = z))
sm <- smooth_states(fit)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.