Mixing (stochastic and deterministic) shocks with OccBin


Is it possible to solve a DSGE model with both stochastic and deterministic exogenous variables using OccBin? I am trying to solve a medium scale DSGE model with an occ. binding constraint (which worked well without the deterministic shock before) now with an anticipated path of exogenous transportation costs, but have been unsuccessful so far. My mod files ran without problems but occbin simulation has been unsuccessful. Any help would be much appreciated.


Doesn’t Occbin just work in perfect foresight context? Also, for reference: Conceptual questions on simul, stoch_simul and extended_path with OBC

Thanks. No, it works in stochastic framework with unforeseen exogenous shocks as far as I know.

Yes and no. Due to the piecewise linear solution, there will still be certainty equivalence. You won’t get the precautionary behavior typically associated with stochastic setups with occasionally binding constraints.

Ok, good point, thank you. So, never would be able to consider an anticipated shock with occbin then, right??

Given that deterministic shocks are not possible to work with, I tried news shock type of setting so that I could preserve varexo and get anticipated shock responses when an occasionally binding constraint is present, but no occbin still did not work. So, my conclusion would be that it is not possible to examine anticipated shocks (let it be deterministic shocks or news shocks) with occbin??

Thank you!

That’s not what I am saying. Of course you can do anticipated shocks.

I met similar problems that my two mod. files, my run.m (Occbin) file works successfully before I introduce news shock. But when I introduce news shock by simply changing one varexo from
u_j = rho_j*u_j(-1) + es_j +es_j4;

u_j = rho_j*u_j(-1) + es_j +es_j4(-4);

The Occbin collapsed. I have checked this multiple times to ensure that this is the only modification between the new pair of mod files and the old pair of mod files (which occbin works smoothly).

Why would this happen?

The error that dynare reports is:

Error using solve_one_constraint (line 61)
The two .mod files need to have exactly the same endogenous variables declared in the same order

Error in run (line 15)
[zdatalinear zdatapiecewise zdatass oobase_ Mbase_  ] = ...

But these two mod files do have exactly the same endogenous variables declared in the same order FOR SURE!

Can anyone help with this? Thanks a ton in advance!

using Iacoviello JME 2017’s codes as an example.
I simply change their codes about shocks from

log(az) = RHO_Z*log(az(-1)) + eps_z;


log(az) = RHO_Z*log(az(-1)) + eps_z(-1) ;

The dynare reports an error

Total computing time : 0h00m00s
Error using solve_two_constraints (line 78)
baby00 and baby10 need to have exactly the same endogenous variables and they need to be declared in the same

Error in runsim_plot_figure3 (line 79)
    [zdatal zdatap zdatass oobase_ Mbase_] = solve_two_constraints(...

For convenicence, I uploaded their codes below.
replication_figure3_4.rar (1014.0 KB)

Many Thanks in Advance!