I was trying to calibrate my model but got the following error message.
ERROR: If the model is declared linear the second derivatives must be equal to zero.
The following equations had non-zero second derivatives:
* Eq # 11
* Eq # 12
* Eq # 13
* Eq # 14
* Eq # 15 Baseline_model_0507.mod (9.6 KB)

However, I re-check my equations but did not find any problem.

I would highly appreciate that if anyone can help me to find what is the problem?
The mod file is attached below.

Those equations are not linear, that is why it’s not working.

For example exp(alpha_t)*alpha_t in equation 12 or s*txs*tx/(1-s) in 14 are not properly linearized. Try to find the mistakes in your linearization or another solution is to let Dynare do it for you and you give the non-linear model.

Baseline_model_0507.mod (9.5 KB)
Dear professor DoubleBass,
Sorry, I am bothering you again. I modified the code in order to fit in the standard of non-linear. Still, the error message of the second derivatives must be equal to zero popup.
The following equations had non-zero second derivatives:
* Eq # 11 [11.)Defination of profits]
* Eq # 14 [14.)Total demand function]
* Eq # 15 [15.)Local Government budget constraint]
For instance, I think it might be attributes to the usage of #ys? But actually ys can be expressed by the parameters in the model in accordance to the basic setting in the %%steady state part of the model(linear) in my code, although in a literaly complex way. So it is quite amazing that the dynare can’t regard it as a linear equation? Besides, I still don’t get the access to how to let Dynare to deal with the non-linear model, is there any examples intended for the beginners? Any help is appreciated. Thank you so much!
Best regards
Haruka

You did not solve the inherent problem that was there before. Your steady state values like gly and ys are supposed to be parameters, but some of them actually depend on endogenous variables. Like gly for instance depends on tau, which is a variable. Thus a steady state depends on an endogenous variable, which does not make sense right? The # defines local variables, but steady states should not be variables.

You calculated the steady state before log-linearizing, right? Otherwise that would have been difficult. Those steady state values are numerical values. In case you need them in some equations, which if your equations are correct you do, they have to be included as parameters.

To include the model in non-linear form you just include all optimality conditions like FOC’s and BC’s and write model; and not model(linear). Then, however, you have to tell Dynare to calculate the steady state for you, give it initial values or a steady state file. Just look around the forum and you will find plenty examples of easy models in non-linear form.

Just saw that Willi Mutschler uploaded a video on his Youtube today where he derives and implements a simple RBC in non-linear form in Dynare. Maybe it helps you understanding some of the concepts.