Kalman Filter and MLE

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_2pi - eps®
Phillips curve: pi = param_3pi(+1) + param_4yhat + param_5ahat
evolution of technology: ahat = param_6
ahat(-1) + eps(a)

where yhat is output gap, pi is inflation, ahat is technology, eps® 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 = Fahat(-1) + Veps(a)
measurement equation: Y = Hahat + Weps®

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
code.zip (27.8 KB)

You have to enter the observation equation as part of your model in Dynare, see [Simple model. Unkown error!)