Lectures Prepared By: Elchanan Mossel Yelena Shvets
Lectures Prepared By: Elchanan Mossel Yelena Shvets
- Ave (height)
wage at 19
Ave (wage)
height at 16
National Longitudinal Survey of Youth 1997 (NLSY97)
Definition of Covariance
Cov (X,Y)= E[(X-X)(Y – Y)]
Alternative Formula
Cov (X,Y)= E(XY) – E(X)E(Y)
Variance of a Sum
Var (X+Y)= Var (X) + Var (Y)+2 Cov (X,Y)
Claim: Covariance is Bilinear
Cov ( aX b, cY d) E[( aX E( aX ))(cY E(cY ))]
E[ ac( X x )( Y y )]
acCov (X, Y).
What does the sign of covariance mean?
Look at Y = aX + b.
Then: Cov(X,Y) = Cov(X,aX + b) = aVar(X).
Ave(X) Ave(X)
y y
Ave(Y) Ave(Y)
a>0 a<0
x x
(X X ) (Y Y )
X
*
and Y
*
SD ( X) SD ( Y)
E ( X ) E ( Y ) 0 and SD ( X ) SD ( Y ) 1
* * * *
Corr ( X, Y) Cov ( X * , Y * ) E ( X * Y * )
Covariance and Correlation
Claim: The correlation is always between –1 and +1
E ( X *2 ) E ( Y *2 ) 1
0 E ( X * Y * )2 1 1 2E ( X * Y * )
0 E ( X Y ) 1 1 2E ( X Y )
* * 2 * *
1 E ( X Y ) 1
* *
1 Corr( X, Y) 1
= 1 iff Y = aX + b.
Correlation and Independence
X & Y are uncorrelated iff any of the following hold
Cov(X,Y) = 0,
Corr(X,Y) = 0
E(XY) = E(X) E(Y).
In particular, if X and Y are independent they are
uncorrelated.
X2
Example: Let X» N(0,1) and Y = X2, then
Cov(XY) =E(XY) – E(X)E(Y) = E(X3) = 0,
since the density is symmetric.
X
Roll a die N times. Let X be #1’s, Y be #2’s.
Question: What is the correlation between X and Y?
Solution:
To compute the correlation directly from the multinomial
distribution would be difficult. Let’s use a trick:
Var(X+Y) = Var(X) + Var(Y) + 2Cov(X,Y).
Since X+Y is just the number of 1’s or 2’s, X+Y»Binom(p1+p2,N).
Var(X+Y) = (p1+p2)(1 - p1+p2) N.
And X»Binom(p1,N), Y»Binom(p2,N), so
Var(X) =p1(1-p1)N; Var(Y) = p2(1-p2)N.
Correlations in the Multinomial
Distribution
Hence
Cov(X,Y) = (Var(X+Y) – Var(X) – Var(Y))/2
Cov(X,Y) = N((p1+p2)(1 - p1-p2) - p1(1-p1) -p2(1-p2))/2 = -N p1 p2
Np1p2
Np1 (1 p1 ) Np2 (1 p2 )
- p1p2
(1 p1 )(1 p2 )
Proof:
Var(i Xi) = E[i Xi – E(j Xi) ]2
-x = (
i=1
N
x(i))/N - 2)/N
2 = (i=1N (x(i)-x)
are the population mean and population variance.
n 2
2
Var(Xn ) = = SD(Xn ) =
n 2
n n
Variance of the Sample Average
Question: What is the SD for sampling without
replacement? Xn = Sn / n
Solution: Let Sn = X1 + X2 + … + Xn. Then .