View source: R/extended-path.R
| extended_path | R Documentation |
Simulates a DSGE model under stochastic shocks using the Fair-Taylor / Adjemian-Juillard extended path: at every period the model is solved under perfect foresight conditional on the realised current shock and zero expected future shocks, the period's value is recorded, and the system advances. Used heavily when nonlinearities matter and pruning is unsatisfactory.
extended_path(
x,
periods = 200L,
shock_sd = NULL,
params = NULL,
pf_horizon = 30L,
initial = NULL,
burn = 0L,
seed = NULL
)
x |
A |
periods |
Integer. Number of simulation periods. Default 200. |
shock_sd |
Named numeric vector of shock standard deviations
(required for |
params |
Named numeric vector of parameter values (required for
|
pf_horizon |
Integer. Inner perfect-foresight horizon used at every step. Larger values increase accuracy at the cost of speed. Default 30. |
initial |
Optional named numeric vector of initial state deviations from steady state. |
burn |
Integer. Number of initial periods to discard before returning the simulation (warm-up). Default 0. |
seed |
Optional integer seed. |
An object of class "dsge_extended_path" with elements:
(periods x n_states) matrix of state deviations.
(periods x n_controls) matrix of control
deviations.
(periods x n_shocks) matrix of structural shock
realisations.
Inputs.
rbc <- dsgenl_model(
"1/C = beta / C(+1) * (alpha * exp(Z) * K^(alpha-1) + 1 - delta)",
"K(+1) = exp(Z) * K^alpha - C + (1 - delta) * K",
"Z(+1) = rho * Z",
observed = "C", endo_state = "K", exo_state = "Z",
fixed = list(alpha = 0.33, beta = 0.99, delta = 0.025),
start = list(rho = 0.9))
sim <- extended_path(rbc, periods = 100,
params = c(rho = 0.9), shock_sd = c(Z = 0.01),
pf_horizon = 30, seed = 1)
head(sim$controls)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.