View source: R/perfect-foresight-expecterr.R
| perfect_foresight_expect_err | R Documentation |
Generalises perfect_foresight by allowing the realised
shock path to differ from the path agents anticipate at each point in
time. In standard perfect foresight, agents at t = 1 see every
future shock; in the with-expectation-errors variant, agents form
subjective expectations at each period k, solve the residual
perfect-foresight problem, then nature delivers the actual one-period
shock (which may be a surprise).
perfect_foresight_expect_err(
x,
actual_shocks,
expected_shocks = NULL,
initial = NULL,
horizon = 40L
)
x |
A |
actual_shocks |
Named list (or matrix) describing the
realised shock path – same format as the |
expected_shocks |
Optional named list (or matrix) describing
what agents expect at |
initial |
Optional named numeric vector of initial state deviations. |
horizon |
Integer. Number of periods. Default 40. |
This is the analogue of Dynare's
perfect_foresight_with_expectation_errors_solver command. A
typical use case: study how the economy reacts to a sequence of
news/MIT shocks that arrive unexpectedly even though each shock,
once it lands, is treated as fully credible going forward.
An object of class c("dsge_perfect_foresight_expecterr",
"dsge_perfect_foresight") containing the same fields as
perfect_foresight plus an extra element
expectation_paths – a list of per-period subjective
forecast paths (one matrix per starting period) so users can
inspect how agent expectations evolved.
perfect_foresight (no expectation errors),
perfect_foresight_nonlinear.
m <- dsge_model(
obs(y ~ beta * lead(y) + 0.1 * x),
state(x ~ 0.9 * x),
fixed = list(beta = 0.99))
sol <- solve_dsge(m, params = c(), shock_sd = c(x = 1))
# Agents expect no shocks; nature delivers a one-time shock at t = 5
pf <- perfect_foresight_expect_err(sol,
actual_shocks = list(x = c(0, 0, 0, 0, 1)),
horizon = 30)
plot(pf)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.