Index exceeds matrix dimensions?

Dear all, the errors of my program are as follow:
Error in dsge_likelihood (line 301)
constant = SteadyState(BayesInfo.mfys);

Error in initial_estimation_checks (line 47)
[fval,junk1,junk2,a,b,c,d] =
feval(objective_function,xparam1,DynareDataset,DynareOptions,Model,EstimatedParameters,BayesInfo,DynareResults);

Error in dynare_estimation_1 (line 179)
oo_ =
initial_estimation_checks(objective_function,xparam1,dataset_,M_,estim_params_,options_,bayestopt_,oo_);

Error in dynare_estimation (line 89)
dynare_estimation_1(var_list,dname);

Error in v0903 (line 392)
dynare_estimation(var_list_);

Error in dynare (line 180)
evalin(‘base’,fname) ;

I see similar topic in the forum and try to modify my intial value or mode_compute=6 but it still fails.
Does anyone has any idea about it ?
Thanks!!
v0903.mod (3.39 KB)
newone2.xls (26.5 KB)

Your model is wrong. It is not linear. See Remark 2 (Using stoch_simul before Estimation) in Pfeifer(2013): “A Guide to Specifying Observation Equations for the Estimation of DSGE Models” sites.google.com/site/pfeiferecon/Pfeifer_2013_Observation_Equations.pdf.

Thank you for your advice. I try to incorporate the command in remark 2 into my model. Then, when I run the progarm, it says:

Undefined function or variable ‘M_’.

Error in v0903 (line 372)
oo_.dr.eigval = check(M_,options_,oo_);

Error in dynare (line 180)
evalin(‘base’,fname) ;

By the way, could you please tell me why the model is not linear. I think I have finished the first order linearization.
Thanks!!

Always post the update files to replicate the problem. Your model is not linear, because when you put

your equations have non-zero residuals although all variables are initialized at 0. Thus, your linearization must be wrong. My guess is that you made an error in the definition of the exogenous processes that are now mean 1 or something like that instead of mean 0.

1 Like

[quote=“jpfeifer”]Always post the update files to replicate the problem. Your model is not linear, because when you put

resid(1);

your equations have non-zero residuals although all variables are initialized at 0. Thus, your linearization must be wrong. My guess is that you made an error in the definition of the exogenous processes that are now mean 1 or something like that instead of mean 0.[/quote]

Dear Pfeifer,
I use the resid(1) command and correct the non-zero mistake. But other problems sitll exist. When I run the program, it says
Undefined function or variable ‘M_’.

Error in v0903 (line 347)
oo_.dr.eigval = check(M_,options_,oo_);

Error in dynare (line 180)
evalin(‘base’,fname) ;
newone2.xls (26.5 KB)
v0903.mod (3.38 KB)

Please use the most recent Dynare version. There I get a different error. The problem still is that

//%15rr=rhopai*pai+rhoy*y+eps_r; exp(rr)=exp(pai^rhopai)*exp(y^rhoy)*exp(eps_r);
is clearly not linear.

[quote=“jpfeifer”]Please use the most recent Dynare version. There I get a different error. The problem still is that

//%15rr=rhopai*pai+rhoy*y+eps_r; exp(rr)=exp(pai^rhopai)*exp(y^rhoy)*exp(eps_r);
is clearly not linear.[/quote]

Hi. I have correct the mistake you mention and I use dynare 4.4.3.
After running the program, the problem is still:
Undefined function or variable ‘M_’.

Error in v0905 (line 342)
oo_.dr.eigval = check(M_,options_,oo_);

Error in dynare (line 180)
evalin(‘base’,fname) ;
newone2.xls (26.5 KB)
v0905.mod (2.9 KB)

There must be a problem with your installation of Dynare. I get

[quote]EIGENVALUES:
Modulus Real Imaginary

   1.826e-17       -1.826e-17                0
   1.996e-17        1.996e-17                0
        0.75             0.75                0
        0.75             0.75                0
        0.75             0.75                0
      0.9917           0.9916          0.01513
      0.9917           0.9916         -0.01513
       1.232            1.232                0
         Inf              Inf                0
         Inf              Inf                0

