Page 1 of 1

How to show the Kalman Gains?

Posted: Sun Dec 08, 2013 4:43 am
by May-June
Dear Tom,

I'm trying to replicate the KalMan filter of Stock and Watson (1991) and I would like to extract the Kalman Gain.
I have added the option: Gain = Gain into DLM
*
dlm(start=%%DLMSetup(),y=yf,sw=sw,c=c,a=a,f=f,$
presample=ergodic,type=filter,$
pmeth=simplex,piters=10,Gain=Gain,method=bfgs) 1959:2 * xstates
*
And then, I don't know how to show the "GAIN".
I was trying with "display" but It appeared : Expected Type REAL, Got RECTANGULAR[REAL] Instead

Please show me how to do.

Many thanks.

Re: How to show the Kalman Gains?

Posted: Sun Dec 08, 2013 7:51 am
by TomDoan
GAIN produces a SERIES[RECT]. Assuming you have a single observable (it's a RECT because you could have multiple observables) you would need something like:

set gain1 = gain(t)(1,1)
set gain2 = gain(t)(2,1)

to extract the gains for the first and second states.

Re: How to show the Kalman Gains?

Posted: Sun Dec 08, 2013 8:26 am
by May-June
Many thanks for your help.