If commands, using certain model equations depending on the realization of a productivity shock

Dear Ben,

I don’t see how to do that in Dynare with the perturbation approach (to solve locally the stochastic model). But you can implement this in a perfect foresight model (and if you need to simulate time series you can consider the extended path approach). To do that you may use the inequality binary operators (> or <), and write a state dependent equation like this:

(HomeIsBetter>0)*( EXPRESSION ) + (1-(HomeIsBetter>0))*( ANOTHER EXPRESSION ) = 0 ;

where HomeIsBetter may be an exogenous or an endogenous variable, EPRESSION and ANOTHER EXPRESSION are expressions involving parameters, endogenous and exogenous variables (your two equations).

There is no unique representation of your problem (you can use other kind of conditions), and different representations may have different advantages numerically (i.e. Dynare may fail to find the solution for one representation but not for another which is logically equivalent). With this state dependent equation, we introduce a non differentiability in the model (as we would do with a positivity constraint)… So you may experience difficulties in finding the solution.

Note also that you can do that, in principle, on more than one equation.

Best,
Stéphane.