There are 3 eigenvalue(s) larger than 1 in modulus
for 2 forward-looking variable(s)

The rank condition ISN’T verified!

Error using print_info (line 42)
Blanchard Kahn conditions are not satisfied: no stable equilibrium

Error in stoch_simul (line 98)
print_info(info, options_.noprint, options_);

Error in v0905 (line 344)
info = stoch_simul(var_list_);

Error in dynare (line 180)
evalin(‘base’,fname) ;[/quote]

[quote=“jpfeifer”]There must be a problem with your installation of Dynare. I get

[quote]EIGENVALUES:
Modulus Real Imaginary

   1.826e-17       -1.826e-17                0
   1.996e-17        1.996e-17                0
        0.75             0.75                0
        0.75             0.75                0
        0.75             0.75                0
      0.9917           0.9916          0.01513
      0.9917           0.9916         -0.01513
       1.232            1.232                0
         Inf              Inf                0
         Inf              Inf                0

There are 3 eigenvalue(s) larger than 1 in modulus
for 2 forward-looking variable(s)

The rank condition ISN’T verified!

Error using print_info (line 42)
Blanchard Kahn conditions are not satisfied: no stable equilibrium

Error in stoch_simul (line 98)
print_info(info, options_.noprint, options_);

Error in v0905 (line 344)
info = stoch_simul(var_list_);

Error in dynare (line 180)
evalin(‘base’,fname) ;[/quote]

[/quote]

Oh, thank you so much.
How should I deal with this problem. Is the only thing I can do is to change the initial value?
Does it work if I change the way that compute the steady state?

Search the forum on this. Typically, the timing of the variables in incorrect. See e.g. [Help ! Blanchard Kahn conditions are not satisfied: no stabl)

Thank you very much. I will try.
By the way, do you know how to use the command model_info? The reference says that "this command can only be used in conjunction with the block option of the model block"
But when I try this, it fails.
model(linear);
model_info(‘EVALUATE FORWARD’);

Sorry to bother you. I have come to realize how to use this command. Thx.

Dear Pfeifer,
Sorry to disturb you again. Despite of some modification, problems still exist in my mod file. Does it mean that the qz decomposition condition is not satisfied?
ans =

 1     2     3

??? Index exceeds matrix dimensions.

Error in ==> dr_block at 277
temp = sorted_roots(nd-nba+1:nd-nyf)-1-options_.qz_criterium;

Error in ==> resol at 143
[dr,info,M_,options_,oo_] = dr_block(dr,check_flag,M_,options_,oo_);

Error in ==> stoch_simul at 66
[oo_.dr, info] = resol(oo_.steady_state,0);

Error in ==> v0906 at 507
info = stoch_simul(var_list_);

Error in ==> dynare at 132
evalin(‘base’,fname) ;
v0906.mod (3.14 KB)
newone2.xls (26.5 KB)

The Blanchard-Kahn conditions are not satisfied. The crash is due to a bug. For generating the correct error message, replace the original Dynare 4.4.3 file with the attached one.
dr_block.m (30.5 KB)

Thank you. But even if I replace the old file with the new one, I still cannot get the error message.

Reference to non-existent field ‘verbose’.

Error in dr_block (line 54)
verbose = options_.verbose;

Error in resol (line 135)
[dr,info,M,options,oo] = dr_block(dr,check_flag,M,options,oo);

Error in stoch_simul (line 88)
[oo_.dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_);

Error in v0906 (line 677)
info = stoch_simul(var_list_);

Error in dynare (line 180)
evalin(‘base’,fname) ;

Sorry, my mistake. I initially uploaded the wrong file. The new one is correct and should work.

It is fine. By the way, is it possible to solve the forward-looking varibale problem by changing the parameter.
I silightly change the parameter but it still does not work.
newone2.xls (26.5 KB)
v0906.mod (3.12 KB)

With the BK conditions it can be a problem of parameter values, but more often it is a fundamental issue of wrong variable timing.

I got the same error message.