Page 1 of 3

maximum likelihood estimation

PostPosted: Tue May 13, 2014 10:34 am
by Abderhman
Hello I'm trying to use dynare to estimate a stochastic process in order to apply the Business cycle accounting procedure à la Chaari et al (2007). The problem is that matlab return me the following
Undefined variable "estim_params_" or class "estim_params_.param_vals".
Error in dynar (line 280)
tmp1 = find(estim_params_.param_vals(:,1)==10);

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

I dont have any idea about the problem, thank you very much for your helo

Re: maximum likelihood estimation

PostPosted: Tue May 13, 2014 10:48 am
by jpfeifer
You cannot use estimated_param_bounds when you did not specify estimated_params.

Re: maximum likelihood estimation

PostPosted: Tue May 13, 2014 12:37 pm
by Abderhman
Thank you very much for the answer, so what I have to add in my script to specify estimated_params?

Re: maximum likelihood estimation

PostPosted: Tue May 13, 2014 12:49 pm
by jpfeifer
An estimated_params-block. See e.g. the fs2000.mod in the Dynare example folder.

Re: maximum likelihood estimation

PostPosted: Tue May 13, 2014 1:04 pm
by Abderhman
In this file they specify a prior shape prior mean and standard error so it's for bayesian estimation, how can I tell to Dynare that I want to estimate using maximum likelihood ?

Re: maximum likelihood estimation

PostPosted: Tue May 13, 2014 1:27 pm
by jpfeifer
As described in the manual, you only provide the parameter name and the starting value for ML estimation. E.g.
Code: Select all
estimated_params;
alp, 0.356;
gam,  0.0085;
mst, 1.0002;
rho, 0.129;
psi, 0.65;
del,  0.02;
stderr e_a, 0.035449;
stderr e_m, 0.008862;
corr e_m, e_a, 0;
stderr gp_obs, 0.01;
end;

Re: maximum likelihood estimation

PostPosted: Tue May 13, 2014 1:38 pm
by Abderhman
Ok thanks now the following message appears:

You did not declare endogenous variables after the estimation/calib_smoother command.

Error: File: data2.m Line: 1 Column: 3
The input character is not valid in MATLAB statements or expressions.

Error in read_variables (line 72)
eval(basename);

Error in initialize_dataset (line 32)
rawdata = read_variables(datafile,varobs,[],xls.sheet,xls.range);

Error in dynare_estimation_init (line 477)
dataset_ =
initialize_dataset(options_.datafile,options_.varobs,options_.first_obs,options_.nobs,transformation,options_.prefilter,xls);

Error in dynare_estimation_1 (line 81)
[dataset_,xparam1, hh, M_, options_, oo_, estim_params_,bayestopt_] =
dynare_estimation_init(var_list_, dname, [], M_, options_, oo_, estim_params_,
bayestopt_);

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

Error in dynar (line 408)
dynare_estimation(var_list_);

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

Re: maximum likelihood estimation

PostPosted: Tue May 13, 2014 1:45 pm
by jpfeifer
There is a problem with your data-file. Please post it.

Re: maximum likelihood estimation

PostPosted: Tue May 13, 2014 2:12 pm
by Abderhman
Here is the data file, thank you very much for your disponibility

Re: maximum likelihood estimation

PostPosted: Tue May 13, 2014 2:27 pm
by jpfeifer
The file is not a valid matlab file. It seems to have the wrong ending.

Re: maximum likelihood estimation

PostPosted: Tue May 13, 2014 2:42 pm
by Abderhman
ok originally I have it in excel files. Here is my data. What I have done is change extension from xls to .m what can I do to make it readable by Matlab? (Sorry I discovered Dynare three day's ago I'm a very beginner)

Re: maximum likelihood estimation

PostPosted: Tue May 13, 2014 2:49 pm
by jpfeifer
Then you should use the excel file in Dynare. Do not rename it. See the manual on specifying e.g. xls_range.

Re: maximum likelihood estimation

PostPosted: Tue May 13, 2014 3:20 pm
by Abderhman
I look at the reference manual and try the following different syntax (my xls doc is called data3):
estimation(xls_range = data3) estimation (datafile = data3); estimation(xls_sheet = data3) he always return an error either unexpecting equal either I have to provide a datafile or the same error as before with the m file

Re: maximum likelihood estimation

PostPosted: Tue May 13, 2014 4:42 pm
by jpfeifer
That's not what the manual says. It should be something like:
Code: Select all
estimation(xls_range=A2:C5,datafile = data3,xls_sheet = Sheet1)

Re: maximum likelihood estimation

PostPosted: Tue May 13, 2014 8:20 pm
by Abderhman
Thanks professor, you helped me a lot. I still have a problem:
STEADY: The Jacobian contains Inf or NaN. The problem arises from:

STEADY: Derivative of Equation 8 with respect to Variable tlF (initial value of tlF: 1.5)

STEADY: The problem most often occurs, because a variable with
STEADY: exponent smaller than 1 has been initialized to 0. Taking the derivative
STEADY: and evaluating it at the steady state then results in a division by 0.
Error using dynare_solve (line 60)

I change initial values for tlF but I still have the problem, what else can I do?