Hello everyone, I am trying to understand how covariance work. So I created a vector called sr<-c(2,5,7,5,2)
so according to wikipedia Cov(X,X)=E[XX]-E[x]*E[x] which in R is mean(sr*sr)-mean(sr)*mean(sr) [1] 3.76 but also cov(sr,sr) [1] 4.7 why is this difference between these two approaches? Where I am wrong? I would like to thank you in advance for your help Best Regards Alex ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.