0
$\begingroup$

I'm trying to build my basic intuition on covariance, but am confused about the notation I typically see:

cov(X,Y) = E[(X - E[X])(Y - E[Y])]

Why is there no summation sign in this formula, and why are the X's capitalized? Consider this basic example to see where I'm slipping up.

enter image description here

To find the covariance, it seems like we:

  1. find the distance between a single observed value of variable X (thus my confusion with X...why isn't it Xi?) and the expected value of X (the sample mean)
  2. do the same for the first observation of variable Y
  3. multiply these together
  4. repeat this process for each observation separately (again, my confusion on using X instead of Xi)
  5. add up these cross-products (thus my confusion with no summation symbol)
  6. divide by n-1 because my expected values are sample means (thus my confusion on no division in the formula)

How does the formula I mention (see on Wikipedia) represent the calculation above? I want to know what I am misunderstanding about either the steps or the notation.

$\endgroup$

2 Answers 2

1
$\begingroup$

You are confusing the sample covariance and population covariance. What you calculate is the sample covariance (because it is based on observations), but the formula you give at the start is the "theoretical" covariance between $X$ and $Y$.

The sample covariance is a way to estimate the population covariance.

$\endgroup$
2
  • $\begingroup$ That's helpful! Let's say my population expected values for X and Y are the same as my sample means, so I can focus on the notation question. Does this change how you would answer the question? $\endgroup$
    – JmQ
    Commented Apr 3, 2019 at 17:37
  • 1
    $\begingroup$ Still same thing, although this means you would know the actual expected value, so you can divide by $n$ instead of $n-1$. If you don't know the actual expected value, you estimate it with the sample mean and this makes you lose a "degree of freedom", so you must divide by $n-1$ rather than $n$. The part about the difference between population and sample parameters remains the same. $\endgroup$
    – Dasherman
    Commented Apr 3, 2019 at 17:42
1
$\begingroup$

You are confusing population moments with sample moments. The formula you describe is about the covariance between random variables (like a 'true' covariance/population covariance). The expectations you see are population expectations and not to be confused with the sample mean. The process you describe is one way of approximating the population moments based on the sample you posted.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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