Need Urgent Help :( Gali Monacelli (2005)


I was working on Gali Monacelli (2005) and wrote the following file in dynare. It gives the following error message first:

             STEADY:  numerical initial values incompatible with the following equations
                            1     3

I tried to give k_alp, gamma_a, alpha, and w some numbers instead of defining them in terms of other parameters, it worked but this time it gave another error message:
SOLVE: maxit has been reached

What’s the matter with my codes?

Can someone help me? I need to do this work for my thesis…
gali.mod (1.46 KB)

The lines assigning values to parameters that are functions of other parameters need to be inside the “model” bit, with "#"s in front of them, as in the attached mod file. (I’m using Dynare 4.0.2.)

Hope that helps…
gali_corrected.mod (1.45 KB)

Dear hakaner.tcmb

the main problem with you code is that you have defined some parameters as a function of other parameters not yes specified. To be concrete, gamma_a = (1+psi)/(sigma_alp+psi);
k_alp = lambda*(sigma_alp+psi); are function of sigma_alp which is defined only after them. Since matlab reads the code from the top to the bottom and from the left to right, when it tries to compute gamma_a it does not know what sigma_alp is and then it does not compute gamma_a. This is true also for k_alp. Just try to copy-paste the parameters in matlab and you will see.
When then it tries to solve the model it has not the values for gamma_a and k_alp and then it gives you the error.
Hence, just move the sigma_alp equation before gamma_a and k_alp and the code will work.
The suggestion of JamieHall is then correct, because you will have consistent values for all the parameters function of other parameters every iteration.

Hi JamieHall and P. Gelain,

Thank you very much for your fast response and helpful comments. The code works now :slight_smile: and I feel better.

Wish you best.


Dear Hakan,

I’m currently working on the same model and even though the code that I have is working, I can’t get exactly the same impulse response functions given in the paper. I was wondering if you managed to get the same results.

Many Thanks,


Does anyone have a working code for this model please? Thanks!

this is the modle you can even find many models in
NK_GM05.mod (8.8 KB)

A replication file for the Gali/Monacelli (2005): Monetary Policy and Exchange Rate Volatility in a Small Open Economy", Review of Economic Studies 72, pp. 707-734 is available at

Dear Jpfeifer,

I am also trying to replicate Gali/Monacelli (2005), but I want to write the model in levels and put it into dynare. Do you have or know where to find the code with non-linear model?

Thank you very much!

Sorry, but that code is not available yet. You would have to start from and add the open economy dimension.

Dear Pfeifer,

Thank you so much. I will try it.