Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /home/calcul9/public_html/wp-content/themes/suffusion/functions/media.php on line 580

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /home/calcul9/public_html/wp-content/themes/suffusion/functions/media.php on line 583

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /home/calcul9/public_html/wp-content/themes/suffusion/functions/media.php on line 586

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /home/calcul9/public_html/wp-content/themes/suffusion/functions/media.php on line 589

Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /home/calcul9/public_html/wp-content/themes/suffusion/functions/media.php on line 592
Calculating the Breakeven Inflation Rate from the Yield Curve » The Calculating Investor

Calculating the Breakeven Inflation Rate from the Yield Curve

Note: This page contains links to the data sources and the Octave source code which I used to generate the plots in my  Inflation Expectations and the Breakeven Rate of Inflation post.

Data:

The first graph plotted in my inflation expectations post was created using the FRED database at the St. Louis Fed website.  This site is an excellent resource for a variety of macroeconomic information and signing up for an account is free.

The data used to create the 30-year yield curves and breakeven inflation rates is from the Treasury department website.  The “Daily Treasury Yield Curve Rates” and the “Daily Treasury Real Yield Curve Rates” are copied to text files which are read by the Octave script.  The script uses the last line of the file, but it can easily be modified to plot data from other dates.

Code:

The Octave code used to generate the yield curve and expected inflation plots is shown here:

clear all;
close all;

% Read in data from text files.  Data source is U.S. Treasury website
nomdata = dlmread('treasuryyieldcurve.txt',' ');
realdata = dlmread('realyieldcurve.txt',' ');

% Read yields from last line of each file
y_treas = nomdata(end,2:12)./100;
y_real = realdata(end,2:6)./100;

% Maturities for each rate
x_treas = [1/12 0.25 0.5 1 2 3 5 7 10 20 30];
x_real = [5 7 10 20 30];

% Interpolate Values
x1 = (1:60)/2;
y1 = interp1(x_treas,y_treas,x1,'spline');
y2 = interp1(x_real,y_real,x1,'spline');

% Extrapolate curve for difference and extend
y1y2 = interp1(x1(10:60),(y1(10:60)-y2(10:60)),x1,'spline','extrap')
y2 = [(y1(1:9)-y1y2(1:9)) y2(10:60)]

% Compare fit to actual data
figure(1)
plot(x1(8:60),100*y1(8:60),'linewidth',2,x1(8:60),100*y2(8:60),'linewidth',2,x1(8:60),100*(y1(8:60)-y2(8:60)),'linewidth',2)
pause(5)
title('Constant Maturity Yields on Coupon Paying Bonds','fontsize',20)
xlabel('Time to Maturity','fontsize',16)
ylabel('Constant Maturity Yield (%)','fontsize',16)
legend('Treasury','TIPS','Breakeven Inflation','location','northwest')

% Bootstrap Zero Curve

% Treasuries
rstart = log(1 + (y1(1)*(1/12)))/(1/12);
z1(1) = 100/(100*(1+y1(1)/2));

for i = 2:length(y1)
	z1(i) = (100 - y1(i)/2*100*sum(z1(1:i-1)))/(100*(1+y1(i)/2));
end

% TIPs
z2(1) = 100/(100*(1+y2(1)/2));

for i = 2:length(y2)
	z2(i) = (100 - y2(i)/2*100*sum(z2(1:i-1)))/(100*(1+y2(i)/2));
end

% Nominal Discount Factor
x_treas = x1(~isnan(z1));
z_treas = z1(~isnan(z1));

% Real Discount Factor
x_real = x1(~isnan(z2));
z_real = z2(~isnan(z2));

% Plot Discount Factor
figure(2)
plot(x_treas,z_treas,'linewidth',2,x_real,z_real,'linewidth',2)
pause(5)
title('Bootstrapped Discount Factors for Zero Coupon Bonds','fontsize',20)
xlabel('Time to Maturity','fontsize',16)
ylabel('Discount Factor','fontsize',16)

% Convert to annualized zero coupon yield and calculate inflation
r_treas = (1./z_treas).^(1./x_treas) -1;
r_real = (1./z_real).^(1./x_real)-1;
infl = r_treas - r_real;

% Plot Zero Coupon Rates
figure(3)
plot(x_treas(8:60),100*r_treas(8:60),'linewidth',2,x_real(8:60),100*r_real(8:60),'linewidth',2,x_treas(8:60),100*infl(8:60),'linewidth',2)
pause(5)
title('Annualized Interest Rates on Zero Coupon Bonds and Breakeven Rate of Inflation','fontsize',20)
xlabel('Time to Maturity','fontsize',16)
ylabel('Annualized Interest Rate (%)','fontsize',16)
legend('Treasury Zero','TIPS Zero','Breakeven Inflation','location','northwest')

% Calculate Forward Rates
forward_treas = -log(z_treas(2:end)./z_treas(1:end-1))/0.5;
forward_real = -log(z_real(2:end)./z_real(1:end-1))/0.5;
forward_infl = forward_treas - forward_real;

% Plot forward rates
figure(4)
plot(x_treas(8:end-1),100*forward_treas(8:end),'linewidth',2,x_real(8:end-1),100*forward_real(8:end),'linewidth',2,x_real(8:end-1),100*forward_infl(8:end),'linewidth',2)
pause(5)
axis([0 30 -1 8])
pause(3)
title('Forward Interest and Inflation Rates','fontsize',20)
xlabel('Time to Maturity','fontsize',16)
ylabel('Annualized Interest Rate (%)','fontsize',16)
legend('Forward Nominal (Treasuries)','Forward Real (TIPS)','Forward Breakeven Inflation','location','northwest')

Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)