About the smoothing procedure in Dynare 4.5.7

Dear all:
Hello! I just joined the forum. I am a novice to Dynare and I am new to a DSGE modelling as my field is an empirical asset pricing. I am learning DSGE and how to implement it in Dynare and I really appreciate if any of you could help me.

I would like to like to know exactly what sort of a procedure is implemented in Dynare 4.5.7 for both the state smoothing and the disturbance smoothing. I found the following old post from Jan 2006:

“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”.

I wonder if the procedure in Harvey (1989) is still implemented in Dynare 4.5.7 or there is a new procedure specific to Dynare 4.5.7 is implemented.

Although I do not know much about smoothing, I did a quick literature survey and found that de Jong (1989) and Koopman (1993), for instance, proposed two distinct ways to implement smoothing. So it seems that there is no unique way to implement smoothing.

I appreciate your help.

Best,

Harvey is a general textbook. The default for Dynare is the standard Kalman smoother. IF you have unit roots, we use the diffuse Kalman filter. If you want, you can switch to the univariate version of these two filters. References are given in the manual.

Dear professor Pfeifer:

Thank you very much for your quick reply. As English is not my native language, I apologize if I do not understand your reply correctly.

I believe you mean that the exact code in Dynare is not the same as those in Harvey (1989) when you say “it is a general textbook”. I also believe that the code in Dynare is exactly the same as those in Koopman and Durbin (2003) for the diffuse state-space case.

What I would like to know is the exact procedure or the formula or the equation for the default case. I just want to know what is meant by “standard” Kalman smoother. I read the documentation (July 2018 version) and your note “A Guide to Specifying…” (July 2018 version) by searching for the words such as smooth* and smoother, but I did not find the exact explanation. I did find an explanation about the default Kalman filter which is the Multivariate Kalman filter for the stationary case. I believe you use the Multivariate Kalman smoother in the stationary case as well as a default. I just want to know the equation for the backward recursion for state and variance smoothing in the default case as I do not know what is the “standard” procedure. Can I regard the equation in the textbook by Hamiltion (1994) or Anderson and Moore (1979) as the standard Kalman smoothing procedure? Or is the equation 11 in Koopman and Durbin (2003) (which is more efficient and different) is used for the standard case? The referee might ask a question about the derivation of smoothed series so I wanted to know the precise formula.
I really appreciate your help.

Harvey covers a lot of material, so it is not a helpful reference.

For the standard Kalman filter, you can refer to Hamilton (1994), for the diffuse filter to Koopman/Durbin (2003).

Thank you very much for your quick reply. So for both filtering and smoothing, Dynare 4.5.7 uses equations in Hamiltion (1994) for the standard non-diffuse case. I really appreciate your help.

Yes. At


you can find the particular reference used in the implementation:
Durbin/Koopman (2012): “Time Series Analysis by State Space Methods”, Oxford University Press, Second Edition, Ch. 5

Thank you so much for the actual code. I also did some investigation. DsgeSmoother.m code is lined to two sub-matlab codes One is missing_diffuseKalmanSmootherH1_Z.m and the other is xxxH3_Z.m. When we choose algo 1 (multivariate non-diffuse) or algo 3 (multivariate diffuse) options in Dynare, it is linked to xxx.H1_Z.m. When we choose algo 2 (univariate non-diffuse) or algo 4 (univariate diffuse) options, it is linked to xxxH3_Z.m file.
So both non-diffuse and diffuse case are taken care of in one file for a multivariate case (H1_Z.m) or univariate case (H3_Z.m) .
My focus is on a non-diffuse Multivariate case and the code refers to equations on page 111, 4.35, 4.38,4.42,4.43 4.63 and 4.93 in KD 2012 and equation 14 in KD 2003.
For a Multivariate diffuse case, the code refers to equations 5.7,5.12-5.15,5.17,5.19,5.21,5.23,5.26,5.29-30 and equations on page 175 of KP 2012.
Also the code mentions a type in the equation in the original main text of KD 2003 (but there is a correct equation in the appendix of KD2003).

Best,

1 Like