Code covered by the BSD License  

Highlights from
Using MATLAB(R) and Symbolic Math Toolbox(TM) to Develop and Analyze Financial Models

5.0

5.0 | 3 ratings Rate this file 17 Downloads (last 30 days) File Size: 304.31 KB File ID: #26016
image thumbnail

Using MATLAB(R) and Symbolic Math Toolbox(TM) to Develop and Analyze Financial Models

by Dan Doherty

 

03 Dec 2009 (Updated 17 Nov 2010)

These files accompany the webinar with the same title.

| Watch this File

File Information
Description

These files introduce how Symbolic Math Toolbox™ can be used to evaluate Nelson Siegel and Svensson models, which are 2 widely used techniques for modeling yield data. We demonstrate how you can define the models in the MuPAD notebook interface and perform some basic analysis and visualization of the models. We then show how you can calculate analytical Jacobians for the models, and use these Jacobians to help speed up an optimization where model parameters are optimized such that they fit government bond data as well as possible.

You will need MATLAB®, Symbolic Math Toolbox, and Statistics Toolbox™ to run this demo.

To run this demo, execute Yield_Curve_Optimization.m. Make sure to evaluate the contents of yieldCurve_models.mn before importing variables from the notebook using getVar. You can evaluate the entire notebook by going to the 'Notebook' menu and selecting 'Evaluate All'.

Required Products Statistics Toolbox
Symbolic Math Toolbox
MATLAB release MATLAB 7.9 (2009b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (6)
16 Jul 2010 Salman  
30 Nov 2010 Niall  
13 Jul 2011 Henry Zhu

Thanks for your great work.

03 Aug 2011 Liam Mescall

Great work thanks

14 Nov 2011 Alexander K

Thanks for sharing, these files are very helpful.
I am just a beginner in the MatLab and may be mistaken, but it seems to me that there could be an error in the Nelson-Siegel and Svensson equations in yieldCurve_models.mn file.

More specifically Nelson-Siegel model is defined as:

y1 :=b0+b1*exp(-t/t1)+b2*(-t/t1)*exp(-t/t1)

while in the matlab file nelsonsiegelforward.m in finfixed folder the same model is defined as:

ForwardRate = Beta0 + Beta1*(exp(-t/Tau1)) + Beta2*(t/Tau1)*(exp(-t/Tau1)) + Beta3*(t/Tau2)*(exp(-t/Tau2)).

Please, correct me if I am mistaken.

14 Nov 2011 Alexander K

Sorry, the ForwardRate equation that I posted was for Svensson model and here is the equation for Nelson-Siegel model:

 ForwardRate = Beta0 + Beta1*(exp(-t/Tau1)) + Beta2*(t/Tau1)*(exp(-t/Tau1))

Please login to add a comment or rating.
Updates
04 Jan 2010

Changed zip file so that contents include appropriate copyright information.

17 Nov 2010

Made minor updates to demo

Tag Activity for this File
Tag Applied By Date/Time
symbolic math Dan Doherty 31 Dec 2009 16:22:08
symbolic Dan Doherty 31 Dec 2009 16:22:08
analytical model Dan Doherty 31 Dec 2009 16:22:08
jacobian Dan Doherty 31 Dec 2009 16:22:08
derivative Dan Doherty 31 Dec 2009 16:22:08
finance Dan Doherty 31 Dec 2009 16:22:08
svensson Dan Doherty 31 Dec 2009 16:22:08
mupad Dan Doherty 31 Dec 2009 16:22:08
nelson siegel Dan Doherty 31 Dec 2009 16:22:08
mupad Babuino Babuini 28 Jan 2010 21:29:16
mupad Shao Tai Hsieh 29 Jun 2010 22:11:12

Contact us at files@mathworks.com