Error Message when computing moments of endogenous variables

When I simulate a model with stoch_simul, an error message pops out:
??? Subscripted assignment dimension mismatch.

Error in ==> th_autocovariances at 131
Gamma_y{nar+2}(:,i) = abs(diag(aavx1aa’+b2(:,i)*b2(:,i)’))./vv;

Error in ==> disp_th_moments at 38
[oo_.gamma_y,ivar] = th_autocovariances(dr,ivar,M_,options_);

Error in ==> stoch_simul at 69
disp_th_moments(oo_.dr,var_list);

Error in ==> rbc_invadj at 222
info = stoch_simul(var_list_);

Error in ==> dynare at 102
evalin(‘base’,fname) ;

It seems that the matrix on the right hand side is empty. If I set options_.nomoments=1, then everything is fine. I am curious about why dynare can compute the IRFs but not the moments. What do I miss? My code is attached.
rbc_invadj.mod (3.9 KB)

Hi,

The problem is that your model has two unit roots. This is not a problem for the IRFs, but the second order moments of endogenous variables with stochastic trends are infinite. Dynare does not report the moments of non stationnary variables. In your case, all the endogenous variables listed after the stoch_simul command are non stationary. In this case Dynare crashes because he has nothing to report… We have to fix this. If you add a stationary variable in the list, Dynare will compute the moments of this variable.

Best,
Stéphane.