Simplify Kalman filter process to reduce estimation time!

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

Simplify Kalman filter process to reduce estimation time!

Postby pburriel » Mon Jun 18, 2007 2:39 pm

Dear all,

I have a question about how to simplify the Kalman filter process to reduce estimation time substantially.

It seems that the most time consuming part of the (Bayesian) estimation process is the Kalman filter. In order to shorten this process, some authors make assumptions about the Kalman filter process which simplify it a lot. I have heard two possibilities for this:

- The neater way would be to evaluate the evolution of the kalman gain and stop the filter once it has converged, which according to some authors it happens rather quickly. I have been told that in time series models it generally converges after 15-20 observations, therefore reducing estimation time by 50% in samples with more than 10 years of quarterly data.

- An even simpler way is to use the steady state solution for the state variables (x(t)) and the Sigma(t/t) matrix (predicting error var-cov matrix of x(t) given all the information available until time t) to evaluate the Kalman gain. Because in this case it can be shown that the kalman gain is constant and we do not need to update it with every observation, reducing massively the estimation time. Then, once we are happy with the estimation results we could run one estimation with the full kalman filter to make sure nothing changes.

Are any of these two options already implemented in dynare? How can we apply them?

If not, which files would need to be changed to apply them? Are you considering this option for future versions of dynare?

This is more important than it may seem since according to some authors it could reduce estimation times by up to 80%. Which for some middle size models could mean days saved... :D

Thank you for your help.

Pablo
pburriel
 
Posts: 23
Joined: Wed Jun 29, 2005 4:42 am

Re: Simplify Kalman filter process to reduce estimation time

Postby StephaneAdjemian » Mon Jun 18, 2007 3:02 pm

Dear Pablo,

The Kalman filter is coded as you say in the first remark. It would be a very bad idea to iterate on the Ricatti equation after the kalman filter has converged because round off errors propagate dramatically in this kind of recurrence equation (and also, as you pointed out, because this step is time consuming).

Your second remark suggests to start the kalman filter from the steady state of the Ricatti equation and not from the steady state of the state equation (as it is done in dynare and elsewhere). It's true that the algorithm would be much faster and robust. But my (little) experience (estimation of VARMA processes) is that this induces a little biais in the estimates (decreasing with the size of the sample). It would be possible to start from the steady state of the ricatti equation (as you suggest) and to apply in the end a correction... But the correction would be as difficult to compute than the standard kalman filter... This is (today) not possible in Dynare.

Best,
Stéphane.
StephaneAdjemian
 
Posts: 429
Joined: Wed Jan 05, 2005 4:24 pm
Location: Paris, France.

Simplify Kalman filter process to reduce estimation time

Postby pburriel » Mon Jun 18, 2007 3:57 pm

I guess what I was suggesting is to use to explore the likelihood and try to get some acceptable estimates the approximation consisting in starting the kalman filter from the steady state of the Ricatti equation. Since the exploration stage is what takes longer in any estimation process and as you said the biases ought to be small.

Then, once you have reached a better understanding of the problem you can go back and do the correct thing starting the kalman filter from the steady state of the state equation. If the results hold, then you have had to run this longer process only once. If not, then you have to explore a bit with this longer process.

Therefore, my question would be, how (or where) would I have to modify the kalman filter code in dynare to start the kalman filter from the steady state of the Ricatti equation instead of the steady state of the state equation?

Thanks,

Pablo
pburriel
 
Posts: 23
Joined: Wed Jun 29, 2005 4:42 am

Re: Simplify Kalman filter process to reduce estimation time

Postby StephaneAdjemian » Wed Jun 20, 2007 9:29 am

Hi Pablo,

If you want to start the kalman filter with the steady state of the Ricatti equation instead of the steady state of the state equation you have to replace the line 132 of DsgeLikelihood.m (version 4):

Code: Select all
Pstar = lyapounov_symm(T,R*Q*R');


by something like:

Code: Select all
Pstar = ricatti_solver(T,R,Q,...);


where the function ricatti_solver computes the steady state of the Ricatti equation. I tried this idea years ago by using the slicot fortran library:

http://www.slicot.de/index.php?site=addsoftware

to compute the steady state of the Ricatti equation. On this web page you should find matlab interfaces to the fortran library.

Best,
Stéphane.
StephaneAdjemian
 
Posts: 429
Joined: Wed Jan 05, 2005 4:24 pm
Location: Paris, France.


Return to Dynare help

Who is online

Users browsing this forum: Google [Bot] and 6 guests