[R-SIG-Finance] Cross correlation problems
Rob Schmidt
roschm at ymail.com
Fri Apr 5 14:03:13 CEST 2013
I think of setting the initDate as a cheesy way to induce the rows to match
better without having to actually deal with it. Here's a more mangled
version:
library(quantmod)
sym1 <- "SPY"
sym2 <- "ILF"
sym3 <- "EWZ"
sym4 <- "IBM"
initDate <- "2010-01-01"
getSymbols(sym1,from=initDate)
getSymbols(sym2,from=initDate)
getSymbols(sym3,from=initDate)
getSymbols(sym4,from=initDate)
df <- data.frame( dailyReturn(get(sym1)), dailyReturn(get(sym2)),
dailyReturn(get(sym3)), dailyReturn(get(sym4)) )
names(df) <- c(sym1,sym2,sym3,sym4)
print(round(cor(df),2))
Best regards,
Rob
--
View this message in context: http://r.789695.n4.nabble.com/Cross-correlation-problems-tp4663151p4663410.html
Sent from the Rmetrics mailing list archive at Nabble.com.
More information about the R-SIG-Finance
mailing list