Docsity

Matrix Division and Bootstrapping Zero Rate Curve in Matlab - Prof. Timothy Krehbiel, Study notes of Finance

Toggle sidebar
bg1
Dividing Matrices:
Matrix division is useful primarily for solving equations, and especially for solving
simultaneous linear equations:
A*X = B
Matlab provides two matrix division processes; left and right ( \ and / )
In general, given appropriate matrix dimensions
X = A\B solves for X in A*X = B
X = B/A solves for X in X*A = B
In general, matrix A must be a nonsingular square matrix, i.e. it must be invertible.
Left division:
A = [2 1 3
19 7 5
23 31 29]
eig(A) =
37.8139
0.0930 + 4.9956i
0.0930 - 4.9956i
X=[3
2
1]
B=A*X
B =
11
76
160
A\B
ans =
3.0000
2.0000
1.0000
Right division:
B=X'*A
B =
67 48 48
B/A
ans =
3.0000 2.0000 1.0000
1
pf3
pf4
pf5

Partial preview of the text

Download Matrix Division and Bootstrapping Zero Rate Curve in Matlab - Prof. Timothy Krehbiel and more Study notes Finance in PDF only on Docsity!

Dividing Matrices: Matrix division is useful primarily for solving equations, and especially for solving simultaneous linear equations: AX = B Matlab provides two matrix division processes; left and right ( \ and / ) In general, given appropriate matrix dimensions X = A\B solves for X in AX = B X = B/A solves for X in X*A = B In general, matrix A must be a nonsingular square matrix, i.e. it must be invertible. Left division: A = [2 1 3 19 7 5 23 31 29] eig(A) =

0.0930 + 4.9956i 0.0930 - 4.9956i X=[ 2 1] B=A*X B = 11 76 160 A\B ans =

Right division: B=X'*A B = 67 48 48 B/A ans = 3.0000 2.0000 1.

Bootstrapping the term structure of interest rates (zero rate curve) from market data : Given n bonds, each with maturity T = 1, …., n Bt^ = value of bond with maturity (t). cit^ = cash flow of bond with maturity (t) at time (i). ctt^ = par value of bond with maturity (t) plus final coupon payment. b(0,t) = 1/(1+z0,t)t^ = price of one dollar received at time (t), i.e. discount factor. We have a system of n equations in n unknowns ( 0 , 1 ) ( 0 , 2 ) ( 0 , 3 ) ... ( 0 , ) ( 0 , 1 ) ( 0 , 2 ) ( 0 , 3 ) ( 0 , 1 ) ( 0 , 2 ) ( 0 , 1 ) 1 2 3 3 3 3 2 3 1 3 2 2 2 1 2 1 1 1 B c b c b c b c b n B c b c b c b B c b c b B c b n n n (^)  nnn             B = Cb B = vector of bond prices C = diagonal matrix of bond cash flows b = unknown vector of discount factors b=C\B The zero rates are obtained from the relationship 1 ( 0 , ) 1 1 / 0 , (^)         t t b t z C=[110 0 0 10 110 0 10 10 110] B=[

96] Find zero rate curve for this set of market data.

Treasury notes and bonds: Coupon rate(%) Maturity Bid Price Ask Price Ask Yield(%) All rates; Coupon, Bid, Ask and Ask Yield stated in decimals All prices; Bid Price, Ask Price stated in decimals % Term structure functions; format compact a = XLSREAD('h:\classes\spring04\fin5883s04\treasury_022304b.xls','bills'); b = XLSREAD('h:\classes\spring04\fin5883s04\treasury_022304b.xls','notes'); c = XLSREAD('h:\classes\spring04\fin5883s04\treasury_022304b.xls','bonds'); % settlement date settle = datenum('02/23/2004'); % convert Excel datenum to Matlab datenum % to check dates use datestr command; datestr(a(:,1),2) a(:,1)=x2mdate(a(:,1)); b(:,2)=x2mdate(b(:,2)); c(:,2)=x2mdate(c(:,2)); % create appropriate data format a(:,3:5)=0.01a(:,3:5); b(:,[1 5])=0.01b(:,[1 5]); b(:,3)=fix(b(:,3))+(100/32)(b(:,3)-fix(b(:,3))); b(:,4)=fix(b(:,4))+(100/32)(b(:,4)-fix(b(:,4))); c(:,[1 5])=0.01c(:,[1 5]); c(:,3)=fix(c(:,3))+(100/32)(c(:,3)-fix(c(:,3))); c(:,4)=fix(c(:,4))+(100/32)*(c(:,4)-fix(c(:,4))); % Parse notes and bonds. Eliminate data rows with maturity before last bill maturity %date from notes and eliminate bond rows with maturity before last note maturity endbill=a(end,1); endnote=b(end,2); notedates=b(:,2); bonddates=c(:,2); b=b(notedates > endbill,:); c=c(bonddates >endnote,:); % convert bill to bond comparable information

a=tbl2bond(a); % combine data all=[a;b;c]; % convert data into form ready for bootstrapping [bonds, prices, yields]=tr2bonds(all); % bootstrap zero curve from bond data and prices [zerorates, curvedates]=zbtprice(bonds, prices, settle); The bootstrapped zero curve is not useful for identifying over or under priced securities from the set of securities used as inputs. The zero curve will fit their prices exactly. There is a vast literature on the best methods to fit a function to the yield curve. C. Nelson and A. Siegel, “parsimonious Modeling of Yield Curve,” Journal of Business, 60, no. 4 (1987): 473-489. M. Fisher, D. Nychka, and D. Zervos, “Fitting the Term Structure of Interest Rates with Smoothing Splines,” Working Paper , No. 95-1 (1995), Finance and Economics Discussion Series, Federal Reserve board, 1995. R. Bliss, “Testing Term Structure Estimation Methods,” Advances in Futures and Options Research , 9 (1997): 197-231.