Interest Rates’ Influence on 1987
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
One aspect of 1987 that does not deserve enough attention is interest rates. Higher interest rates constrain economic activity and compete with other investments. As seen in the chart below, the US 10year Treasury rate climbed 40% from 7% to 10% as the S&P made its 40% price run. Particularly interesting is the last move higher in rates as stocks flattened August-October 1987.
From TimelyPortfolio |
Just for fun on February 23 2010, as I was getting a little bearish, I put together this chart which turned out to be 2 months early. I’ll show the original to avoid any hindsight bias.
US 10y rates through 4% this cycle will become burdensome to this nonstop up move in stocks. So far, 10y rates have just recovered to a low normal due to Fed manipulation. Remove the manipulation, and the rate would easily be through 4%, and stocks would struggle.
From TimelyPortfolio |
r code (please offer suggestions):
require(quantmod)
#as reader MILK commented, I just add this require TTR for clarity
#both quantmod and ttr are from the very generous and gifted Josh Ulrich
require(TTR)
require(PerformanceAnalytics)
tckr<-"^GSPC"
start<-"1986-12-31"
end<- format(Sys.Date(),"%Y-%m-%d") # yyyy-mm-dd
# Pull tckr index data from Yahoo! Finance
getSymbols(tckr, from=start, to=end)
US10yRate<-getSymbols("DGS10",src="FRED",auto.assign=FALSE)
#only way I know to remove the NAs from FRED 10 year rates
US10yRate<-to.daily(US10yRate)[,1]
SP500divbyUS10yRate<-GSPC[,4]/US10yRate
#running 25 day correlation
correlationSPand10y<-runCor(stocksandrates[,1],stocksandrates[,2],n=25)
#need to add labels to TA added to the quantmod chart but do not see in docs
#named the xts series was the only way to get a decent label
#please let me know if there is a way to override the TA label
chartSeries(GSPC[“1987-01::1987-10-19″,],log=FALSE,theme=’white’,name=”S&P 500 with US 10 year Rates”,TA=”addTA(US10yRate);addTA(SP500divbyUS10yRate);addTA(correlationSPand10y)”)
chartSeries(last(GSPC,”100 days”),log=FALSE,theme=’white’,name=”S&P 500 with US 10 year Rates”,TA=”addTA(US10yRate);addTA(SP500divbyUS10yRate);addTA(correlationSPand10y)”)
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.