Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

When the random variables that are being added are not independent, finding the variance of the sum does involve finding covariances. As before, let X1,X2,XnX_1, X_2, \ldots X_n be random variables with sum

Sn=i=1nXiS_n = \sum_{i=1}^n X_i

The variance of the sum is

Var(Sn) = i=1nVar(Xi)+1ijnCov(Xi,Xj)Var(S_n) ~ = ~ \sum_{i=1}^n Var(X_i) + \mathop{\sum \sum}_{1 \le i \ne j \le n} Cov(X_i, X_j)

There are nn variance terms in the first sum on the right hand side, and n(n1)n(n-1) covariance terms. That’s a lot of variances and covariances to calculate. Finding the variance of a sum of dependent random variables can require effort.

But if there is symmetry in the joint distribution of X1,X2,,XnX_1, X_2, \ldots, X_n, that is, if all the variances are equal and all the covariances are equal, then

Var(Sn) = nVar(X1)+n(n1)Cov(X1,X2)Var(S_n) ~ = ~ nVar(X_1) + n(n-1)Cov(X_1, X_2)

That looks much simpler. In the examples below we will see a couple of different ways of using this simple form when we have symmetry.

Before we apply the formula, let’s start out by finding the covariance of two indicators. We will need this when we find the variance of a sum of indicators.

🎥 See More
Loading...

13.4.1Indicators

Let AA and BB be two events. Let IAI_A be the indicator of AA and let IBI_B be the indicator of BB. This is going to be one of the rare instances where we use an expected product to find a covariance. That’s because we know that products of indicators are themselves indicators.

Cov(IA,IB)=E(IAIB)E(IA)E(IB)=P(AB)P(A)P(B)Cov(I_A, I_B) = E(I_AI_B) - E(I_A)E(I_B) = P(AB) - P(A)P(B)

You can see that the covariance is 0 if AA and BB are independent, consistent with the more general result earlier in this chapter.

When AA and BB are not independent, covariance helps us understand the nature of the dependence. For example, if Cov(IA,IB)Cov(I_A, I_B) is positive, then

P(AB)>P(A)P(B)          P(A)P(BA)>P(A)P(B)          P(BA)>P(B)P(AB) > P(A)P(B) ~~~ \implies ~~~ P(A)P(B \mid A) > P(A)P(B) ~~~ \implies ~~~ P(B \mid A) > P(B)

Given that AA has occurred, the chance of BB is higher than it is overall. This is called positive association or positive dependence of AA and BB.

13.4.2Example: Number of Classes

Suppose you draw nn times at random from a population that is evenly split between several classes. For example, this could be a model for the birth months of nn people if each person is equally likely to be born in any of the 12 months of the year independent of the births of all others. You can model this as drawing nn times at random with replacement from the 12 months.

Suppose we want to find the expectation and variance of the number of classes that appear in the sample, that is, the number of months that appear.

Let XX be the number of months that appear in the sample. You will have noticed by now that it is often easier to deal with the months that don’t appear. So let YY be the number of months that don’t appear. Then X=12YX = 12-Y, and so E(X)=12E(Y)E(X) = 12 - E(Y) and Var(X)=Var(Y)Var(X) = Var(Y).

To find E(Y)E(Y), write YY as a sum of indicators: Y=I1+I2++I12Y = I_1 + I_2 + \cdots + I_{12} where IjI_j is the indicator of the event that Month jj doesn’t appear.

