| simulate_occbin | R Documentation |
Computes deterministic transition paths under piecewise-linear occasionally binding constraints using an iterative shadow-shock method.
simulate_occbin(
x,
constraints,
shocks = NULL,
initial = NULL,
horizon = 40L,
max_iter = 100L,
tol = 1e-08,
in_sd = FALSE
)
x |
A solved DSGE model object ( |
constraints |
A list of constraints. Each element can be:
|
shocks |
Deterministic shock specification (as in
|
initial |
Named numeric vector of initial state deviations from
steady state. Default |
horizon |
Integer. Simulation horizon. Default 40. |
max_iter |
Integer. Maximum OccBin iterations. Default 100. |
tol |
Numeric. Convergence tolerance for shadow shocks. Default 1e-8. |
in_sd |
Logical. If |
The algorithm iteratively:
Simulates the path with current shadow shocks
Identifies periods where constraints are violated
Computes shadow shocks to enforce constraints at binding periods
Removes shadow shocks at non-binding periods
Repeats until the binding regime stabilises
This captures the feedback effect of constraint enforcement on future dynamics through the state transition.
An object of class "dsge_occbin" containing:
Matrix of state deviations (constrained path)
Matrix of control deviations (constrained path)
Matrix of state deviations (unconstrained path)
Matrix of control deviations (unconstrained path)
Logical matrix (horizon x n_constraints) of binding indicators
Matrix of shadow shocks applied
Number of OccBin iterations to convergence
Logical: did the algorithm converge?
List of constraint objects
Steady state values if available
Simulation horizon
State variable names
Control variable names
# Simple NK model with ZLB
nk <- dsge_model(
obs(pi ~ beta * lead(pi) + kappa * x),
unobs(x ~ lead(x) - (r - lead(pi) - g)),
obs(r ~ psi * pi + u),
state(u ~ rhou * u),
state(g ~ rhog * g),
fixed = list(beta = 0.99, kappa = 0.1, psi = 1.5),
start = list(rhou = 0.5, rhog = 0.5)
)
sol <- solve_dsge(nk, params = list(rhou = 0.5, rhog = 0.5),
shock_sd = c(u = 0.5, g = 0.5))
obc <- simulate_occbin(sol,
constraints = list("r >= 0"),
shocks = list(g = -0.05),
horizon = 40)
plot(obc)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.