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.

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??

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;
to

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).

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!

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;

to

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
order
Error in runsim_plot_figure3 (line 79)
[zdatal zdatap zdatass oobase_ Mbase_] = solve_two_constraints(...