Convergence problem

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
STEADYBtesi.m (848 Bytes)

A good place to start looking is why your presumably mean zero exogenous process g is initialized to g=gss;
where gss=0.153

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

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

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.

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…

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.