I am reading an introductory statistics book and am lost at the authors explanation for covariance.

I follow up until the point the author arrives at:


However, they then go on to state:

The corrected sum of products $SSXY$ is given by


And therefore covariance is equal to:


The author does not explain why $SSXY$ is introduced. And I’m not following how $SSXY\sqrt{\frac{1}{(n-1)^2}}$ is obtained from $E(xy)-E(x)E(y)$

Here is a screenshot of the page:

enter image description here

  • $\begingroup$ The covariance, as given in your first formula, never equals the value given in terms of SSXY. Are you quoting this textbook accurately? $\endgroup$
    – whuber
    Oct 19 '20 at 21:36
  • 1
    $\begingroup$ I am pretty sure I have quoted it correctly but I included a screenshot to be sure. $\endgroup$ Oct 19 '20 at 21:40
  • $\begingroup$ Covariance is SSXY divided by n. So divide your right hand side by n, to see that it is the same expression as in terms of expectations. However, usually we compute covariance by dividing it by n-1, not by n (there are practical reasons to do so). That is why in your later formula the denominator is n-1 rather than n. $\endgroup$
    – ttnphns
    Oct 20 '20 at 7:33


The population covariance of two random variables defined on the same sample space is $$Cov(X,Y) = E\left[(X-\mu_X)(Y-\mu_Y)\right] = E(XY)-\mu_X\mu_Y.$$ where $\mu_X = E(X),\; \mu_Y = E(Y).$ The population correlation is $\rho = \rho_{XY}=Cor(X,Y)$ $= \frac{Cov(X,Y)}{\sigma_X\sigma_Y},$ where $\sigma_X >0$ and $\sigma_Y > 0$ are population standard deviations.

Ths sample covariance of data $(x_1, y_1),(x_2, y_2),\dots,(x_n,y_n)$ is

$$S_{xy} = \frac{1}{n-1}\sum_{i=1}^n(x_i-\bar x)(y_i-\bar y)= \frac{1}{n-1}\left[\sum_{i=1}^n x_iy_i - \frac 1n\sum_{i=1}^nx_i\sum_{i=1}^ny_i\right].$$ The sample correlation is $r = r_{xy} = \frac{S_{xy}}{S_xS_y},$ where the sample standard deviations are $S_x = \sqrt{\frac{1}{n-1}\sum_{i=1}^n(x_i-\bar x)^2}>0$ and similarly for $S_y>0.$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.