extended_path: Stochastic Simulation via the Extended Path

View source: R/extended-path.R

extended_pathR Documentation

Stochastic Simulation via the Extended Path

Description

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.

Usage

extended_path(
  x,
  periods = 200L,
  shock_sd = NULL,
  params = NULL,
  pf_horizon = 30L,
  initial = NULL,
  burn = 0L,
  seed = NULL
)

Arguments

x

A dsge_solution (linear) or dsgenl_model (nonlinear) object.

periods

Integer. Number of simulation periods. Default 200.

shock_sd

Named numeric vector of shock standard deviations (required for dsgenl_model; taken from the solution for dsge_solution).

params

Named numeric vector of parameter values (required for dsgenl_model).

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.

Value

An object of class "dsge_extended_path" with elements:

states

(periods x n_states) matrix of state deviations.

controls

(periods x n_controls) matrix of control deviations.

shocks

(periods x n_shocks) matrix of structural shock realisations.

periods, pf_horizon, model, solution

Inputs.

Examples


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)



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