The code goes through well except two earnings. The printout screen looks like:
MODEL SUMMARY nothing special here
MATRIX OF COVARIANCE OF EXOGENOUS SHOCKS nothing special here
POLICY AND TRANSITION FUNCTIONS nothing special here
Warning: Matrix is close to singular or badly scaled. Results may be
inaccurate. RCOND = 1.451571e-18.
In th_autocovariances at 149
In disp_th_moments at 37
In stoch_simul at 164
In modfilename at 687
In dynare at 180
Warning: Aggregate variance and sum of variances by shocks differ by more than
0.01 %
In th_autocovariances at 198
In disp_th_moments at 37
In stoch_simul at 164
In modfilename at 687
In dynare at 180
APROXIMATED THEORETICAL MOMENTS
some "NAN"s
APPROXIMATED VARIANCE DECOMPOSITION (in percent) nothing special here
APPROXIMATED MATRIX OF CORRELATIONS nothing special here
APPROXIMATED COEFFICIENTS OF AUTOCORRELATION nothing special here
In the model, one variable follows random walk, and some variables are functions of this random walk.
I guess that APROXIMATED THEORETICAL MOMENTS have NAN because of the random walk.
I’m not sure how the first warning affects the model’s performance. Is it a red flag? Is it due to random walk variable?
As for the second warning, I find the post Ask for help urgently very useful. It says that this warning may come from the large size of my model, and it’s not avoidable. I wonder whether the random walk behavior of endogenous variable will contribute to this warning.
Yes, the unit root will cause the NaN in the theoretical moments. If your model is large, numerical problems can arise and there is not much you can do. Unless there is anything else suspicious, these warnings can be ignored.
One more question,
When I change the last line of the mod file from
stoch_simul(order=1, irf=500);
to
stoch_simul(order=2, pruning, irf=500);
The change of IRF is small.
When I change the last line of the mod file from
stoch_simul(order=1, irf=500);
to
stoch_simul(order=3, pruning, irf=500);
The change of IRF is huge:
e.g. the initial response of variable x to shock y is -10^(-5) with order =1, becomes -2*10^(-4) with order 2 and becomes -100 with order =3.
I take this as a bad sign of my model. I think this is a result of the curvature of my equations. I wonder whether in general the unit root will contribute to the large IRF size when taking the third order. Thank you very much!
The reason is that despite using pruning, your simulations seem quite explosive. Values in the order of 1E9 appear. This might be due to the unit root, where big shocks accumulate. At first order, that might not be a large issue, but at higher order it is.