Code covered by the BSD License  

Highlights from
Kalman Filter Application CIR

4.0

4.0 | 1 rating Rate this file 27 Downloads (last 30 days) File Size: 25.1 KB File ID: #27704

Kalman Filter Application CIR

by

 

Estimates the parameters of the CIR model on a generated term structure

| Watch this File

File Information
Description

3 .m files, 1) simulates a term structure using the CIR model, 2-3) take this simulation and estimates the parameters of the model.
also includes a set of results, take mean() and std() of this to see how good the filter is.

If the implementation is good, the inputs should equal the outputs, run this 200 times.

For details see;

http://www.bankofcanada.ca/en/res/wp/2001/wp01-15a.pdf
and/or
Ren-Raw Chen and Louis Scott, “Multi-Factor Cox-Ingersoll-Ross Models of the Term Structure: Estimates and Tests from a Kalman Filter Model,” The Journal of Real Estate Finance and Economics 27, no. 2 (2003): 143-172.
etc.

Please comment or leave suggestions.
thanks bill, submission #27493 is included in the BSD

Acknowledgements

Kalman Filter Application inspired this file.

MATLAB release MATLAB 7.7 (R2008b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (4)
05 Nov 2012 Foroguh

I am trying to replicate your results but the code as it is produces errors in the optimization part and it stops around the 50th iteration. The final mean values are very far from the true one. Moreover the numbers that I am getting are very far from the ones in CIR200.mat. Can you please help?

01 Aug 2011 Steve G

I believe there is another problem in the code, LLtwoCIR, in the calculation of the Q matrix, the (1,1) element of which is,

(theta1*sigma1*sigma1*(1-exp(-kappa1*dt))^2/(2*kappa1)+sigma1*sigma1/kappa1*(exp(-kappa1*dt)-exp(-2*kappa1*dt)))*AdjS(1)

I think the correct code is,
theta1*sigma1*sigma1*(1-exp(-kappa1*dt))^2/(2*kappa1)+sigma1*sigma1/kappa1*(exp(-kappa1*dt)-exp(-2*kappa1*dt))*AdjS(1)
The AdjS only multiplies the second term, not both the first and second, see Chen and Scott (2003), page 147, second formula.

Thanks

24 Aug 2010 luisa cutillo

I am trying to replicate your results but the code as it is produces errors in the optimization part and it stops around the 50th iteration. The final mean values are very far from the true one. Moreover the numbers that I am getting are very far from the ones in CIR200.mat. Can you please help? I am just running your code as it is with matlab 2008. Thanks in advance. Luisa.

24 Aug 2010 luisa cutillo

I am trying to replicate your results but the code as it is produces errors in the optimization part and it stops around the 50th iteration. The final mean values are very far from the true one. Moreover the numbers that I am getting are very far from the ones in CIR200.mat. Can you please help? I am just running your code as it is with matlab 2008. Thanks in advance. Luisa.

Contact us