maximum likelihood estimation

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.

maximum likelihood estimation

Postby Abderhman » Tue May 13, 2014 10:34 am

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
Attachments
dynar.mod
(2.11 KiB) Downloaded 95 times
Abderhman
 
Posts: 18
Joined: Sat May 10, 2014 12:19 am

Re: maximum likelihood estimation

Postby jpfeifer » Tue May 13, 2014 10:48 am

You cannot use estimated_param_bounds when you did not specify estimated_params.
------------
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: maximum likelihood estimation

Postby Abderhman » Tue May 13, 2014 12:37 pm

Thank you very much for the answer, so what I have to add in my script to specify estimated_params?
Abderhman
 
Posts: 18
Joined: Sat May 10, 2014 12:19 am

Re: maximum likelihood estimation

Postby jpfeifer » Tue May 13, 2014 12:49 pm

An estimated_params-block. See e.g. the fs2000.mod in the Dynare example folder.
------------
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: maximum likelihood estimation

Postby Abderhman » Tue May 13, 2014 1:04 pm

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 ?
Abderhman
 
Posts: 18
Joined: Sat May 10, 2014 12:19 am

Re: maximum likelihood estimation

Postby jpfeifer » Tue May 13, 2014 1:27 pm

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;
------------
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: maximum likelihood estimation

Postby Abderhman » Tue May 13, 2014 1:38 pm

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) ;
Abderhman
 
Posts: 18
Joined: Sat May 10, 2014 12:19 am

Re: maximum likelihood estimation

Postby jpfeifer » Tue May 13, 2014 1:45 pm

There is a problem with your data-file. Please post 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

Re: maximum likelihood estimation

Postby Abderhman » Tue May 13, 2014 2:12 pm

Here is the data file, thank you very much for your disponibility
Attachments
data2.m
(28.06 KiB) Downloaded 75 times
Abderhman
 
Posts: 18
Joined: Sat May 10, 2014 12:19 am

Re: maximum likelihood estimation

Postby jpfeifer » Tue May 13, 2014 2:27 pm

The file is not a valid matlab file. It seems to have the wrong ending.
------------
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: maximum likelihood estimation

Postby Abderhman » Tue May 13, 2014 2:42 pm

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)
Abderhman
 
Posts: 18
Joined: Sat May 10, 2014 12:19 am

Re: maximum likelihood estimation

Postby jpfeifer » Tue May 13, 2014 2:49 pm

Then you should use the excel file in Dynare. Do not rename it. See the manual on specifying e.g. xls_range.
------------
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: maximum likelihood estimation

Postby Abderhman » Tue May 13, 2014 3:20 pm

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
Abderhman
 
Posts: 18
Joined: Sat May 10, 2014 12:19 am

Re: maximum likelihood estimation

Postby jpfeifer » Tue May 13, 2014 4:42 pm

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)
------------
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: maximum likelihood estimation

Postby Abderhman » Tue May 13, 2014 8:20 pm

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?
Attachments
dynar.mod
(2.48 KiB) Downloaded 83 times
Abderhman
 
Posts: 18
Joined: Sat May 10, 2014 12:19 am

Next

Return to Dynare help

Who is online

Users browsing this forum: No registered users and 6 guests