Bug in dr1.m with loglinear option in estimation

Hi,

I believe that dr1.m contains a bug. I found the bug while working with a model that I estimated using ‘loglinear’. To illustrate the point, I made a very simple model (which is actually loglinear). I attached the mod file. When the loglinear option is in the estimation command, the matrix multiplication in line 263 of dr1.m has incorrect dimensions. Currently, it reads:

    dr.ghx = repmat(1./dr.ys,1,size(dr.ghx,2)).*dr.ghx.* ...
             repmat(dr.ys(klags),size(dr.ghx,1),1);

I think it should read

    dr.ghx = repmat(1./dr.ys,1,size(dr.ghx,2)).*dr.ghx.* ...
             repmat(dr.ys(klags)',size(dr.ghx,1),1);

You can see that things work fine when you delete the loglinear option from estimation. If one of the developers could look at this, it would be great. Also, if you could please advise on the best place to register bugs, I would appreciate it.

Best,

Ben
problem_with_loglinear.mod (903 Bytes)

Dear Ben,

thank you for reporting the problem. It will be corrected in tomorrow’s unstable version.

Kind regards,

Michel

Hi Michel,

Thanks so much! I really appreciate your time and attention to this issue. Thanks for all your work on Dynare!

Best,
Ben