Page 1 of 1

Kalman Filter and MLE

PostPosted: Thu Mar 17, 2011 12:22 am
by wzben
Hi all:

I have a question regarding to how Dynare handle the state space representation of a solved DSGE model. Im working on my methodology chapter, which I set up a small 3 equation NKM as follows:

IS curve: (1+param_1)*yhat = yhat(+1) - param_2*pi - eps(r)
Phillips curve: pi = param_3*pi(+1) + param_4*yhat + param_5*ahat
evolution of technology: ahat = param_6*ahat(-1) + eps(a)

where yhat is output gap, pi is inflation, ahat is technology, eps(r) is interest rate shock and eps(a) is the technology shock. all param_* are in terms of structural parameters. Dynare could estimate the model easily (files are attached under sub-folder dynare).

I also programmed the model in Matlab (under code.zip/matlab), with the hope that I can arrive similar estimated parameters. The model is coded, and solved using Chris Sims' gensys, which give me exactly the same values as in oo_.dr. Then I proceed to rewrite the model in terms of state-space representation, which has the form:

state equation: ahat = F*ahat(-1) + V*eps(a)
measurement equation: Y = H*ahat + W*eps(r)

where Y is the observable variables =[yhat pi]', F = param_6, V=1 H is a 2x1 vector, and W is the 2x1 vector.

However, when I run Kalman filter, the estimated variance of the state variable (ahat) equals to 0, though I have a series of estimated state. I programed in Mathematica, and I found even Mathematica gives me a 0 analytical solution. I know Dynare uses transition_matrix.m to build matrix F and V, but what about H and W? I checked Dsgelikelihood.m, and I could't find any information on W, though it seems Pstar in Dsgelikelihood.m has something to do with matrix H. My gut feeling is matrix H and W caused problem, but I really have no idea.

So, my question is, where did it go wrong? at first I thought it was the stochastic singularity issue, but I have two observables and two shocks, should not be a hassle? How dynare map the solution to the state space representation? I have been stuck on this problem for months, any comments or help is much appreciated.

Thank you in advance for your time and kind help.

Regards,

Ben

Re: Kalman Filter and MLE

PostPosted: Sun Mar 10, 2013 12:35 pm
by jpfeifer
You have to enter the observation equation as part of your model in Dynare, see http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=2490