[R] Finding the correlation coefficient of two stocks

Pete Brecknock Peter.Brecknock at bp.com
Sun Jan 30 16:36:56 CET 2011


Dieter is correct, the lengths of the 2 series are different

Try ....

s = merge(s1,s2)

corr = cor(s[,"Close.s1"],s[,"Close.s2"],use="pairwise.complete.obs")

print(corr)

HTH

Pete
-- 
View this message in context: http://r.789695.n4.nabble.com/Finding-the-correlation-coefficient-of-two-stocks-tp3246992p3247261.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list