I modified Gali and Monacelli (2005)’ small open economy model to do the policy evaluation. Thus I write the model in levels. However, I got the error message"The Jacobian contains Inf or NaN". The code is attached. Anyone can help?

Just remove the check command before the model_diagnostics command and you will obtain more informations:

MODEL_DIAGNOSTICS: The Jacobian of the static model contains Inf or NaN. The problem arises from:
Derivative of Equation 3 with respect to Variable s (initial value of s: 1)
Derivative of Equation 8 with respect to Variable s (initial value of s: 1)
MODEL_DIAGNOSTICS: The problem most often occurs, because a variable with
MODEL_DIAGNOSTICS: exponent smaller than 1 has been initialized to 0. Taking the derivative
MODEL_DIAGNOSTICS: and evaluating it at the steady state then results in a division by 0.
MODEL_DIAGNOSTICS: If you are using model-local variables (# operator), check their values as well.
MODEL_DIAGNOSTICS: The Jacobian of the dynamic model contains Inf or NaN. The problem arises from:
Derivative of Equation 3 with respect to Variable s (initial value of s: 1)
Derivative of Equation 8 with respect to Variable s (initial value of s: 1)
MODEL_DIAGNOSTICS: The problem most often occurs, because a variable with
MODEL_DIAGNOSTICS: exponent smaller than 1 has been initialized to 0. Taking the derivative
MODEL_DIAGNOSTICS: and evaluating it at the steady state then results in a division by 0.
MODEL_DIAGNOSTICS: If you are using model-local variables (# operator), check their values as well.

An obvious problem seems to be the value of eta (which should not be equal to one)… But they are other issues after.

In a sense yes. You are trying to run the model in a limit case with eta=1. Mathematically, that is not a problem, but numerically, the computer does not know how to handle the limit where you have a variable with (s^0)^\infty

At least the first problem… It is not possible to have eta equal to 1 because you have terms like 1/(1-eta). If you change this, you will fix the NaNs issue, but you will see that you have other issues with the model.

If you really need to consider the limit case, you’ll have to do it analytically and change the equations accordingly (i.e. change a CES like production function for a Cobb Douglas). Unfortunately Dynare cannot do this for you…

I am having similar problem. In my case dynare is able to solve the model and generate irf, but when I am using model_diagnostics command then it is saying that:

MODEL_DIAGNOSTICS: The Jacobian of the static model contains Inf or NaN. The problem arises from: (%%%%)
MODEL_DIAGNOSTICS: The problem most often occurs, because a variable with
MODEL_DIAGNOSTICS: exponent smaller than 1 has been initialized to 0. Taking the derivative
MODEL_DIAGNOSTICS: and evaluating it at the steady state then results in a division by 0.
MODEL_DIAGNOSTICS: If you are using model-local variables (# operator), check their values as well.

I read that such problem may come due to small bug in dynare ( I am suing 4.5.7).
I am attaching the code. I am not sure if I am doing some mistake or it is due to some small bug.

I will be thankful if someone can help me in this regard.