[R] how to calculate covariance matrix in R? why cov doesn't work

aegea gcheer3 at gmail.com
Fri Dec 4 05:29:04 CET 2009


Hello, 

Sorry. It may be a stupid question. 
I have two vectors
a<-c(9,3,5)
b<-c(3,4,1)
How can I get the variance-covariance matrix of these two vectors?
I tried cov(a,b), I got a number not a matrix.
I tried to transpose vector a and b as t(a) and t(b), it still cannot work.

Any suggestions? Thank a lot!
-- 
View this message in context: http://n4.nabble.com/how-to-calculate-covariance-matrix-in-R-why-cov-doesn-t-work-tp948253p948253.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list