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
Hi Alex,
cov() uses the formula for a sample covariance. The denominator is N
- 1 instead of N. However, the formula you used from Wikipedia is for
a population covariance. To move between the two in this case:
cov(sr, sr) * (4/5) # should equal E[XX] - E[x] * E[x]
Cheers,
Josh
On Wed, Jan
not understand i.e pearson, kendal and
spearman method)
I would like to thank you in advance for your patience.
Best Regards
Alex
--- On Wed, 1/19/11, Joshua Wiley jwiley.ps...@gmail.com wrote:
From: Joshua Wiley jwiley.ps...@gmail.com
Subject: Re: [R] How to find more about Covariance (in R
Hi,
On Wed, Jan 19, 2011 at 9:59 AM, Alaios ala...@yahoo.com wrote:
Dear Josh,
I would like to thank you for your reply.
I think that it is clear that I miss a lot of theory. I have tried in google
to read and study more about covariance but I have this feeling that the term
'covariance'
like to thank you in advance for your patience.
Best Regards
Alex
--- On Wed, 1/19/11, Joshua Wiley jwiley.ps...@gmail.com wrote:
From: Joshua Wiley jwiley.ps...@gmail.com
Subject: Re: [R] How to find more about Covariance (in R)
To: Alaios ala...@yahoo.com
Cc: r-h...@stat.math.ethz.ch
5 matches
Mail list logo