Page 1 of 2

Index exceeds matrix dimensions??

PostPosted: Thu Sep 04, 2014 3:20 pm
by adi199283
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!!

Re: Index exceeds matrix dimensions??

PostPosted: Thu Sep 04, 2014 3:42 pm
by jpfeifer
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" https://sites.google.com/site/pfeiferecon/Pfeifer_2013_Observation_Equations.pdf.

Re: Index exceeds matrix dimensions??

PostPosted: Thu Sep 04, 2014 4:11 pm
by adi199283
jpfeifer wrote: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" https://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) ;

Re: Index exceeds matrix dimensions??

PostPosted: Thu Sep 04, 2014 4:25 pm
by adi199283
jpfeifer wrote: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" https://sites.google.com/site/pfeiferecon/Pfeifer_2013_Observation_Equations.pdf.

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

Re: Index exceeds matrix dimensions??

PostPosted: Thu Sep 04, 2014 7:39 pm
by jpfeifer
Always post the update files to replicate the problem. Your model is not linear, because when you put
Code: Select all
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.

Re: Index exceeds matrix dimensions??

PostPosted: Fri Sep 05, 2014 12:33 am
by adi199283
jpfeifer wrote:Always post the update files to replicate the problem. Your model is not linear, because when you put
Code: Select all
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.



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) ;

Re: Index exceeds matrix dimensions??

PostPosted: Fri Sep 05, 2014 6:55 am
by jpfeifer
Please use the most recent Dynare version. There I get a different error. The problem still is that
Code: Select all
//%15rr=rhopai*pai+rhoy*y+eps_r;
exp(rr)=exp(pai^rhopai)*exp(y^rhoy)*exp(eps_r);

is clearly not linear.

Re: Index exceeds matrix dimensions??

PostPosted: Fri Sep 05, 2014 12:21 pm
by adi199283
jpfeifer wrote:Please use the most recent Dynare version. There I get a different error. The problem still is that
Code: Select all
//%15rr=rhopai*pai+rhoy*y+eps_r;
exp(rr)=exp(pai^rhopai)*exp(y^rhoy)*exp(eps_r);

is clearly not linear.


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) ;

Re: Index exceeds matrix dimensions??

PostPosted: Fri Sep 05, 2014 12:26 pm
by jpfeifer
There must be a problem with your installation of Dynare. I get
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) ;

Re: Index exceeds matrix dimensions??

PostPosted: Fri Sep 05, 2014 12:55 pm
by adi199283
jpfeifer wrote:There must be a problem with your installation of Dynare. I get
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) ;


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?

Re: Index exceeds matrix dimensions??

PostPosted: Fri Sep 05, 2014 1:12 pm
by jpfeifer
Search the forum on this. Typically, the timing of the variables in incorrect. See e.g. http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=5797

Re: Index exceeds matrix dimensions??

PostPosted: Fri Sep 05, 2014 2:10 pm
by adi199283
jpfeifer wrote:Search the forum on this. Typically, the timing of the variables in incorrect. See e.g. http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=5797

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');

Re: Index exceeds matrix dimensions??

PostPosted: Fri Sep 05, 2014 2:28 pm
by adi199283
jpfeifer wrote:Search the forum on this. Typically, the timing of the variables in incorrect. See e.g. http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=5797

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

Re: Index exceeds matrix dimensions??

PostPosted: Wed Sep 10, 2014 6:41 am
by adi199283
jpfeifer wrote:Search the forum on this. Typically, the timing of the variables in incorrect. See e.g. http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=5797

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) ;

Re: Index exceeds matrix dimensions??

PostPosted: Wed Sep 10, 2014 7:22 am
by jpfeifer
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.