Kalman filtering and smoothing

Dear all,
I would like to understand how Dynare computes the Kalman filter and the smoother.

1- Starting with matrices dr_.ghx and dr_.ghu, how to obtain (or identify) matrices zz, psi and phi in a model whose solution is given by:

Y_t=zz*GAM_t+W_t (measurement equation)

GAM_t=phiGAM_{t-1}+psiV_t (transition equation)

with E(V_tV_t’)=SIG_v, E(W_tW_t’)=SIG_w

2- How does Dynare compute the Kalman filter and especially in a model with measurement errors as the one above. Is there any file I can take a look at in order to understand the mechanisms at work?

Thanks,
Junior

[quote=“jmaih”]Dear all,
I would like to understand how Dynare computes the Kalman filter and the smoother.
Junior[/quote]

Dear Junior,

a good reference is A. Harvey (1989) Forecasting, structural time series models and the Kalman filter. Cambridge University Press.

For diffuse filters, we use
"Filtering and Smoothing of State Vector for Diffuse State Space
Models", S.J. Koopman and J. Durbin (2003, in Journal of Time Series Analysis, vol. 24(1), pp. 85-98).

the code is implemented in DiffuseLikelihood*.m and DiffuseKalmanSmoother*.m

the top of the functions implement the diffuse filter, at the end you find the standard one.

Kind regards

Michel

Dear Michel,
Thank you so much!

All the best,
Junior