# What is the covariance equation?

I hate this book…get to the point, it keeps swirling! I could care less about the proof behind it at this point.

sum(i=1…n) p_i*(X_i-E[X])*(Y_i-E[Y])

Covariance = P1(Expected value of X1 - actual value of X1)(Expected value of Y1 - actual value of Y1) + P2(Expected value of X2 - actual value of X2)(Expected value of Y2 - actual value of Y2) etc. where P = the relevant probability Sorry about the rubbish notation!

Thanks.

for a historical data set, covariance is calculated as the sum of (R1-E(R1))*(R2-E(R2)) divided by n-1

hey mib20, why is it n-1 , not n for the denominator? is it always n - 1 for historical, and its not dependent on whether its a population vs. sample?

n-1 has to do with degrees of freedom in the calculation and nothing to do with samples or populations if i’m correct.

Use n-1 if you calculate X-bar and use n if the omniscient question writer gives you the population mean.

thanks joey, but what is x-bar in this case? it includes expected values and actual values? do you mean if the expected value needs to be calculated vs. it is given?

x-bar is the sample mean, as opposed to the population mean mu

Jamms Wrote: ------------------------------------------------------- > hey mib20, > > why is it n-1 , not n for the denominator? is it > always n - 1 for historical, and its not dependent > on whether its a population vs. sample? for a historical data set use n-1 (unless they give you every single data point). most likely, you will be given several data points and be told to calculate covariance. if they give you the population mean than you will use n in the denominator as joey said.