convergence problem

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.

convergence problem

Postby clm89 » Sun Dec 29, 2013 2:49 pm

Hi,

I'm trying to simulate a deterministic model using dynare 4.2.5 for my master thesis. The problem is that the model does not seem to converge:after one iteration, i get the following error message:
Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate.
RCOND = NaN.
> In sim1 at 84
In simul at 93
In tesi1G at 228
In dynare at 120
Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate.
RCOND = NaN.
> In sim1 at 84
In simul at 93
In tesi1G at 228
In dynare at 120
Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate.
RCOND = NaN.
> In sim1 at 84
In simul at 93
In tesi1G at 228
In dynare at 120
Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate.
RCOND = NaN.

.....
.....

when i write resid(1) in the .mod file, i get the following errors, which seem to me quite small:
Residuals of the static equations:

Equation number 1 : 0
Equation number 2 : 0
Equation number 3 : 0
Equation number 4 : 0
Equation number 5 : 0
Equation number 6 : 0
Equation number 7 : 0
Equation number 8 : 0.00056463
Equation number 9 : -0.0091254
Equation number 10 : 0
Equation number 11 : 0.0015055
Equation number 12 : 0
Equation number 13 : 0

I suspect that either i give wrong initial values, or the model is wrong. Either case, I really need your help because I checked an insanely large number of times the .mod file and the .m file I use to compute the steady state(STEADYBtesi.m), and I cannot find where the error is and why I get those residuals (and if they are the cause to my problem.....). Could you please take a look at them (especially the .mod file) to see if the model block is mispecified, or there are other mistakes?

The model is quite simple so you don't need to spend a lot of time in checking it.

Since I'm quite new to Dynare, any suggestion regarding the writing of the .mod file would be strongly appreciated. thank you.


Cristiano
Attachments
STEADYBtesi.m
.m file used to compute the steady state values
(848 Bytes) Downloaded 57 times
Last edited by clm89 on Sat Jan 04, 2014 6:07 pm, edited 1 time in total.
clm89
 
Posts: 4
Joined: Sun Dec 29, 2013 2:28 pm

Re: convergence problem

Postby jpfeifer » Thu Jan 02, 2014 9:00 am

A good place to start looking is why your presumably mean zero exogenous process g is initialized to
Code: Select all
g=gss;

where gss=0.153
------------
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: convergence problem

Postby clm89 » Thu Jan 02, 2014 5:16 pm

Hi,

firstly, thank you for your quick answer. Actually g is not a zero mean shock, but to simplify the model in order to understand where the error is, I now have assumed that there is just the techonology (a_t) shock, and g=gss=.153 every period. The model works significantly better, but I still get residuals for two equations different from 0.
Any clue about that?

Cristiano
clm89
 
Posts: 4
Joined: Sun Dec 29, 2013 2:28 pm

Re: convergence problem

Postby clm89 » Fri Jan 03, 2014 6:17 pm

hi jpfeifer ,

I somewhat fixed my previous problem. With the model I now have, i obtain zero residuals for almost all equations but the penultimate. However, the model does not converge very well (i.e. it tooks 24 iterations to converge). Is there a maximum number of iterations that you would suggest to fix through options_.maxit_=; ??
cristiano
clm89
 
Posts: 4
Joined: Sun Dec 29, 2013 2:28 pm

Re: convergence problem

Postby jpfeifer » Fri Jan 03, 2014 6:23 pm

Not really, because you want convergence, no matter how many iterations it takes. Setting an upper limit is usually just practical to prevent an infinite loop where convergence would not be achieved at all. Setting an upper limit thus mostly depends on the time you are willing to wait.
------------
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: convergence problem

Postby clm89 » Sat Jan 04, 2014 10:24 am

Thank you so much!
And what about the number of periods? I noticed right now that if I set simul(periods=1500); , the model converges in just 6 iterations, while if I set simul(periods=15000);, it takes 24 iterations, but it reaches the steady states in both cases. Maybe it's a silly question, but I can't understand why...
clm89
 
Posts: 4
Joined: Sun Dec 29, 2013 2:28 pm

Re: convergence problem

Postby jpfeifer » Sat Jan 04, 2014 10:38 am

The periods statement is for how many periods you want to simulate a deterministic model. Say you have 10 variables and periods=1500. In that case, Dynare must find 10 variable values at 1500 periods=15000 values. That is done in 6 iterations. If you use 15000 periods, Dynare has to find 150000 values. That of course takes longer.
If your shocks to the system happen early on, the model with converge to steady state quickly and the last periods will all be equal to the steady state. But finding this out will take the optimizer some time. So if you know this in advance, use fewer periods.
------------
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


Return to Dynare help

Who is online

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