Index Exceed matrix dimensions


I keep getting the following error message:

??? Index exceeds matrix dimensions.

Error in ==> dsge_posterior_theoretical_covariance at 85
Covariance_matrix(linea,symmetric_matrix_index(i,j,nvar)) = tmp{1}(i,j);

Error in ==> posterior_analysis>job at 55
[nvar,vartan,NumberOfFiles] = …

Error in ==> posterior_analysis at 33
oo_ = job(type,SampleSize,arg1,arg2,arg3,options_,M_,oo_);

Error in ==> compute_moments_varendo at 41
oo_ = posterior_analysis(‘variance’,var_list_(i,:),var_list_(j,:),],options_,M_,oo_);

Error in ==> dynare_estimation_1 at 959
oo_ = compute_moments_varendo(options_,M_,oo_,var_list_);

Error in ==> dynare_estimation at 62

Error in ==> ipt2 at 182

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

I have run similar models in dynare without problems. I am wondering what may be causing this problem. I appreciate any feedback. File is attached.

ipt2.mod (3 KB)

Hi All,

I aa still stuck with this thing…Any idea? I appreciate any comment…



Hi, without your data file, it’s hard to debug the program. Please post it.

Sure, please find it attached. Thank you for looking at it.


datafile.xls (22 KB)

after inserting the parameter values at the beginning, I get another error message that your Hessian is not positive definite, which is a more standard error (usually choose different starting values or mode_compute=6). Have a look at the files.


dataipt.xls (23 KB)
ipt2.mod (3.19 KB)

Hi Johannes,

thanks for taking you time to look at my files.
What I don’t understand is that I’ve estimated the parameters in dynare using this code but then it would not perform the IRF and variance decomposition analyses (and the error message above appears). Wouldn’t be the case that if my Hessian matrix wasn’t positive definite then I wouldn’t be able even to estimate the parameters?

Thanks again,


Hi Pedro,

it is hard to judge, if you do not post everything in exactly the way it produces the error message. For example, I have to use an Excel-file, which you obviously did not. Moreover, the Excel file contains 41 observations while your initial code stated that you have 42 observations. So there may be a problem to.

Best Johannes

Hi Johannes,

sorry for this confusion. I am attaching the files again. Just run them and got the error message above, although the parameters were estimated… I think you should be able to replicate the error message now…

Thanks for looking at this,
brazilipt.xls (23 KB)
ipt2.mod (3 KB)