As a quick follow-up to my first REITs for Everybody Might Now Mean REITs for Nobody, I want to look at REITs and High Yield bonds, which also might simultaneously attract conservative yield buyers and speculative beta chasers.

HYG (iShares High Yield) and IYR (iShares REIT)

With R we can statistically analyze the similarity of REITs and High Yield.

R code (click to download):

#analyze REITs and High Yield require(quantmod)

require(PerformanceAnalytics) #get ML/BAC High Yield Index

MLHY <- getSymbols("BAMLHYH0A0HYM2TRIV",src="FRED",auto.assign=FALSE)

#get Wilshire REIT Index

getSymbols("WILLREITIND",src="FRED") prices <- na.omit(merge(WILLREITIND,MLHY))

colnames(prices) <- c("Wilshire.REIT","MLBAC.HighYield")

returns <- ROC(prices,n=1,type="discrete") charts.PerformanceSummary(returns,ylog=TRUE,

main="Wilshire REIT Total Return and ML/BAC High Yield",

colorset=c("cadetblue","darkolivegreen3")) chart.TimeSeries(runCor(returns[,1],returns[,2],n=250),

main="Wilshire REIT Total Return and ML/BAC High Yield

Rolling 1 Year Correlation",colorset="cadetblue") chart.Correlation(returns)

Created by Pretty R at inside-R.org

*Related*

To

**leave a comment** for the author, please follow the link and comment on their blog:

** Timely Portfolio**.

R-bloggers.com offers

**daily e-mail updates** about

R news and

tutorials on topics such as:

Data science,

Big Data, R jobs, visualization (

ggplot2,

Boxplots,

maps,

animation), programming (

RStudio,

Sweave,

LaTeX,

SQL,

Eclipse,

git,

hadoop,

Web Scraping) statistics (

regression,

PCA,

time series,

trading) and more...

If you got this far, why not

__subscribe for updates__ from the site? Choose your flavor:

e-mail,

twitter,

RSS, or

facebook...

**Tags:** bonds, R, reits, stocks