Hi everyone,

I am currently working on a model where I want to get Ramsey solution to it.

I calculated the steady state of the lagrange multipliers provided by the get_ramsey code. They are accurately calculated in the firesales_out_lmss.m file. Then I modified the model file “firesales_out.mod” as suggested in the instructions in get_ramsey. However, when I run the code, I get the following error:

??? Undefined function or variable ‘exo_nbr’.

Error in ==> firesales_out at 189

if exo_nbr > 0;

Error in ==> dynare at 26

evalin(‘base’,fname) ;

I checked the file firesales_out.m, exo_nbr is defined as a global variable and is given equal to 2 at line 95 (before the error line 189). It seems that there should not be a problem with this variable. I cannot figure out what is really wrong.

I am attaching the file firesales_out.m here. I would greatly appreciate if you could help me with this problem. I am stuck with a problem but I have no idea where this problem comes from. I googled it, looked into dynare forum, but again no answer was helpful to figure out the problem.

The file “modifiednewapproach” is the original file with an exogenous policy rule. The file firesale.mod is the file for get_ramsey. I calculate the steady state of the model with parameterfun.m and steadystate12.m. firesales_ss.m file computes the steady the of the model variables and creates var_SS to be used in firesales_out_lmss.m.

Thanks so much for your help in advance.

firesales_out.m (5.33 KB)

Hi,

The get_ramsey code was not written by the Dynare team, so we can’t provide much help.

However, I would suggest that you upgrade to Dynare 4.0.4, and give a try to the new way of computing Ramsey policy.

See:

dynare.org/DynareWiki/OptimalPolicy

Hope this can help.

Best,

Sébastien

Thanks for the response. The model I am working is pretty big so I do not know if I am going to be able to get the ramsey policy rule to my model.

But I tried to run the first model given in the link you posted. I get the following error:

??? Error using ==> dynare at 19

ERROR: there are 2 equations for 3 endogenous variables

I am currently using version dynare 4.0.3 and Matlab 2008a. I am running Matlab on Windows 32bit. Is the error related to version of dynare or am I supposed to do something else to run this mod file?

Also, on the dynare web, it says

What doesn’t work

```
* optimal policy rules
* using Matlab functions beyond power, log(), exp(), sqrt(), sin(), cos(), tan()
* some mixing of Matlab code inside the *.mod file
* the manual isn't updated
```

I am a little bit lost here. I will greatly appreciate any clarification on this issue.

I also tried the same file given in DynareWiki in dynare 4.0.4. I am still getting the same error:

??? Error using ==> dynare at 19

ERROR: there are 2 equations for 3 endogenous variables

Any help?

Thanks,

Elif.

I have just tested this file with Dynare 4.0.4 and it works.

My guess is that older versions of Dynare are still present in your MATLAB path.

Please check your path, and then type “dynare_version” at the MATLAB prompt.

Best,

Sébastien

Hi Sebastien

Thanks for your help. I have both version 3 and version 4 on my computer. I will try it again.

Best,

Elif.