Quick viewing(Text Mode)

Variances and Covariances

Variances and Covariances

Page 1

Chapter 4 and

The of a random gives a crude measure of the “center of loca- tion” of the distribution of that . For instance, if the distribution is symmet- ric about a value then the expected value equals . To refine the picture of a distribution distributed about its “center of location” we need some measure of spread (or concentration) around that value. The simplest measure to cal- culate for many distributions is the . There is an enormous body of variance literature that deals with approximations to distributions, and bounds for and expectations, expressible in terms of expected values and variances.

<4.1> Definition. The variance of a random variable X with expected value EX = X is 2 de®ned as var(X) = E (X X ) . The between random variables Y and covariance Z, with expected values Y and Z , is de®ned as cov(Y, Z) = E ((Y Y )(Z Z )). The correlation correlation between Y and Z is de®ned as cov(Y, Z) corr(Y, Z) = q var(Y )var(Z) The root of the variance of a random variable is called its standard . As with expectations, variances and covariances can also be calculated conditionally on various pieces of information. Try not to confuse properties of expected values with properties of variances. For ex- ample, if a given piece of “information” implies that a random variable X must take the con- stant value C then E(X | information) = C, but var(X | information) = 0. More generally, if the information implies that X must equal a constant then cov(X, Y ) = 0 for every random variable Y . (You should check these assertions; they follow directly from the Definition.) Notice that cov(X, X) = var(X). Results about covariances contain results about vari- ances as special cases.

A few facts about variances and covariances

Write Y for EY , and so on, as above. (i) cov(Y, Z) = E(YZ)(EY)(EZ) and, in particular, var(X) = E(X 2) (EX)2:

cov(Y, Z) = E (YZYZZY +YZ)

=E(YZ)YEZZEY +YZ

=E(YZ)YZ (ii) For constants a, b, c, d, and random variables U, V, Y, Z, cov(aU + bV,cY + dZ) =ac cov(U, Y ) + bc cov(V, Y ) + ad cov(U, Z) + bd cov(V, Z)

Statistics 241: 23 September 1997 c David Pollard Chapter 4 Variances and covariances Page 2

It is easier to see the pattern if we work with the centered random variables U 0 = 0 U U , ..., Z = Z Z. For then the left-hand side of the asserted equality expands to E (aU0 + bV 0)(cY 0 + dZ0) =E(acU0Y 0 + bc V 0Y 0 + ad U0Z0 + bd V 0 Z0) = ac E(U0Y 0) + bc E(V 0Y 0) + ad E(U0Z0) + bd E(V 0 Z0) The expected values in the last line correspond to the covariances on the right-hand side of the asserted equality.

As particular cases of fact (ii) we get two useful identities. Put a = b = c = d = 1 and U = Y and V = Z to get var(Y + Z) = var(Y ) + 2cov(Y, Z) + var(Z) It is easy to confuse the formula for var(Y + Z) with the formula for E(Y + Z). When in doubt, rederive. Put U = Y = 1, and a = c, and b = d, and V = Z: var(c + dZ)=d2var(Z) for constants c and d. Notice how the constant c disppeared, and the d turned into d2. Many students confuse the formula for var(c + dZ) with the formula for E(c + dZ). Again, when in doubt, rederive.

You will find it easy to confuse variances with expectations. For example, it is a common blunder for students to confuse the for- mula for the variance of a difference with the formula E(Y Z) = EY EZ. If you ever find yourself wanting to assert that var(Y Z) is equal to var(Y ) var(Z), think again. What would happen if var(Z) were larger than var(Y )? Variances can’t be negative.

Uncorrelated versus independent Two random variables X and Y are said to be independent if “every event determined independent by X is independent of every event determined by Y ”. For example, independence of the random variables implies that the events {X 5} and {5Y 3 + 7Y 2 2Y 2 + 11 0} are independent, and that the events {X even} and {7 Y 18} are independent, and so on. In- dependence of the random variables also implies independence of functions of those random variables. For example, sin(X) must be independent of exp(1 + cosh(Y 2 3Y )), and so on.

<4.2> Example. Suppose a random variable X has a discrete distribution. The expected value E(XY) can then be rewritten as a weighted sum of conditional expectations: X E(XY) = P{X = x}E(XY|X = x) by rule E4 for expectations Xx = xP{X = x}E(Y |X = x). x If Y is independent of X, the information “X = x” does not help with the calculation of the : E(Y | X = x) = E(Y ) if Y is independent of X. The last calculation then simplifies further: X E(XY) = (EY) xP{X = x}=(EY)(EX) if Y independent of X. x It follows that cov(X, Y ) = 0ifY is independent of X.

