estimation with dynare 4.3.1: possible bug

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

estimation with dynare 4.3.1: possible bug

Postby ilobayesian » Wed Oct 17, 2012 4:40 pm

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?
ilobayesian
 
Posts: 37
Joined: Mon Jul 25, 2011 3:55 pm

Re: estimation with dynare 4.3.1: possible bug

Postby jpfeifer » Wed Oct 17, 2012 8:24 pm

Could you provide me with the mod- and data-files.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: estimation with dynare 4.3.1: possible bug

Postby ilobayesian » Thu Oct 18, 2012 7:09 am

Sure, I sent them to you by private message.

Best
Giorgio
ilobayesian
 
Posts: 37
Joined: Mon Jul 25, 2011 3:55 pm

Re: estimation with dynare 4.3.1: possible bug

Postby ilobayesian » Fri Oct 19, 2012 10:28 am

I noticed that this happens only with a larger data set. The problem disappears if I use less observations...
ilobayesian
 
Posts: 37
Joined: Mon Jul 25, 2011 3:55 pm

Re: estimation with dynare 4.3.1: possible bug

Postby ilobayesian » Mon Oct 22, 2012 2:23 pm

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) ;
ilobayesian
 
Posts: 37
Joined: Mon Jul 25, 2011 3:55 pm

Re: estimation with dynare 4.3.1: possible bug

Postby jpfeifer » Mon Oct 22, 2012 3:00 pm

Please send me the files to replicate the issue.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: estimation with dynare 4.3.1: possible bug

Postby ilobayesian » Tue Oct 23, 2012 9:02 am

Here i attach the files.

Regards
Giorgio
Attachments
trigari_dataUS.m
(15.95 KiB) Downloaded 305 times
kappa_w_trigari_test.m
(270 Bytes) Downloaded 282 times
trigari_estimation_steadystate.m
(3.81 KiB) Downloaded 302 times
trigari_estimation.mod
(5.73 KiB) Downloaded 370 times
ilobayesian
 
Posts: 37
Joined: Mon Jul 25, 2011 3:55 pm

Re: estimation with dynare 4.3.1: possible bug

Postby jpfeifer » Tue Oct 23, 2012 8:42 pm

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.
Attachments
dsge_likelihood.m
(28.81 KiB) Downloaded 305 times
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: estimation with dynare 4.3.1: possible bug

Postby ilobayesian » Wed Oct 24, 2012 7:50 am

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?
ilobayesian
 
Posts: 37
Joined: Mon Jul 25, 2011 3:55 pm

Re: estimation with dynare 4.3.1: possible bug

Postby jpfeifer » Wed Oct 24, 2012 10:08 am

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.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: estimation with dynare 4.3.1: possible bug

Postby dleivagarces » Mon Nov 12, 2012 1:18 pm

So, anyone have the final .mof file?

Greatings
dleivagarces
 
Posts: 2
Joined: Mon Nov 12, 2012 1:07 pm


Return to Dynare help

Who is online

Users browsing this forum: Google [Bot] and 5 guests