veepsirtt wrote:> > corr <- cor(s1,s2) > Error in cor(s1, s2) : incompatible dimensions > >Check lenghts of your series. cor(c(1,2),c(1,2,3)) #Error in cor(c(1, 2), c(1, 2, 3)) : incompatible dimensions Dieter -- View this message in context: http://r.789695.n4.nabble.com/Finding-the-correlation-coefficient-of-two-stocks-tp3246992p3247042.html Sent from the R help mailing list archive at Nabble.com.
Pete Brecknock
2011-Jan-30 15:36 UTC
[R] Finding the correlation coefficient of two stocks
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.
Seemingly Similar Threads
- How to get the closing price from the the GOOGLE FINANCE site for NSEINDIA stocks
- Significance of the difference between two correlation coefficients
- How to get multiple Correlation Coefficients
- Correlation matrix from a vector of pairwise correlations
- Please help on correlation matrix