Statistics 241: 23 September 1997 c David Pollard Chapter 4 Variances and covariances Page 3 uncorrelated ( , ) = A pair of random variables X and Y is said to be if cov X Y uncorrelated 0. The Example shows (at least for the special case where one random variable takes only a discrete set of values) that independent random variables are uncorrelated. The converse assertion—that uncorrelated should imply independent—is not true in general, as shown by the next Example.

<4.3> Example. For two independent rolls of a fair die, let X denote the value rolled the first time and Y denote the value rolled the second time. The random variables X and Y are independent, and they have the same distribution. Consequently cov(X, Y ) = 0, and var(X) = var(Y ). The two random variables X + Y and X Y are uncorrelated: cov(X + Y, X Y ) = cov(X, X) + cov(X, Y ) + cov(Y, X) + cov(Y, Y ) = var(X) cov(X, Y ) + cov(Y, X) var(Y ) = 0. The two random variables X + Y and X Y are not independent: 1 P{X + Y = 12}=P{X=6}P{Y =6}= 36 but P{X + Y = 12 | X Y = 5}=P{X+Y =12 | X = 6, Y = 1}=0

If Y and Z are uncorrelated, the covariance term drops out from the expression for the variance of their sum, leaving var(Y + Z) = var(Y ) + var(Z) for Y and Z uncorrelated.

Similarly, if X1,...,Xn are random variables for which cov(Xi , X j ) = 0 for each i 6= j then

var(X 1 + ...+ Xn)=var(X 1) + ...+var(X n ) for “pairwise uncorrelated” rv’s.

You should check the last assertion by expanding out the quadratic in the variables Xi EXi , observing how all the cross-product terms disappear because of the zero covariances.

Probability bounds Tchebychev’s inequality asserts that if a random variable X has expected value Tchebychev’s inequality then, for each >0, P{|X | >}var(X)/2 The inequality becomes obvious if we define a new random variable Z that takes the value 1 when |X | >, and 0 otherwise: clearly Z |X|2/2, from which it follows that P{|X | >}=EZE|X|2/2. In the Chapter on the you will find more refined probability approx- imations involving the variance. The Tchebychev bound explains an important property of . Suppose 2 X1,...,Xn are uncorrelated random variables, each with expected value and variance . Let X equal the . Its variance decreases like 1/n: ! X X 2 2 2 var(X) = (1/n) var X i = 1/n var(X i ) = /n. in in From the Tchebychev inequality, P{|X | >}( 2/n)/2 for each >0 In particular, for each positive C, √ P{|X | > C/ n}1/C2

Statistics 241: 23 September 1997 c David Pollard Chapter 4 Variances and covariances Page 4 √ For example, there is at most a 1% chance that X lies more than 10/ n away from .(A normal approximation will give a much tighter bound.) Note well the dependence on n.

Variance as a measure of concentration in theory

<4.4> Example. Suppose a finite population of objects (such as human beings) is numbered 1,...,N. Suppose also that to each object there is a quantity of interest (such as annual income): object has the value f () associated with it. The population is f (1) + ...+ f(N) f¯ = N Often one is interested in f¯, but one has neither the time nor the money to carry out a complete of the population to determine each f () value. In such a circumstance, it pays to estimate f¯ using a random sample from the population. random sample The Bureau of the Census uses sampling heavily, in order to estimate properties of the U.S. population. The “long form” of the Decennial Census goes to about 1 in 6 households. It provides a wide of sample regarding both the human population and the hous- ing of the country. It would be an economic and policy disaster if the Bureau were prohibited from using sampling methods. (If you have been following Congress lately you will know why I had to point out this fact.) The mathematically simpler method to sample from a population requires each object to be returned to the population after it is sampled (“sampling with replacement”). It is pos- sible that the same object might be sampled more than once, especially if the sample size is an appreciable fraction of the population size. It is more efficient, however, to sample with- out replacement, as will be shown by calculations of variance.

Consider first a sample X1,...,Xn taken with replacement. The Xi are independent random variables, each taking values 1, 2,...,N with probabilities 1/N. The random vari- = ( ) ables Yi f Xi are also independent,X with ¯ EYi = f ()P{Xi = }= f X X ¯ 2 1 ¯ 2 var(Yi ) = f () f P{Xi = }= f() f N Write 2 for the variance. The sample average, 1 Y = (Y + ...+Y ), n 1 n has expected value 1 EY = (EY + ...+EY )= f¯ (no independence needed here) n 1 n and variance 1 var(Y ) = var(Y + ...+Y ) n2 1 n 1 = (var(Y ) + ...+var(Y )) by independence n2 1 n 2 = n √ The sample average Y concentrates around f¯ with a standard deviation / n that tends to zero as n gets larger.

