Dear dynare users,
I have a problem with a linear model and stoch_simul that (I think) is related to the version of dynare I run. This is behind my knowledge of dynare, this is why I am asking your help.
I am running a toy model (for a lecture I am preparing) to verify the intuition that you cannot interact variables with shocks in a linear environment.

In attach you can find the mod file I am working on. Line 57 has the taylor rule where one of the coefficients is interacted with an exogenous variable (eMM):

rn = (rho+eMM)rn(-1) + Spi(-1) - 0.25*(eM)

now, in theory I should get an error as the model has became implicitly non linear (in the part eMM*rn(-1), which linear approximation should be eMM_(steady state) * rn(-1)-rn(steady state) + rn(steady state) * eMM).

If I run this code with dynare 4.5.1 I get the following message:

Blockquote
ERROR: If the model is declared linear the second derivatives must be equal to zero.
The following equations had non-zero second derivatives:
* Eq # 14

which makes sense as it was what I expected. However, when I run the model with dynare 4.4.3 everything runs smoothly and I even get IRFs. My question is how can dynare 4.4.3 compute IRFs with a non linear model? How can it get the state-space representation? The model is clearly misspecified as linear when it is not.
Secondly, and more importantly, can I trust the output of stoch_simul and simul in dynare 4.4.3? This is rather hard to me as I am getting an output although I know the code is doing something wrong (again declaring the model as linear when it’s not).

Thank you very much for the help, it’s greatly appreciated as always.

Thanks for the very precise info. It was a bug I was not aware off.

Just one more clarification, to fully understand the issue, does this affect also the deterministic simulation?
I think it should right? Because dynare uses the Jacobian matrix to compute the deterministic simulation and (therefore) if the model is declared as linear when it is not, the Jacobian matrix is not properly defined. Is this right? Or am I missing something?

Please use Dynare 4.5. In 4.4.3, there was another bug that affect perfect foresight simulations of nonlinear models that were declared linear. It only occured in rare instances, but you should nevertheless rely on the bug-fixed version.

In reference to this, it is impossible to do an interest rate peg in a linear version of the model. Is that right?

For instance:
In a linear model, a ZLB peg would be written as : R=(1-zlb_shock)(phi_pipi) where zlb_shock has a value of 1 for n number of zlb periods.

Well, this is tricky, as always when dealing with ZLB issues.
I think that the model could run in the way you modified it, but before implementing those changes you might want to consider 2 remarks.

consider the non linear equation you have written and try to linearize it around the steady state. Would you get your linear equation? At first glance it wouldn’t seem so. So, be careful when attaching shocks to parameters in a linearized model. always better to write the non linear form and let dynare do the work for you when possible.

this is a more general comment that I have on ZLB models. In the way you implement it (i.e. with shocks) agents (in each periods) will expect not to be in the ZLB. Your constraint acts as a shock, which agents do not expect. That is totally different from being at the ZLB knowing that the economy is and will be stuck there. I don’t want to start a long discussion on expectations, but assuming that agents are shocked at each period is a big deal in these models. Additionally, you might be imposing the ZLB for periods in which the interest rate is far away zero (you don’t know!). There are possible alternatives you might want to consider: a) you may want to use a deterministic simulation, in which you set R=max(0,R_ss*zlb_shock+(1-zlb_shock)*R_ss(pi/pi_ss)^(phi_pi)) this would enforce the ZLB when necessary; b) there is always OccBin a toolkint for dynare developed by Iacoviello of the Fed; it implements occasionally binding constraints which canbe easily used to run a ZLB simulation (in their example code I think the make this example!)

@sp1589 The ZLB in principle is an occasionally binding constraint. The question you seem to be worried about is how to bring the economy to the ZLB and keep it there. In contrast, @Massimo seems to be mostly concerned with the ZLB binding due to other shocks hitting. Both approaches are valid, the question is what you are trying to achieve.