RegardingERROR: GHH.mod:59.1: syntax error, unexpected NAME

Have you considered that the Dynare model is in logs?

Yes, I considered this, taking the log of the true steady state values:

did not give me the computed steady state value in Dynare, which are:
k= 0.0744721
h= -1.38021
l= -0.378713
c= -0.875989

What does the fact that Dynare solves the model in log implies for the general results (statistics of autocorrelation and so on)? I thought that I would have still obtained the same sort of final results as I did using quadratic approximation. Many thanks.


Regarding the steady state, for the same parametrization (!), it should be identical between the quadratic approximation and Dynare. You cannot compare a calibrated version with estimation results where the parameters are different as the steady state depends on the parameters. If the parameters are the same and the steady state differs after accounting for having the model in logs, the models are apparently not identical and something is still wrong.
When you are trying to compare moments, you have to remember that a quadratic approximation means that certainty equivalence holds. Hence, you are doing a first-order approximation. So you should compare it to stoch_simul(order=1) and not Dynares default second order approximation. In the latter, uncertainty (the size of the shocks) influences the results.
As a last point, if you are trying the compare moments, you have to make sure that you compare the same thing. In Dynare there are both simulated and theoretical moments. I don’t know what you do in the quadratic approximation case.

Yes, you dead right about quadratic approximation and what the certainty equivalence implies for the estimation of the “calibrated” model. To explain what I did with quadratic approximation -I used the same set of values for the deep parameters as I did solving the model in dynare, then I simulated the model to generate the relevant moments. Hence, I guess in dynare I should be concerned with the simulated moments not the theoretical one. Again my estimation in dynare was done using the option (order=1) as you rightly pointed out. As you said, the current discrepancies may be down to something else being wrong, but for the moment I genuinely cannot see what this can be. I will keep on trying though. Many thanks.


Dear jpfeifer,

I was wondering if you could help, I was running my sensitivity analysis when I got the following error:

java.lang.OutOfMemoryError: Java heap space
at java.lang.ClassLoader.findLoadedClass0(Native Method)
at java.lang.ClassLoader.findLoadedClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at com.mathworks.jmi.OpaqueJavaInterface.getExceptionMessage(
??? Error using ==> drawnow
Failed to retrieve Exception Message

Error in ==> waitbar at 256

Error in ==> random_walk_metropolis_hastings_core at 121
waitbar(prtfrc,hh, ‘(’ int2str(b) ‘/’ int2str(options_.mh_nblck) ‘) ’ sprintf(’%f done,
acceptation rate %f’,prtfrc,isux/j)]);

Error in ==> random_walk_metropolis_hastings at 73
fout = random_walk_metropolis_hastings_core(localVars, fblck, nblck, 0);

Error in ==> dynare_estimation_1 at 1061

Error in ==> dynare_estimation at 62

Error in ==> ghhother1alpha5 at 159

Error in ==> dynare at 132
evalin(‘base’,fname) ;

Error in ==> mainsensitivity at 9
dynare ghhother1alpha5.mod

Also, I cannot longer go to matlab and copy the following tables to paste in excel as the screen does no longer display all the results since there are so many of them i.e.
prior mean post. mean conf. interval prior pstdev

gamma 2.900 4.0351 3.1988 4.8358 invg 0.3000
beta 0.960 0.9889 0.9830 0.9952 invg 0.1000
alpha 0.200 0.2058 0.1745 0.2386 beta 0.0200
theta 0.600 0.5967 0.5640 0.6286 beta 0.0200
omega 2.500 2.5834 2.3560 2.8118 invg 0.0500
sigma 0.040 0.0404 0.0065 0.0724 norm 0.0200
rho 0.700 0.6893 0.6550 0.7219 beta 0.0200

standard deviation of shocks
prior mean post. mean conf. interval prior pstdev

e 0.950 0.2420 0.1639 0.3131 invg Inf

I know that in the output folder I can get the graphs for the priors and posteriors mean but this does not convey all the information. Would you know a way around this issue please, a code perhaps which will directly add the above table to the output folder? Many thanks.

NB: still no luck on getting the same steady state values solving the model in dynare vs quadratic approximation. I have consulted many people, but no one seem to know what is going on. I will keep on trying though.


I am using Matlab 7.8.0 (R2009a) on a 64 bits computer.

Thank you.

Regarding the problem with the java heap space, a workaround can be found at [Java Heap Space/Out of Memory).
For the parameters, everything you need is stored in the oo_ - structure as documented in the manual. You just have to write you own code to read out the information after Dynare has finished running.

Thank you.


Dear jpfeifer, I just got the following output from my bayesian estimation and was wondering if you knew what the red line on beta meant? as well as the discontinuity green line for omega. I know that a flat log likelihood kernel means that the data has no information, but in the case of rho the line is not flat in the sense of being parallel to the x axis, would you know the meaning of this.
In fact, what I wanted to plot initially was the negative of the log-likelihood as they did for the Ryoo and Rosen’s model in Practicing Dynare, can you tell me what other information would give me as supposed to the one I plotted or are all these plots doing the same thing? Thank you so much.

Check plots.pdf (6.37 KB)

Dear Mr Juillard,

I was wondering if you could please help with the following error I receive when I try to compare 2 models in dynare;
PosteriorIRF :: is not a declared endogenous variable!
??? Attempted to access IndxVariables(1); index out of bounds because numel(IndxVariables)=0.

Error in ==> PosteriorIRF at 187
if max(y(IndxVariables(j),:)) - min(y(IndxVariables(j),:)) > 1e-12

Error in ==> dynare_estimation_1 at 1078

Error in ==> dynare_estimation at 62

Error in ==> ghhother1 at 162

Error in ==> dynare at 132
evalin(‘base’,fname) ;

I went through your post with Tanya dating from 2006 and used the comparison option in the mod file as you advised her to, please see attached mod files (the option is in ghhother1.mod, after estimation). Since the models I am comparing have respectively 1 and 2 shocks I also used one observable for the first model and two for the second, hence the two data files.

Another problem I also encountered during my sensitivity analysis is that Dynare crashes when I use a small values for beta, I read in one of the post that this was a bug, has this been fixed now? .

My last question is a strange one but I just need to confirm this, why the name jumping distribution when we deal with the MH algorithm? is it because we are dealing with
a binomial probability distribution of the candidate parameter prior to each iteration? Thank you ever so much. And I must say that I really appreciate all the help you have given me so far.

data2.m (1.73 KB)
data.m (916 Bytes)
GHHother2.mod (2.24 KB)
GHHother1.mod (2.22 KB)

I tried to replicate the program above and i trink it’s completely the same:

*var c k h l z;

varexo e;

parameters beta alpha gamma theta omega rho sigma;

beta = .96;
alpha = .29;
gamma= 2;
theta = .6;
omega= 1.42;
sigma = .045;







var e = sigma^2;


but i get the following error message:
Error: File: Abschlusspaper.m Line: 22 Column: 58
The expression to the left of the equals sign is not a valid target for an assignment.
(that’s the line with the third equation)

Can you tell me what the problem is?
Thank you in advance!

Could it be that you run the code as a m-file and not a mod-file executed with Dynare? If you did the latter, it would tell you

[quote]Starting preprocessing of the model file …
ERROR: There are 4 equations but 5 endogenous variables!

Error using dynare (line 131)
DYNARE: preprocessing failed[/quote]