SVD error (NaN or Inf) because of +1 variable??

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.

SVD error (NaN or Inf) because of +1 variable??

Postby joasi » Tue Jan 17, 2012 1:35 pm

Dear All,

I am facing the SVD error that many have ‘Input to SVD must not contain NaN or Inf.

I have gone through the forum and read the answers to the same error message (for instance this thread and that one), and double checked that all variables and parameters are loaded from my file.

The steady state calculation gives six values very close to 0, but I also have tried manually assigning a steady state vector with all variables significantly different from 0, but the error stays.

From the previous posts, I understand that it is most likely due to a non computable equation like a division by 0 maybe due to a negative power. So I manually found out that changing the ^ to a + in line 127 removes the error. I guess that the error might be that the lagged C(+1) is zero. But I don’t understand why it is so.

Can someone please confirm my analysis and help me solve this issue? I attach my model file and the mat file that contains the steady states and parameters loaded by the model. I renamed the MAT file to "dsge1_ss.mat.txt" because I couldn't upload it otherwise. It needs to be renamed "dsge1_ss.mat" without .txt.

Thanks!
Attachments
dsge1_forum.mod
Dynare model
(4.58 KiB) Downloaded 190 times
dsge1_ss.mat.txt
Steady states and parameters
(514 Bytes) Downloaded 164 times
joasi
 
Posts: 5
Joined: Tue Jan 17, 2012 11:45 am
Location: Singapore

Re: SVD error (NaN or Inf) because of +1 variable??

Postby jpfeifer » Tue Jan 17, 2012 4:23 pm

Unfortunately, the error message is somewhat cryptic. If you put
Code: Select all
resid(1);

before the steady command, you will see that some steady state values you provided are not close to the true ones (or the entered model equations are incorrect, but the steady state was):
Residuals of the static equations:
Equation number 1 : 3.8287e-005
Equation number 2 : 3.7537e-005
Equation number 3 : 3.8918e-006
Equation number 4 : -1.8426e-005
Equation number 5 : 3.5347e-005
Equation number 6 : -9.2706e-005
Equation number 7 : -1.3199e-005
Equation number 8 : -1.3357e-005
Equation number 9 : -6.8204e-005
Equation number 10 : -3.3649e-005
Equation number 11 : 3.2553e-005
Equation number 12 : 6.7483e-006
Equation number 13 : -6.0638e-005
Equation number 14 : 0.061165
Equation number 15 : -6.058e-005
Equation number 16 : 2.2328e-005
Equation number 17 : -0.038417
Equation number 18 : 6.8424e-005
Equation number 19 : -0.0014327
Equation number 20 : 0.022529
Equation number 21 : 0
Equation number 22 : 0.002674
Equation number 23 : 0
Equation number 24 : 0
Equation number 25 : 0.1
Equation number 26 : 0.315
Equation number 27 : 0.0164
Equation number 28 : 0.000382


Dynare now has a problem to find the true steady state and fails during numerically searching for the steady state because in one iteration of the numerical algorithm the used guess for the steady state results in an "Inf" and crashes the algorithm. The solution is both simple and tough: provide better starting values that are closer to the true ones. For your values all four optimizers in Dynare fail.
------------
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: SVD error (NaN or Inf) because of +1 variable??

Postby joasi » Tue Jan 17, 2012 4:35 pm

Thanks so much for your help. I actually wrote a Matlab script to optimize the system to look for a steady state, and these are the best values it could find. I hoped the residuals were small enough :roll: . I will work on improving my ss values.

Would it help Dynare, and would it be easier to find steady state values if I rewrote my model in log-linearized form?
joasi
 
Posts: 5
Joined: Tue Jan 17, 2012 11:45 am
Location: Singapore

Re: SVD error (NaN or Inf) because of +1 variable??

Postby jpfeifer » Tue Jan 17, 2012 4:41 pm

Yes, log-linearizing would help, because then all SS-values are identical to 0. However, in this case the SS-values become parameters in front of the variables in the linearized equations. If you are able to compute those analytically, you can also provide them to Dynare. Hence, there is no gain in loglinearization as you need the steady state values in any case.
------------
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: SVD error (NaN or Inf) because of +1 variable??

Postby janlirose » Thu Mar 08, 2012 6:01 am

From the previous posts, I understand that it is most likely due to a non computable equation like a division by 0 maybe due to a negative power. So I manually found out that changing the ^ to a + in line 127 removes the error. I guess that the error might be that the lagged C(+1) is zero. But I don’t understand why it is so!









-----------------------------------------------------------------------------
Classic Bridesmaid Dresses|Sheath Wedding Dresses|Black Junior Bridesmaid Dresses|Maternity Wedding Dresses
janlirose
 
Posts: 1
Joined: Thu Mar 08, 2012 5:52 am


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 4 guests

cron