Tuesday, May 15, 2012

Skew of Bonds

As the researchpuzzler highlights in “a bad bet”, US bonds were a popular subject at the CFA Institute Annual Conference.  While US Bonds have been in an amazing 30 year run (see previous posts Lattice Explore Bonds, Bond Market as a Casino Game Part 1, Calmar Ratio 1.37 over the past 20 years), I think many positive skew-chasing market participants are not aware of the frequency of negative skew in bond returns.  As a public service, I thought I should issue a negative skew alert.

From TimelyPortfolio

R code from GIST:

require(quantmod)
require(PerformanceAnalytics)
#load my barclays agg file
#if you do not have access to Barclays Agg return then you can
#use VBMFX as a proxy
portfolio <- read.csv("C:\\Users\\Kent.TLEAVELL_NT\\Documents\\old\\R\\barclaysagg.csv",stringsAsFactors=FALSE)
portfolio <- portfolio[2:(NROW(portfolio)-1),2:NCOL(portfolio)]
portfolio <- portfolio[,c(1,4)]
#since export has duplicate colnames we need to remove the .1 added
#colnames(portfolio) <- substr(colnames(portfolio),1,nchar(colnames(portfolio))-2)
#transform to get in appropriate xts form
len <- nchar(portfolio[,1])
xtsdate <- paste(substr(portfolio[,1],len-3,len),"-",
ifelse(len==9,"0",""),substr(portfolio[,1],1,len-8),"-01",sep="")
portfolio.xts <- xts(data.matrix(portfolio[,2:NCOL(portfolio)]),order.by=as.Date(xtsdate))
portfolio.xts <- portfolio.xts/100
portfolio.xts[1,]<-0
#########start skew analysis################################################
colnames(portfolio.xts) <- "BarclaysAgg"
#get rolling skew
skew <- apply.rolling(portfolio.xts[,1],FUN=skewness,width=36,by=1)
#combine skew with ROC
skew.roc <- merge(skew,
ROC(apply(portfolio.xts[,1]+1,MARGIN=2,FUN=cumprod),type="discrete",n=36))
colnames(skew.roc)<-c("skew","roc")
#plot skew and roc
chart.TimeSeries(skew.roc, main="Barclays US Aggregate Skew and ROC (Rolling 36-month)",
legend.loc="topright")
view raw bond skew.r hosted with ❤ by GitHub

No comments:

Post a Comment