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.

Re: maximum likelihood estimation

Postby Abderhman » Wed May 14, 2014 9:12 am

one of the equation I had write in the model is already loglinearized around the steady is it possible that this is the problem?
Error using dynare_solve (line 60)
An element of the Jacobian is not finite or NaN

Error in evaluate_steady_state (line 66)
[ys,check] = dynare_solve([M.fname '_static'],...

Error in dynare_estimation_init (line 496)
[oo_.steady_state, params] =
evaluate_steady_state(oo_.steady_state,M,options_,oo_,steadystate_check_flag);

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 409)
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 » Wed May 14, 2014 9:14 am

No. But before estimation, make sure your model runs with stoch_simul. In your case, see
Remark 2 (Using stoch_simul before Estimation)
and
Remark 15 (initval vs. steady_state_model vs. steadystate-file)
of
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.
------------
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 » Wed May 14, 2014 9:34 am

when I add stoch_simul before the estimation it provide me this:

Warning: Some of the parameters have no value (rhoz, rhozz, rhozl, rhozx, rhozg, rhol,
rholz, rholl, rholx, rholg, rhox, rhoxz, rhoxl, rhoxx, rhoxg, rhog, rhogz, rhogl, rhogx,
rhogg, rhop, rhopz, rhopl, rhopx, rhopg, rhopp, rhozp, rholp, rhoxp, rhogp) when using
stoch_simul. 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 stoch_simul at 27
In dynar at 406
In dynare at 174

STEADY: The Jacobian contains Inf or NaN. The problem arises from:

STEADY: Derivative of Equation 7 with respect to Variable zF (initial value of zF: 1)
STEADY: Derivative of Equation 8 with respect to Variable zF (initial value of zF: 1)
STEADY: Derivative of Equation 9 with respect to Variable zF (initial value of zF: 1)
STEADY: Derivative of Equation 10 with respect to Variable zF (initial value of zF: 1)
STEADY: Derivative of Equation 11 with respect to Variable zF (initial value of zF: 1)
STEADY: Derivative of Equation 7 with respect to Variable tlF (initial value of tlF: 1.5)
STEADY: Derivative of Equation 8 with respect to Variable tlF (initial value of tlF: 1.5)
STEADY: Derivative of Equation 9 with respect to Variable tlF (initial value of tlF: 1.5)
STEADY: Derivative of Equation 10 with respect to Variable tlF (initial value of tlF: 1.5)
STEADY: Derivative of Equation 11 with respect to Variable tlF (initial value of tlF: 1.5)
STEADY: Derivative of Equation 7 with respect to Variable txF (initial value of txF: 1)
STEADY: Derivative of Equation 8 with respect to Variable txF (initial value of txF: 1)
STEADY: Derivative of Equation 9 with respect to Variable txF (initial value of txF: 1)
STEADY: Derivative of Equation 10 with respect to Variable txF (initial value of txF: 1)
STEADY: Derivative of Equation 11 with respect to Variable txF (initial value of txF: 1)
STEADY: Derivative of Equation 7 with respect to Variable gF (initial value of gF: 0.20444)
STEADY: Derivative of Equation 8 with respect to Variable gF (initial value of gF: 0.20444)
STEADY: Derivative of Equation 9 with respect to Variable gF (initial value of gF: 0.20444)
STEADY: Derivative of Equation 10 with respect to Variable gF (initial value of gF: 0.20444)
STEADY: Derivative of Equation 11 with respect to Variable gF (initial value of gF: 0.20444)
STEADY: Derivative of Equation 7 with respect to Variable pF (initial value of pF: 1)
STEADY: Derivative of Equation 8 with respect to Variable pF (initial value of pF: 1)
STEADY: Derivative of Equation 9 with respect to Variable pF (initial value of pF: 1)
STEADY: Derivative of Equation 10 with respect to Variable pF (initial value of pF: 1)
STEADY: Derivative of Equation 11 with respect to Variable pF (initial value of pF: 1)

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)
An element of the Jacobian is not finite or NaN

