Estimation with dynare 4.3.1: possible bug

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?

Could you provide me with the mod- and data-files.

Sure, I sent them to you by private message.

Best
Giorgio

I noticed that this happens only with a larger data set. The problem disappears if I use less observations…

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) ;

Please send me the files to replicate the issue.

Here i attach the files.

Regards
Giorgio
trigari_dataUS.m (16 KB)
kappa_w_trigari_test.m (270 Bytes)
trigari_estimation_steadystate.m (3.81 KB)
trigari_estimation.mod (5.73 KB)

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.
dsge_likelihood.m (28.8 KB)

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?

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.

So, anyone have the final .mof file?

Greatings