Likelihood only!

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: Likelihood only!

Postby Glm » Fri May 23, 2014 11:55 am

I use this method for Smets and Wouters (2007) model and then I grid the parameters one at the time between wide intervals. The parameter value is on the x-axis and the likelihood is on the y-axis.

The interval for the shock parameters are 0.01-5. The strange thing however is that many of the shocks, technology for instance, is just a horisontal line as if it doesn't affect the likelihood at all. Does this make sense? What could this mean?
Glm
 
Posts: 47
Joined: Tue Jan 17, 2012 12:54 pm

Re: Likelihood only!

Postby jpfeifer » Fri May 23, 2014 2:19 pm

Please post or send the whole code. It might have to do with the covariance matrix not correctly updating.
------------
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: Likelihood only!

Postby Glm » Mon May 26, 2014 10:50 am

The files are about 10 mb because of all the big arrays that I saved from Dynare. Therefore I sent the files here instead
http://sprend.com/download.htm?C=beff9a ... 09348fd8e1
under the name 'all_code.zip'

You open the m-file 'submit_code.m' and click run, then Matlab loads the matrices you need from the mat-file 'a_sw.mat'. Next, Matlab, grids all of the parameters one at the time around the parameter vector 'param_vec_fcon'. When this is done the function 'subplot_funktion' is used to plot all of the parameters with the likelihood on the y-axis, where the black vertikal line is the paramater value from the initial parameter vector 'param_vec_fcon'.

All the shocks are named sigma_x. So for instance the technology shock is called "sigma_a", these symbols you'll see in the subplots.

Let me know if you are missing any files :)
Glm
 
Posts: 47
Joined: Tue Jan 17, 2012 12:54 pm

Re: Likelihood only!

Postby jpfeifer » Mon May 26, 2014 11:33 am

numSubplots.m is missing.
------------
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: Likelihood only!

Postby Glm » Mon May 26, 2014 12:08 pm

Sorry about that. Here it is

\\\Glenn
Attachments
numSubplots.m
(1.08 KiB) Downloaded 265 times
Glm
 
Posts: 47
Joined: Tue Jan 17, 2012 12:54 pm

Re: Likelihood only!

Postby jpfeifer » Mon May 26, 2014 12:53 pm

I may be missing something, but you are seem to be confusing the ordering in M_.params with the one used in estimation. E.g. you take parameter 20 in xparam1 to be the s_tech, but the actual ordering is in bayestopt_.name. There you can see that the first entry is the standard error of ea (which is s_tech). The parameters with the flat likelihood are actually the constants of the observation equation.
------------
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: Likelihood only!

Postby Glm » Wed May 28, 2014 2:28 pm

Yes you're right. I didn't realize that the parameter order was different when estimating. Thank you very much!!
Glm
 
Posts: 47
Joined: Tue Jan 17, 2012 12:54 pm

Re: Likelihood only!

Postby Glm » Thu Jul 03, 2014 8:16 am

Let's say that I use this method and end up with some estimates of my parameters. Is there then some way to relatively easy make inference of these parameters in Dynare?
Glm
 
Posts: 47
Joined: Tue Jan 17, 2012 12:54 pm

Re: Likelihood only!

Postby jpfeifer » Thu Jul 03, 2014 10:01 am

Which type of inference do you mean? And how did you estimate your parameters. You can always work with Delta-methods yourself, but Dynare does not provide prepackage routines for inference on external estimates.
------------
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: Likelihood only!

Postby Glm » Thu Jul 03, 2014 2:41 pm

With inference I mean being able to say how certain each one of the parameter values are. I estimated it by the use of an algorithm that changed the parameter vector with regard to the likelihood until it reach an optimum. Yeah I had something like the delta method in mind or maybe a MCMC.
Glm
 
Posts: 47
Joined: Tue Jan 17, 2012 12:54 pm

Re: Likelihood only!

Postby jpfeifer » Fri Jul 04, 2014 8:29 am

See for example Ruge-Murcia "Methods to Estimate Dynamic Stochastic General Equilibrium Models" on how to use the inverse hessian to get the asymptotic distribution of parameters from the likelihood function. Using numerical differentiation, you can easily compute this from the likelihood function. The relevant part from Dynare's code in the current snapshot is:
Code: Select all
hh = reshape(hessian(dsge_likelihood,xparam1, ...
                    options_.gstep,dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,oo_),nx,nx);
invhess = inv(hh);
stdh = sqrt(diag(invhess));
oo_.posterior.optimization.Variance = invhess;
------------
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: Likelihood only!

Postby Glm » Fri Jul 04, 2014 11:00 am

Oki, nice! Thanks for the advice :)
Glm
 
Posts: 47
Joined: Tue Jan 17, 2012 12:54 pm

Re: Likelihood only!

Postby Glm » Fri Sep 05, 2014 11:27 am

When estimating I've realised that every once in a while Matlab gives the following warnings

1. From the m-file evaluate_steady_state.m row 86: ys = ys_init-jacob\fvec.
Then it sometimes gives the warning message that the jacobian is badly scaled and the results may be inaccurate



2. In the m-file dyn_first_order_solver.m row 315: ghu = - A_ \ fu;
Then it sometimes gives the warning message that A_ is badly scaled and the results may be inaccurate



3. In the m-file lyapunov_symm2.m It's regarding the q matrix row 158 and row 185.
Then it sometimes gives the warning message that q is badly scaled and the results may be inaccurate




How to think about this problems? I've realised that in regions when this happens a lot the log likelihood function sometimes goes to a very high value. Which is unrealisticly high and sometimes even 0, which is the highest possible value that a log likelihood function can get.
Glm
 
Posts: 47
Joined: Tue Jan 17, 2012 12:54 pm

Re: Likelihood only!

Postby jpfeifer » Fri Sep 05, 2014 11:41 am

These are areas where the parameters result in numerical problems and results should be taken with a grain of salt as they may be numerically imprecise. That's why you get the warning. Inversion of a near-singular matrix is required in those steps.

Regarding your last statement: it's not true that 0 is the highest value of a log-likelihood as we are talking about pdfs of continuous distributions. See http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=2847

Also, when you say high likelihood values, are we talking about the actual likelihood or minus the likelihood. Because ideally those problems result in low likelihoods and the draws are rejected.
------------
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: Likelihood only!

Postby Glm » Fri Sep 05, 2014 12:09 pm

Oki, you're right about the 0 thing.

I mean the log likelihood, so in absolute terms the lower value the better (more likely). But can't it be that these inaccuracy problems produces unrealistically good values and therefore tricks one to believe that this is the best likelihood value? I mean, is there a guarantee that the values are always wrong in the since that they produces a bad likelihood? Shouldn't the inaccuracy go both ways?
Glm
 
Posts: 47
Joined: Tue Jan 17, 2012 12:54 pm

PreviousNext

Return to Dynare help

Who is online

Users browsing this forum: No registered users and 10 guests