Error in evaluate_steady_state (line 66)
[ys,check] = dynare_solve([M.fname '_static'],...

Error in resol (line 104)
[dr.ys,M.params,info] = evaluate_steady_state(oo.steady_state,M,options,oo,0);

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

Error in dynar (line 406)
info = stoch_simul(var_list_);

Error in dynare (line 174)
evalin('base',fname) ;
Attachments
dynar.mod
(2.47 KiB) Downloaded 47 times
Abderhman
 
Posts: 18
Joined: Sat May 10, 2014 12:19 am

Re: maximum likelihood estimation

Postby Abderhman » Wed May 14, 2014 10:05 am

should I calibrate the parameters that I want to estimate first, use stoch_simul and then estimate them?
Abderhman
 
Posts: 18
Joined: Sat May 10, 2014 12:19 am

Re: maximum likelihood estimation

Postby Abderhman » Wed May 14, 2014 10:07 am

For the Remark 15 this mean that my initial values are far from the steady state?
I'm very sorry
Abderhman
 
Posts: 18
Joined: Sat May 10, 2014 12:19 am

Re: maximum likelihood estimation

Postby Abderhman » Wed May 14, 2014 10:29 am

once I provide values for parameters to estimate (which I set to 1 because I have absolutely no idea about their possible value) I have the following message:
Error using print_info (line 74)
Impossible to find the steady state. Either the model doesn't have a steady state, there
are an infinity of steady states, or the guess values are too far from the solution

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

Error in dynar (line 466)
info = stoch_simul(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 » Wed May 14, 2014 11:41 am

You should have an idea what a sensible parameterization might look like. Note that for autoregressive parameters 1 makes no sense (unit root). Start with 0 for them.
Regarding the steady state: finding it is hard. Try providing better starting values or, even better, analytically computing it given the parameters. The latter will facilitate 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: maximum likelihood estimation

Postby Abderhman » Wed May 14, 2014 1:11 pm

I solved analitically the steady state (value are very very low I dont understand why, I found the calibration parameters on the literature) with the new values, here is the problem.

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

Loading 203 observations from data3.xlsx


An infinite element was encountered when trying to solve equation(s) 11
with respect to the variable(s): gF.
The values of the endogenous variables when the problem was encountered were:
yF 0.05
cF 0.01
xF 0.01
kF 0.08
lF 0.07
zF 1
tlF 1.5
txF 1
gF 0.2044
pF 1
O 0.001

Error using lnsrch1 (line 71)
Some element of Newton direction isn't finite. Jacobian maybe singular or there is a
problem with initial values

Error in solve1 (line 107)
[x,f,fvec,check]=lnsrch1(xold,fold,g,p,stpmax,func,j1,j2,varargin{:});

Error in dynare_solve (line 150)
[x,info]=solve1(func,x,j1(r(i):r(i+1)-1),j2(r(i):r(i+1)-1),jacobian_flag, ...

Error in evaluate_steady_state (line 66)
[ys,check] = dynare_solve([M.fname '_static'],...

Error in dynare_estimation_init (line 496)
[oo_.steady_state, params] =
evaluate_steady_state(oo_.steady_state,M,options_,oo_,steadystate_check_flag);

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 470)
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 » Wed May 14, 2014 1:23 pm

Please post the updated mod-file
------------
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 » Wed May 14, 2014 1:34 pm

Please find attached the mod file
Attachments
dynar.mod
(2.76 KiB) Downloaded 60 times
Abderhman
 
Posts: 18
Joined: Sat May 10, 2014 12:19 am

Re: maximum likelihood estimation

Postby jpfeifer » Wed May 14, 2014 1:53 pm

That is an old version with the autoregressive parameters being 1 and not 0, no
Code: Select all
steady;
check;

and not attempt to provide an analytical steady state.
------------
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 » Wed May 14, 2014 3:23 pm

sorry here is the file
Attachments
dynar.mod
(2.77 KiB) Downloaded 66 times
Abderhman
 
Posts: 18
Joined: Sat May 10, 2014 12:19 am

Re: maximum likelihood estimation

Postby jpfeifer » Wed May 14, 2014 4:45 pm

It works with the most recent unstable version and
[url]steady(solve_algo=4,maxit=10000);[/url]
------------
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 » Wed May 14, 2014 6:02 pm

thanks again for your patience, it does not work for me, now I see:
SOLVE: Iteration 18
Spurious convergence.
1.9556
1.4376
0.5012
16.2021
0.6062
0
0
0
0
0
0.0010





Residuals of the static equations:

Equation number 1 : 0.67993
Equation number 2 : -0.62894
Equation number 3 : 0.10311
Equation number 4 : -0.0042346
Equation number 5 : 0.016835
Equation number 6 : -1.6854
Equation number 7 : 0
Equation number 8 : 0
Equation number 9 : 0
Equation number 10 : 0
Equation number 11 : 0


Error using print_info (line 74)
Impossible to find the steady state. Either the model doesn't have a
steady state, there are an infinity of steady states, or the guess
values are too far from the solution

Error in steady (line 92)
print_info(info,options_.noprint, options_);

Error in dynar (line 468)
steady;

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 » Wed May 14, 2014 7:20 pm

Try the initial values:
STEADY-STATE RESULTS:

yF 3.31917
cF 2.35755
xF 1.06974
kF 36.6212
lF 0.72565
zF 0.170712
tlF 0.00580193
txF -0.00172746
gF -0.0541062
pF 0.000448175
O 3.78655
------------
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

PreviousNext

Return to Dynare help

Who is online

Users browsing this forum: No registered users and 6 guests