??? Error using ==> mtimes

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

??? Error using ==> mtimes

Postby iloveshjtl » Thu Mar 24, 2011 3:46 am

Hallo,

I have a model which can be solved using the stoch_simul command.
But when I try to estimate it there seem to be problems related to matrix dimension and I get the following error message.

??? Error using ==> mtimes
Inner matrix dimensions must agree.

Error in ==> metropolis_hastings_initialization at 94
candidate = rand_multivariate_normal( transpose(xparam1), d * options_.mh_init_scale, npar);

Error in ==> random_walk_metropolis_hastings at 58
[ ix2, ilogpo2, ModelName, MhDirectoryName, fblck, fline, npar, nblck, nruns, NewFile, MAX_nruns, d ] = ...

Error in ==> dynare_estimation_1 at 1106
feval(options_.posterior_sampling_method,'DsgeLikelihood',options_.proposal_distribution,xparam1,invhess,bounds,gend,data,...

Error in ==> dynare_estimation at 62
dynare_estimation_1(var_list,varargin{:});

Error in ==> korea at 273
dynare_estimation(var_list_);


And before this, I received such message

MH: Multiple chains mode.
MH: Searching for initial values...
MH: I couldn't get a valid initial value in 100 trials.
MH: You should Reduce mh_init_scale...
MH: Parameter mh_init_scale is equal to 0.400000.
MH: Enter a new value...

What's the problem?
I attached the mod file and data.
Attachments
korea.mod
(2.68 KiB) Downloaded 166 times
data_kr.xls
(19.5 KiB) Downloaded 171 times
iloveshjtl
 
Posts: 10
Joined: Tue Mar 15, 2011 6:34 am

Re: ??? Error using ==> mtimes

Postby jpfeifer » Fri Mar 25, 2011 7:38 am

Hi, I would say there are several problems. First, you should use the calibrated parameters as starting values for the estimation. This should look like:
Code: Select all
estimated_params;
h, 0.92, , ,beta_pdf, 0.7, 0.2;
sigma, 0.39, , ,normal_pdf, 1.0, 0.25; 
phi,1.82, , ,gamma_pdf, 1.0, 0.3;   
eta,0.85, , ,gamma_pdf, 1.0, 0.3; 

The first number is the starting value, the two empty fields denote the lower and upper bounds of the prior, which are automatically set by Dynare to fit the prior mean and variance.

Second, I am not sure your data fits your model. The data y seems to have a clear trend in the xls-file, while it has to be stationary for the model. Look into the numerous posts on how to specify the observation equations.

Lastly, estimating 20 parameters on 16 data points seems a bit optimistic.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: ??? Error using ==> mtimes

Postby iloveshjtl » Mon Mar 28, 2011 6:34 am

Thank you for your reply.
I revised the problem about parameter's estimated value.

But, I still have a question about that.
Among parameters, I want to fix the values of alph and beta at 0.4 and 0.99 respectively.
In this case, how I write the .mod file?

When I tried as attached file, the warning is approached as below.

Warning: Some of the parameters have no value (beta, alpha, h, sigma, phi, eta, thetah, thetaf, rhoa, phi1, phi2, rhor, lam1, rhorstar, lambdah, lambdaf) when using steady. If these parameters are not initialized in a steadystate file, Dynare may not be able to solve the model...
> In test_for_deep_parameters_calibration at 46
In steady at 33
In kr at 163
In dynare at 132
STEADY: numerical initial values incompatible with the following equations
1 2 3 5 6 8 9 10 11 12 13

??? Error using ==> dynare_solve
exiting ...

Error in ==> steady_ at 120
[oo_.steady_state,check] = dynare_solve([M_.fname '_static'],...

Error in ==> steady at 54
steady_;

Error in ==> kr at 163
steady;

Error in ==> dynare at 132
evalin('base',fname) ;


Are they given at 'estimated_params' space or beneath a name of 'parameters'?


What can I do to solve these problems?
Please help me!!
Attachments
kr.mod
(2.39 KiB) Downloaded 153 times
Last edited by iloveshjtl on Mon Mar 28, 2011 7:04 am, edited 1 time in total.
iloveshjtl
 
Posts: 10
Joined: Tue Mar 15, 2011 6:34 am

Re: ??? Error using ==> mtimes

Postby jpfeifer » Mon Mar 28, 2011 6:59 am

The parameters you do not want to estimate are set in the parameters-block before the model-block. By omitting them from the estimated_params-block they are kept fixed at this inital value during estimation.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: ??? Error using ==> mtimes

Postby iloveshjtl » Mon Mar 28, 2011 7:14 am

When I revised above reply, you posted the new reply.
Please review my question and mod file.

When I omitted parameters which don't want to estimate, the same warning is appeared as above.
I don't know how I fix the mod file. :cry:
iloveshjtl
 
Posts: 10
Joined: Tue Mar 15, 2011 6:34 am

Re: ??? Error using ==> mtimes

Postby jpfeifer » Mon Mar 28, 2011 9:00 am

Even when estimating some parameters later, all parameters always have to be initiated in the parameters-block.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: ??? Error using ==> mtimes

Postby Oriana » Mon Feb 09, 2015 10:52 pm

Hi,

I am trying to estimate the model coded in the nonlinearomega.mod file ( please, see the attachments below ).
Nevertheless, I got the following errors :

Warning: Range cannot be used in 'basic' mode. The entire sheet will be loaded.
> In xlsread at 199
In load_xls_file_data at 67
In read_variables at 92
In initialize_dataset at 32
In dynare_estimation_init at 479
In dynare_estimation_1 at 81
In dynare_estimation at 89
In nonlinearomega at 2107
In dynare at 180
Loading 160 observations from data.xls


ESTIMATION_CHECKS: There was an error in computing the likelihood for initial parameter values.
ESTIMATION_CHECKS: You should try using the calibrated version of the model as starting values. To do
ESTIMATION_CHECKS: this, add an empty estimated_params_init-block with use_calibration option immediately before the estimation
ESTIMATION_CHECKS: command (and after the estimated_params-block so that it does not get overwritten):


Error using *
Inner matrix dimensions must agree.

Error in dsge_likelihood (line 374)
Pstar =
lyapunov_symm(T,R*Q*R',DynareOptions.qz_criterium,DynareOptions.lyapunov_complex_threshold);

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 nonlinearomega (line 2107)
dynare_estimation(var_list_);

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

After some modifications on my previous version I have no idea what I can do more to fix the problem.
I shall be deeply grateful if someone can give me some feedback on this matter.
Attachments
nonlinearomega.zip
(478.59 KiB) Downloaded 36 times
Oriana
 
Posts: 67
Joined: Fri Jul 18, 2014 2:49 pm

Re: ??? Error using ==> mtimes

Postby jpfeifer » Tue Feb 10, 2015 11:53 am

Before starting estimation, make sure your model runs with stoch_simul. There are still mistakes in your model.
You have the equation
Code: Select all
         log(log_oil_price) - log(log_oil_price(-1)) = log( c1rpopd / c1rpopd(-1) * ( 1 - ( c1rpopd(-1) * c1oy(-1) / c1y(-1)) + ( c1rpopd(-1) * c1yo(-1) / c1y(-1)) ) / (1 - ( c1rpopd * c1oy / c1y) + ( c1rpopd * c1yo / c1y)) *

but log_oil_price is 0 so you are taking the log of 0.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: ??? Error using ==> mtimes

Postby Oriana » Wed Feb 11, 2015 6:22 pm

Thank you for your precious help!

After some modifications to the previous version I got the following diagnostic

model_diagnostics(M_,options_,oo_)
model_diagnostic: the Jacobian of the static model is singular
there is 2 colinear relationships between the variables and the equations
Relation 1
Colinear variables:
c1gdp
log_oil_price
Relation 2
Colinear variables:
c1gdp
log_oil_price
Relation 1
Colinear equations
224 227

Relation 2
Colinear equations
225

The presence of a singularity problem typically indicates that there is one
redundant equation entered in the model block, while another non-redundant equation
is missing. The problem often derives from Walras Law.

Singularity is possibly due an intended unit root on the equation 227

c1gdp = c1gdp(-1) * (c1y - c1rpopd(-1) * c1oy + c1rpopd(-1) * c1yo) / (c1y(-1) - c1rpopd(-1) * c1oy(-1) + c1rpopd(-1) * c1yo(-1));

Am I right ?
If so, please, what is supposed to do next?
Attachments
nonlinearomega.zip
(492.2 KiB) Downloaded 29 times
Oriana
 
Posts: 67
Joined: Fri Jul 18, 2014 2:49 pm

Re: ??? Error using ==> mtimes

Postby Oriana » Fri Feb 13, 2015 11:11 am

Please, I would really appreciate some help on this matter!!
Oriana
 
Posts: 67
Joined: Fri Jul 18, 2014 2:49 pm

Re: ??? Error using ==> mtimes

Postby jpfeifer » Sat Feb 14, 2015 12:06 pm

Your model is big and complex, so I won't be of much help. A unit root will give rise to collinearity. If the unit root is intended, you can ignore the message. If it is not intended, you need to find the mistake that gives rise to it.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany


Return to Dynare help

Who is online

Users browsing this forum: Google [Bot] and 7 guests