Maximum Likelihood Estimation of New Keynesian model

I have a basic four equation linearized New Keynesian model. There is an IS equation, Phillips Curve, nominal interest rate rule and a stochastic process for the natural rate of output. I want to estimate the price stickiness parameter and the coefficients on my policy rule. I have two shocks: one on the nominal rate and another on the natural rate of output. I take real GDP as my observed variable. I construct the series as follows:

  1. Take the log of real GDP
  2. Remove a time trend from real GDP and save the residuals.
  3. Put the residuals in for my observed variable.

My reasoning is that the model is already linearized around the steady state, so my data should have mean zero. However, when I estimate the model with MLE I get the message:

(minus) the hessian matrix at the “mode” is not positive definite!
=> posterior variance of the estimated parameters are not positive.
You should try to change the initial values of the parameters using
the estimated_params_init block, or use another optimization routine.
Warning: The results below are most likely wrong!

In dynare_estimation_1 at 643
In dynare_estimation at 62
In nk_tr_est at 120
In dynare at 132

Estimate s.d. t-stat

phi 0.0000 0.0000 0.0000
thetapi 1.3512 2928.5148 0.0005
thetay 0.9806 3733.2070 0.0003
rho 0.9900 0.0091 108.4244
standard deviation of shocks
Estimate s.d. t-stat

e 0.0099 0.0004 22.7696
u 0.0092 0.0000 0.0000

Clearly, something is wrong. Is there a problem with my code or data? I’ve included both my .mod file and data file. Thank you for your insight! :smiley:
pinew.m (8.49 KB)
nk_tr_est.mod (972 Bytes)

Try to use mode_compute = 6. Sometimes this helps to solve this kind of problem.

In addition:
in your code, there is missing the description of your shocks:

something like this:

var e; stderr 0.01;
var u; stderr 0.01;

Thanks for the comment. Unfortunately, when I use mod_compute=6 I get:

Error using chol
Matrix must be positive definite.

Error in gmhmaxlik (line 232)
dd = transpose(chol(CovJump));

Error in dynare_estimation_1 (line 512)
[xparam1,PostVar,Scale,PostMean] = …

Error in dynare_estimation (line 62)

Error in nk_tr_est (line 131)

Error in dynare (line 132)
evalin(‘base’,fname) ;

Also, where should I specify the variance of my shocks? In the example of estimation in the User Guide it is omitted. I tried it right after the model block, but that did not change anything.

In case of estimation you do not necessarily need to initialize all parameters for stoch_simul as they may be set by the estimation initialization. However, I would always recommend testing everything with stoch_simul first. Having said this, your code seems to be correct. My hunch is that maybe not all parameters you are trying to estimate can be identified given the observed series. In this case, the likelihood cannot be optimized in all directions and the Hessian would not be positive definite. Try starting with estimating only a subset of parameters, e.g. fix the standard deviations using the shocks-block and only estimate the other parameters to see if this works. Maybe you can find out which parameter creates the trouble.

Thanks Jpfeifer! I’ll fiddle around with it more, but on first glance when I set all the parameters except for the policy ones, it still has issues with the Hessian. As a check on the data, I simulated “fake” data from the model and used that as my input in the estimation, yet it still has the same problem. I also tried setting the policy parameters and estimating the price stickiness parameter, but it broke down. I think you’re right about the lack of identification, it’s just a matter of figuring out where it’s at.