Friday, April 8, 2011

Monitoring Sources of Bond Return

Here is a way to monitor bond return sources in R.  In the next iteration, I will use CPI to add history to the series.

From TimelyPortfolio

So right now, you can expect about a 5% return from bonds.  How much of that is real return is unknown.

R code:

require(quantmod)
require(PerformanceAnalytics)
require(reshape2)
require(ggplot2)

getSymbols("WGS10YR",src="FRED") #load 10yTreasury
getSymbols("WFII10",src="FRED") #load 10yTIP for real return
getSymbols("BAMLC0A0CM",src="FRED") #load Corporate for credit
getSymbols("CPIAUCSL",src="FRED") #load Corporate for credit

bondReturnSources<-na.omit(merge(WGS10YR-WFII10,WFII10,to.weekly(BAMLC0A0CM)[,4])["2003::"])
colnames(bondReturnSources)<-c("10yTreasury","10yTIPReal","Credit")
bondReturnSourcesToGraph<-data.frame(cbind(as.Date(index(bondReturnSources)),coredata(bondReturnSources)))
colnames(bondReturnSourcesToGraph)<-c("Date","InflationBreakEven","10yTIPReal","Credit")
bondReturnSourcesToGraph<-melt(bondReturnSourcesToGraph,id.vars=1)
colnames(bondReturnSourcesToGraph)<-c("Date","ReturnSource","Yield")
rownames(bondReturnSourcesToGraph)<-c(1:NROW(bondReturnSourcesToGraph))
ggplot(bondReturnSourcesToGraph, stat="identity", aes(x=Date,y=Yield,fill=ReturnSource,group=ReturnSource)) + geom_area() +scale_x_date(format = "%Y") + opts(title = "Sources of Bond Return")

2 comments:

  1. This is a great blog, thanks for posting this!! What is BAMLC0A0CM? Have you gone back to 1980s (to see what it looked like when interest rates were in high teens? And also, could you post the link that includes your updated post with CPI?

    ReplyDelete
  2. research.stlouisfed.org/fred2/series/BAMLC0A0CM BAMC0A0CM is the Merrill Lynch/Bank of America US Investment Grade Corporate Index Option Adjusted Spread. Unfortunately, the publicly available data is limited to what is shown. For longer history, see the previous posts. I will update today and post.

    Thanks so much for reading and commenting.

    ReplyDelete