FRBNY-DSGE / DSGE-2015-Apr

Replication files for Liberty Street Economics blog post "The FRBNY DSGE Model Forecast--April 2015"
http://libertystreeteconomics.newyorkfed.org/2015/05/the-frbny-dsge-model-forecast-april-2015.html
30 stars 24 forks source link

Error using hessizero (line 51) #6

Open heqiang1122 opened 6 years ago

heqiang1122 commented 6 years ago

Hello, I run this code in matlab 2017b with default settings,and got this:

Hessian Element: (23 23)Error using hessizero (line 51) negative diagonal in hessian

Error in gibb (line 120) hessian = hessizero('objfcndsge',[params,para_mask],1,...

Error in Main (line 37) gibb

Error in run (line 91) evalin('caller', strcat(script, ';'));

Could you please help me with this problem? Thank you.

pearlzli commented 6 years ago

Just to make sure, are you using the most recent commit (currently 22d7d870ffbe0f4c7ebf83a7125f922b2c681445)? This problem was hopefully addressed in #5.

Also, as I say there, this code was written for MATLAB 09a, and we can't guarantee that base MATLAB functionality hasn't changed between versions.

heqiang1122 commented 6 years ago

Dear Ms.Pearl Li, Thanks for your reply. I downloaded the code directly form https://github.com/FRBNY-DSGE/DSGE-2015-Apr on Mar 30, 2018. I run the code in Matlab 2017b with default settings ,and here is what I got:

run Main.m Previous mode found, reading in... Re-computing Hessian

Hessian Element: ( 1 1) Value Used: 8359737221.466498 Hessian Element: ( 2 2) Value Used: 349946212.559323 Hessian Element: ( 3 3) Value Used: 7826600629.781106 Hessian Element: ( 5 5) Value Used: 2812576222.399733 Hessian Element: ( 6 6) Value Used: 1550752369.492856 Hessian Element: ( 7 7) Value Used: 2477079995.502542 Hessian Element: ( 8 8) Value Used: 2287820533.680358 Hessian Element: ( 9 9) Value Used: 2221824931.355857 Hessian Element: (10 10) Value Used: 2312916177.135929 Hessian Element: (11 11) Value Used: 2878414536.886330 Hessian Element: (12 12) Value Used: 3371621727.031345 Hessian Element: (13 13) Value Used: 2884659599.906016 Hessian Element: (14 14) Value Used: 992141980.326746 Hessian Element: (15 15) Value Used: 2722401988.928441 Hessian Element: (17 17) Value Used: 3833060813.424632 Hessian Element: (18 18) Value Used: 6926101716.118700 Hessian Element: (20 20) Value Used: 2295626761.715567 Hessian Element: (21 21) Value Used: 2439205365.888223 Hessian Element: (23 23)Error using hessizero (line 51) negative diagonal in hessian

Error in gibb (line 120) hessian = hessizero('objfcndsge',[params,para_mask],1,...

Error in Main (line 37) gibb

Error in run (line 91) evalin('caller', strcat(script, ';'));

Could you fix this for me, please?

Regards Qiang He

At 2018-03-30 01:48:51, "Pearl Li" notifications@github.com wrote:

Just to make sure, are you using the most recent commit (currently 22d7d87)? This problem was hopefully addressed in #5.

Also, as I say there, this code was written for MATLAB 09a, and we can't guarantee that base MATLAB functionality hasn't changed between versions.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

ikarib commented 4 years ago

To fix the problem with negative hessian diagonal, change you lyap_nonstationary.m and replace line P0 = dlyap(T,R*Q*R'); by V=R*Q*R'; nb=size(T,1); P0 = reshape((eye(nb^2)-kron(T,T))\V(:),nb,nb);

heqiang1122 commented 4 years ago

Thank you. It works.

At 2020-05-09 02:48:43, "Iskander Karibzhanov" notifications@github.com wrote:

To fix the problem with negative hessian diagonal, change you lyap_nonstationary.m and replace line P0 = dlyap(T,RQR'); by V=RQR'; nb=size(T,1); P0 = reshape((eye(nb^2)-kron(T,T))\V(:),nb,nb);

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

alessandrocaiani commented 4 years ago

I also have the same issue. Tried to solve as suggested above (https://github.com/FRBNY-DSGE/DSGE-2015-Apr/issues/6#issuecomment-625962315): it seems to work but it slowdowns the speed of the estimation procedure considerably (10 or more times slower). Any idea on how to solve this issue and keep on using dlyap so to preserve execution speed? Many thanks in advance!