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.

After the dry, algebraic discussion of the previous section it is a relief to finally be able to compute some variances.

🎥 See More
Loading...

13.3.1The Variance of a Sum

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)=Cov(Sn,Sn)=i=1nj=1nCov(Xi,Xj)    (bilinearity)=i=1nVar(Xi)+1ijnCov(Xi,Xj)\begin{align*} Var(S_n) &= Cov(S_n, S_n) \\ &= \sum_{i=1}^n\sum_{j=1}^n Cov(X_i, X_j) ~~~~ \text{(bilinearity)} \\ &= \sum_{i=1}^n Var(X_i) + \mathop{\sum \sum}_{1 \le i \ne j \le n} Cov(X_i, X_j) \end{align*}

We say that the variance of the sum is the sum of all the variances and all the covariances.

  • The first sum has nn terms.

  • The second sum has n(n1)n(n-1) terms.

Since Cov(Xi,Xj)=Cov(Xj,Xi)Cov(X_i, X_j) = Cov(X_j, X_i), the second sum can be written as 21i<jnCov(Xi,Xj)2\mathop{\sum \sum}_{1 \le i < j \le n} Cov(X_i, X_j). But we will use the form given above.

13.3.2Sum of Independent Random Variables

If X1,X2,XnX_1, X_2 \ldots , X_n are independent, then all the covariance terms in the formula above are 0.

Therefore if X1,X2,,XnX_1, X_2, \ldots, X_n are independent, then

Var(Sn)=i=1nVar(Xi)Var(S_n) = \sum_{i=1}^n Var(X_i)

Thus for independent random variables X1,X2,,XnX_1, X_2, \ldots, X_n, both the expectation and the variance add up nicely:

E(Sn)=i=1nE(Xi),      Var(Sn)=i=1nVar(Xi)E(S_n) = \sum_{i=1}^n E(X_i), ~~~~~~ Var(S_n) = \sum_{i=1}^n Var(X_i)

When the random variables are i.i.d., this simplifies even further.

🎥 See More
Loading...

13.3.3Sum of an IID Sample

Let X1,X2,,XnX_1, X_2, \ldots, X_n be i.i.d., each with mean μ\mu and SDSD σ\sigma. You can think of X1,X2,,XnX_1, X_2, \ldots, X_n as draws at random with replacement from a population, or the results of independent replications of the same experiment.

Let SnS_n be the sample sum, as above. Then

E(Sn)=nμ          Var(Sn)=nσ2          SD(Sn)=nσE(S_n) = n\mu ~~~~~~~~~~ Var(S_n) = n\sigma^2 ~~~~~~~~~~ SD(S_n) = \sqrt{n}\sigma

This implies that as the sample size nn increases, the distribution of the sum SnS_n shifts to the right and is more spread out. The expectation goes up linearly in nn, but the SD goes up more slowly.

Here is an important application of the formula for the variance of an i.i.d. sample sum.

13.3.4Variance of the Binomial

Let XX have the binomial (n,p)(n, p) distribution. We know that

X=j=1nIjX = \sum_{j=1}^n I_j

where I1,I2,,InI_1, I_2, \ldots, I_n are i.i.d. indicators, each taking the value 1 with probability pp. Each of these indicators has expectation pp and variance pq=p(1p)pq = p(1-p). Therefore

E(X)=np          Var(X)=npq          SD(X)=npqE(X) = np ~~~~~~~~~~ Var(X) = npq ~~~~~~~~~~ SD(X) = \sqrt{npq}

For example, if XX is the number of heads in 100 tosses of a coin, then

E(X)=100×0.5=50          SD(X)=100×0.5×0.5=5E(X) = 100 \times 0.5 = 50 ~~~~~~~~~~ SD(X) = \sqrt{100 \times 0.5 \times 0.5} = 5

Here is the distribution of XX. You can see that there is almost no probability outside the range E(X)±3SD(X)E(X) \pm 3SD(X).

k = np.arange(25, 75, 1)
binom_probs = stats.binom.pmf(k, 100, 0.5)
binom_dist = Table().values(k).probabilities(binom_probs)
Plot(binom_dist, show_ev=True, show_sd=True)
<Figure size 432x288 with 1 Axes>
🎥 See More
Loading...

13.3.5Variance of the Poisson, Revisited

We showed earlier that if XX has the Poisson (μ)(\mu) distribution then E(X)=μE(X) = \mu, Var(X)=μVar(X) = \mu, and SD(X)=μSD(X) = \sqrt{\mu}. Now we have a way to understand the formula for the SD.

One way in which a Poisson (μ)(\mu) distribution can arise is as an approximation to a binomial (n,p)(n, p) distribution where nn is large, pp is small, and np=μnp = \mu. The expectation of the binomial becomes the parameter of the approximating Poisson distribution, which is also the expectation of the Poisson.

Now let’s compare the standard deviations. The standard deviation of the binomial is

npq  np    because the small p implies q1\sqrt{npq} ~ \approx ~ \sqrt{np} ~~~ \text{ because the small } p \text{ implies } q \approx 1

But np=μnp = \mu in this setting, so the SD of the binomial is approximately μ\sqrt{\mu}. That’s the SD of its approximating Poisson (μ)(\mu) distribution.