Page 1 of 1

estimation with dynare 4.3.1: possible bug

PostPosted: Wed Oct 17, 2012 4:40 pm
by ilobayesian
Dear All,
I am trying to replicate the paper "An Estimated Monetary DSGE Model with Unemployment and Staggered Nominal Wage Bargaining", by Gertler, Sala and Trigari. When I lunch the estimation everything goes very fast and smooth until the M-H kicks in. At that point I get the following error:

"??? Operands to the || and && operators must be convertible to logical scalar values.

Error in ==> random_walk_metropolis_hastings_core at 176
if (logpost > -inf) && (log(rand) < logpost-ilogpo2(b))

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

Error in ==> dynare_estimation_1 at 884
feval(options_.posterior_sampling_method,objective_function,options_.proposal_distribution,xparam1,invhess,bounds,dataset_,options_,M_,estim_params_,bayestopt_,oo_);

Error in ==> dynare_estimation at 70
dynare_estimation_1(var_list,dname);

Error in ==> trigari_estimation at 626
dynare_estimation(var_list_);

Error in ==> dynare at 120
evalin('base',fname) ;"


I lunch the estimation with the following options:

"estimation(order=1,datafile=trigari_dataUS,plot_priors=0, mh_jscale=0.25, mh_nblocks=2, mode_compute=6);"

This is how I specify the measurement equations:

"dy=100*(gammaz-1)+yt-yt(-1)+e_zt;

dc=100*(gammaz-1)+ct-ct(-1)+e_zt;

dinve=100*(gammaz-1)+it-it(-1)+e_zt;

dw=100*(gammaz-1)+wt-wt(-1)+e_zt;

labobs=nt;

pinfobs=pit;

robs=rt;"

Finally, I use the dataset of SW2007 available on the AER website.

The interesting thing is that when I use the default computation mode, dynare complains about matrix singularity and if I use version 4.3.0 it warns me about it and then the computation goes very slow.

Can someone help?

Re: estimation with dynare 4.3.1: possible bug

PostPosted: Wed Oct 17, 2012 8:24 pm
by jpfeifer
Could you provide me with the mod- and data-files.

Re: estimation with dynare 4.3.1: possible bug

PostPosted: Thu Oct 18, 2012 7:09 am
by ilobayesian
Sure, I sent them to you by private message.

Best
Giorgio

Re: estimation with dynare 4.3.1: possible bug

PostPosted: Fri Oct 19, 2012 10:28 am
by ilobayesian
I noticed that this happens only with a larger data set. The problem disappears if I use less observations...

Re: estimation with dynare 4.3.1: possible bug

PostPosted: Mon Oct 22, 2012 2:23 pm
by ilobayesian
Any help? I now get the error while "tuning up scale parameter"

??? Operands to the || and && operators must be convertible to logical scalar
values.

Error in ==> gmhmaxlik at 113
if logpo2 > -inf && log(rand) < logpo2 - ilogpo2

Error in ==> dynare_estimation_1 at 292
[xparam1,PostVar,Scale,PostMean] = ...

Error in ==> dynare_estimation at 70
dynare_estimation_1(var_list,dname);

Error in ==> trigari_estimation at 518
dynare_estimation(var_list_);

Error in ==> dynare at 120
evalin('base',fname) ;

Re: estimation with dynare 4.3.1: possible bug

PostPosted: Mon Oct 22, 2012 3:00 pm
by jpfeifer
Please send me the files to replicate the issue.

Re: estimation with dynare 4.3.1: possible bug

PostPosted: Tue Oct 23, 2012 9:02 am
by ilobayesian
Here i attach the files.

Regards
Giorgio

Re: estimation with dynare 4.3.1: possible bug

PostPosted: Tue Oct 23, 2012 8:42 pm
by jpfeifer
You are correct. This is a bug. Could you try replacing the original Dynare file in the matlab folder with the attached file. This should fix the issue. If not, please give me feedback.

Re: estimation with dynare 4.3.1: possible bug

PostPosted: Wed Oct 24, 2012 7:50 am
by ilobayesian
Thank you for your reply. Unfortunately, it still crashes. Now I get

Loading 180 observations from trigari_dataUS.m

Warning: File 'mh_scale_fname' not found.
> In dynare_estimation_1 at 119
In dynare_estimation at 70
In trigari_estimation at 514
In dynare at 120
Initial value of the log posterior (or likelihood): -383536474.8093

==========================================================
Change in the covariance matrix = 2.25.
Mode improvement = 383481490.6832
New value of jscale = 5.572e-017
==========================================================
Warning: Matrix is singular to working precision.
> In dynare_estimation_1 at 322
In dynare_estimation at 70
In trigari_estimation at 514
In dynare at 120
??? Error using ==> chol
Matrix must be positive definite.

Error in ==> gmhmaxlik at 196
dd = transpose(chol(CovJump));

Error in ==> dynare_estimation_1 at 311
[xparam1,PostVar,Scale,PostMean] = ...

Error in ==> dynare_estimation at 70
dynare_estimation_1(var_list,dname);

Error in ==> trigari_estimation at 514
dynare_estimation(var_list_);

Error in ==> dynare at 120
evalin('base',fname) ;

Can this have something to do with the data I am using?

Re: estimation with dynare 4.3.1: possible bug

PostPosted: Wed Oct 24, 2012 10:08 am
by jpfeifer
Now this is not a bug, but a problem that Dynare did not find the mode. It could be anything, ranging from data not being consistent with the observation equations to errors in the model or too uninformative priors.

Re: estimation with dynare 4.3.1: possible bug

PostPosted: Mon Nov 12, 2012 1:18 pm
by dleivagarces
So, anyone have the final .mof file?

Greatings