[R-SIG-Finance] Cross correlation problems

Rob Schmidt roschm at ymail.com
Fri Apr 5 15:53:16 CEST 2013


Doh!  Might as well fix my typo at the bottom.

library(quantmod)
symbols <- c("SPY","ILF","EWZ","IBM")
initDate <- "2010-01-01"
getSymbols(symbols,from=initDate)
rets <- xts(do.call(cbind.xts,
                    lapply(symbols,function(sym)
                        dailyReturn(get(sym)))),
            order.by=as.Date(index(get(symbols[1]))))
colnames(rets) <- symbols
print(round(cor(rets),2))    




--
View this message in context: http://r.789695.n4.nabble.com/Cross-correlation-problems-tp4663151p4663428.html
Sent from the Rmetrics mailing list archive at Nabble.com.



More information about the R-SIG-Finance mailing list