Now E(Ij)=P(month j doesn’t appear)=(1112)nE(I_j) = P(\text{month } j \text{ doesn't appear}) = \big( \frac{11}{12} \big)^n is the same for all jj. By the additivity of expectation,

E(Y) = 12E(I1) = 12(1112)nE(Y) ~ = ~ 12E(I_1) ~ = ~ 12\big( \frac{11}{12} \big)^n

So E(X)=1212(1112)nE(X) = 12 - 12\big( \frac{11}{12} \big)^n.

Since IjI_j is an indicator, Var(Ij)=(1112)n(1(1112)n)Var(I_j) = \big( \frac{11}{12} \big)^n\big(1 - \big( \frac{11}{12} \big)^n\big) for all jj.

By the formula for the covariance of two indicators, for iji \ne j

Cov(Ii,Ij) = P(months i and j don’t appear)(1112)n(1112)n= (1012)n(1112)n(1112)n\begin{align*} Cov(I_i, I_j) ~ &= ~ P(\text{months } i \text{ and } j \text{ don't appear}) - \big( \frac{11}{12} \big)^n\big( \frac{11}{12} \big)^n \\ &= ~ \big( \frac{10}{12} \big)^n - \big( \frac{11}{12} \big)^n\big( \frac{11}{12} \big)^n \end{align*}

Put all this together to get

Var(X) = Var(Y) =12Var(I1)+1211Cov(I1,I2)= 12(1112)n(1(1112)n) + 1211((1012)n(1112)n(1112)n)\begin{align*} Var(X) ~ = ~ Var(Y) ~ &= 12Var(I_1) + 12 \cdot 11 \cdot Cov(I_1, I_2) \\ &= ~ 12\big( \frac{11}{12} \big)^n\big(1 - \big( \frac{11}{12} \big)^n\big) ~ + ~ 12 \cdot 11 \cdot \Big( \big( \frac{10}{12} \big)^n - \big( \frac{11}{12} \big)^n\big( \frac{11}{12} \big)^n \Big) \end{align*}
🎥 See More
Loading...

13.4.3Variance of a Simple Random Sample Sum

Suppose we have a numerical population of size NN, and let the population have mean μ\mu and standard deviation σ\sigma. Draw a simple random sample of size nn from the population. For jj in the range 1 through nn, let XjX_j be the jjth value drawn.

Let Sn=X1+X2++XnS_n = X_1 + X_2 + \cdots + X_n. Then by the symmetry of the joint distribution of X1,X2,,XnX_1, X_2, \cdots, X_n we know that E(Sn)=nμE(S_n) = n\mu.

Also by symmetry,

Var(Sn) = nVar(X1)+n(n1)Cov(X1,X2) = nσ2+n(n1)Cov(X1,X2)Var(S_n) ~ = ~ nVar(X_1) + n(n-1)Cov(X_1, X_2) ~ = ~ n\sigma^2 + n(n-1)Cov(X_1, X_2)

How can we find Cov(X1,X2)Cov(X_1, X_2)? It’s not a good idea to try and multiply the two variables, as they are dependent and their distributions might be unpleasant. The expected product will be hard to find.

Instead, we will solve for the covariance by using the equation above in a special case where we already know the variance on the left hand side.

The equation above for Var(Sn)Var(S_n) is valid for any sample size nn. In particular, it is valid in the case when we take a census, that is, when we sample all the elements of the population. In that case n=Nn = N and the equation is

Var(SN)=Nσ2+N(N1)Cov(X1,X2)Var(S_N) = N\sigma^2 + N(N-1)Cov(X_1, X_2)

Why is helpful? To answer this, think about the variability in SNS_N. We have sampled the entire population without replacement. Therefore SNS_N is just the total of the entire population. There is no sampling variability in SNS_N, because there is only one possible sample of size NN.

That means Var(SN)=0Var(S_N) = 0. We can use this to solve for Cov(X1,X2)Cov(X_1, X_2).

0=Nσ2+N(N1)Cov(X1,X2)              Cov(X1,X2)=σ2N10 = N\sigma^2 + N(N-1)Cov(X_1, X_2) ~~~~~ \implies ~~~~~ Cov(X_1, X_2) = -\frac{\sigma^2}{N-1}

Now plug this into the formula for Var(Sn)Var(S_n) for any smaller sample size nn.

Var(Sn) = nσ2n(n1)σ2N1 = nσ2(1n1N1) = nσ2NnN1Var(S_n) ~ = ~ n\sigma^2 - n(n-1)\frac{\sigma^2}{N-1} ~ = ~ n\sigma^2 \Big( 1 - \frac{n-1}{N-1} \Big) ~ = ~ n\sigma^2 \frac{N-n}{N-1}

Recall that when the sample is drawn with replacement, the variance of the sample sum is nσ2n\sigma^2. When the sample is drawn without replacement, the formula is the same apart from the factor of NnN1\frac{N-n}{N-1}. In the next section we will examine this factor.

🎥 See More
Loading...

13.4.4Example: Variance of the Hypergeometric

A important special case is when the numbers in the population are either 0 or 1. This models the situation in which some of the elements in the population are “good” and we are counting the number of good elements in a simple random sample.

If the population consists of NN elements of which GG are labeled 1, then

  • the population mean μ=GN\mu = \frac{G}{N}, and

  • the population variance σ2=GNBN\sigma^2 = \frac{G}{N}\cdot\frac{B}{N} where B=NGB = N-G is the number of “bad” elements in the population.

Let XX be the number of good elements in simple random sample of nn elements drawn from the population. Remember that simple random samples are drawn without replacement, and that XX has the hypergeometric (N,G,n)(N, G, n) distribution.

Let IjI_j be the indicator that Draw jj yields a good element. Then X=j=1nIjX = \sum_{j=1}^n I_j is the sum of a simple random sample drawn from the population of 0s and 1s. By plugging into the formulas derived above,

E(X) = nGN     Var(X) = nGNBN(NnN1)E(X) ~ = ~ n\frac{G}{N} ~~~~~ Var(X) ~ = ~ n \frac{G}{N} \cdot \frac{B}{N} \cdot \Big( \frac{N-n}{N-1} \Big)

These formulas for the hypergeometric expectation and variace are almost the same as for the binomial when the sampling was done with replacement. The only difference is in the variance formula, where instead of just npqnpq we have another factor of NnN1\frac{N-n}{N-1}.

As an exercise, you should write XX as a sum of indicators and then use the methods of the first example in this section to find Var(X)Var(X). Be warned that some algebra is required to get it into the compact form given above.