Now consider a sample X1,...,Xn taken without replacement. By symmetry, each Xi has the same distribution as before, and ¯ 2 EYi = f and var(Yi ) = .

Statistics 241: 23 September 1997 c David Pollard Chapter 4 Variances and covariances Page 5

This time the dependence between the Xi has an important effect on the variance of Y .

By symmetry, for each pair i 6= j, the pair (Xi , X j ) takes each of the N(N 1) values (, ), for 1 6= N, with probabilities 1/N(N 1). Consequently, for i 6= j, X ( , ) = 1 ( () ¯)( () ¯) cov Yi Yj ( ) f f f f N N 1 6=

If we added the ‘diagonal’ terms ( f () f¯)2 to the sum we would have the expansion for X X f () f¯ f () f¯ , P which equals zero because N f¯ = f (). The expression for the covariance simplifies to a ! X 2 1 2 ¯ 2 cov(Yi , Yj ) = 0 ( f () f ) = N(N 1) N1

If N is large, the covariance between any Yi and Yj , for i 6= j, is small; but there a lot of them: 1 var(Y ) = var(Y + ...+Y ) n2 1 n 1 2 = E (Y f¯)+...+(Y f¯) n2 1 n ¯ 2 If you expand out the last quadratic you will get n terms of the form (Yi f ) and n(n 1) ¯ ¯ terms of the form (Yi f )(Yj f ) with i 6= j. Take expectations: 1 var(Y ) = (nvar(Y ) + n(n 1)cov(Y , Y )) 2 1 1 2 n 2 n 1 = 1 n N 1 2 = N n N 1 n 2/ ( ) correction Compare with the n for var Y under sampling with replacement. The correction factor factor (N n)/(N 1) is close to 1 if the sample size n is small compared with the population size N, but it can decrease the variance of Y appreciably if n/N is not small. For example, if n N/6 (as with the Census long form) the correction factor is approxi- mately 5/6. If n = N, the correction factor is zero. That is, var(Y ) = 0 if the whole popu- lation is sampled. Why? What value must Y take if n = N? (As an exercise, see if you can use the fact that var(Y ) = 0 when n = N to rederive the expression for cov(Y1, Y2).)

You could safely skip the rest of this Chapter, at least for the .

zzzzzzzzzzzzzzzz

Variances via conditioning

Suppose F ={F1,F2,...} is a partition of the into disjoint events. Let X be a random variable. Write yi for E(X | Fi ) and vi for 2 2 var(X | Fi ) = E(X | Fi ) (E(X | Fi )) . Define two new random variables by the functions

Y (s) = yi for s ∈ Fi

V (s) = vi for s ∈ Fi

Statistics 241: 23 September 1997 c David Pollard Chapter 4 Variances and covariances Page 6

Notice that E(Y | Fi ) = yi , because Y must take the value yi if the event Fi occurs. By rule E4 for expectations, X EY = E(Y | Fi )PFi Xi = yi PFi Xi = E(X | Fi )PFi i = EX by E4 again Similarly, ( ) = E 2 (E )2 var Y XY Y 2 2 = E(Y | Fi )PFi (EY ) Xi = 2P (E )2 yi Fi X i The random variable V has expectation X EV = E(V | Fi )PFi Xi = vi PFi Xi = E( 2 | ) 2 P X Fi yi Fi i X = E 2 2P X yi Fi i Add, cancelling out the common sum, to get var(Y ) + EV = EX 2 (EX)2 = var(X), a formula that shows how a variance can be calculated using conditioning. When written in more suggestive notation, the conditioning formula takes on a more pleasing appearance. Write E(X | F) for Y and var(X | F) for V . The symbolic “| F” can be thought of as conditioning on the “information one obtains by learning which event in the partition F occurs”. The formula becomes var (E(X | F)) + E (var(X | F)) = var(X) and the equality EY = EX becomes E (E(X | F)) = EX In the special case where the partition is defined by another random variable Z taking values z1, z2,..., that is, Fi ={Z=zi}, then the conditional expectation is usually written as E(X | Z) and the as var(X | Z). The expectation formula becomes E (E(X | Z)) = EX The variance formula becomes var (E(X | Z)) + E (var(X | Z)) = var(X) When I come to make use of the formula I will say more about its interpretation.

Statistics 241: 23 September 1997 c David Pollard