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.
How to show the Kalman Gains?
Re: How to show the Kalman Gains?
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.
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?
Many thanks for your help.