Unit 8, lesson 52

Mean and Variance of the Sample Mean

How the random sample mean differs from a realized average, why it is unbiased for the model mean, how independence makes its variance shrink like one over n, and what standard error and square-root scaling mean.

  • Video 52
  • Averages and Probability Bounds

In a constructed model, each delay at a service desk is 00 or 44 minutes with equal probability, so the model mean is 22 minutes. Suppose that one morning six delays are recorded, 00, 44, 44, 44, 00 and 44, and their average is 8/38/3 of a minute. Does that average show the model is wrong, and how far from 22 should an average of nn delays usually be? This lesson separates the random sample mean from the number one sample produces, shows that the sample mean is centered at the model mean, and finds how its spread shrinks with the sample size when the observations are independent.

Key terms

Realized average

Definition Let X1,…,XnX_1, \dots, X_n, with n≥1n \ge 1, be random variables that record nn observations not yet made. The sample mean is the random variable

Xˉn=1n∑i=1nXi.\bar{X}_n = \frac{1}{n} \sum_{i=1}^{n} X_i .

Once the observations are made and take the values x1,…,xnx_1, \dots, x_n, the realized average is the number

xˉn=1n∑i=1nxi,\bar{x}_n = \frac{1}{n} \sum_{i=1}^{n} x_i ,

which is the value of Xˉn\bar{X}_n for that one outcome. Capital letters stand for random variables and lowercase letters for their observed values.

In plain words The sample mean is a rule applied to data that are still random, so it has a probability distribution. A realized average is the single number the rule returns for one data set. Collecting the data again can give a different realized average.

Example In the delay model each XiX_i is 00 or 44 minutes with probability 12\tfrac12 each, so μ=E[Xi]=2\mu = E[X_i] = 2 minutes and σ2=Var⁡(Xi)=4\sigma^2 = \operatorname{Var}(X_i) = 4 square minutes. The recorded delays above have sum 1616 minutes and realized average

xˉ6=166=83≈2.67\bar{x}_6 = \frac{16}{6} = \frac{8}{3} \approx 2.67

minutes. This number differs from μ=2\mu = 2 without contradicting the model. The value μ\mu is the center of the distribution of Xˉ6\bar{X}_6, not a value that each sample has to reproduce.

Unbiasedness

Definition A statistic TT used to estimate a quantity θ\theta of the model is unbiased for θ\theta if E[T]=θE[T] = \theta for every distribution the model allows. If each XiX_i has the same finite mean μ\mu, linearity of expectation gives

E[Xˉn]=1n∑i=1nE[Xi]=nμn=μ,\begin{aligned} E[\bar{X}_n] &= \frac{1}{n} \sum_{i=1}^{n} E[X_i] \\[0.4em] &= \frac{n\mu}{n} = \mu , \end{aligned}

so the sample mean is unbiased for μ\mu, whatever the value of μ\mu. Linearity holds for dependent as well as independent variables, so this conclusion does not need independence.

In plain words Unbiased means centered. Averaged over all the samples the model can produce, weighted by their probabilities, the sample mean lands on μ\mu. Unbiasedness says nothing about how far one realized average falls from μ\mu, and an unbiased average can still be imprecise when the sample is small or the observations vary a lot.

Example With three independent delays, the sample mean equals 00, 4/34/3, 8/38/3 or 44 minutes with probabilities 18\tfrac18, 38\tfrac38, 38\tfrac38 and 18\tfrac18. Its expectation is

E[Xˉ3]=0⋅18+43⋅38+83⋅38+4⋅18=2,\begin{aligned} E[\bar{X}_3] &= 0 \cdot \tfrac18 + \tfrac43 \cdot \tfrac38 \\[0.4em] &\quad + \tfrac83 \cdot \tfrac38 + 4 \cdot \tfrac18 = 2, \end{aligned}

although no realized average of three delays equals 22. Now copy one delay XX into all three positions. Each position still has mean 22, so the average is still unbiased, but it equals 00 or 44 with probability 12\tfrac12 each.

Variance of the sample mean

Definition Let X1,…,XnX_1, \dots, X_n have finite variances and let Sn=X1+⋯+XnS_n = X_1 + \cdots + X_n. Because Var⁡(cY)=c2Var⁡(Y)\operatorname{Var}(cY) = c^2 \operatorname{Var}(Y) for a constant cc,

Var⁡(Xˉn)=Var⁡(Sn)n2,\operatorname{Var}(\bar{X}_n) = \frac{\operatorname{Var}(S_n)}{n^2},

and the variance of a sum collects every variance and every covariance,

Var⁡(Sn)=∑i=1nVar⁡(Xi)+2∑i<jCov⁡(Xi,Xj).\begin{gathered} \operatorname{Var}(S_n) = \sum_{i=1}^{n} \operatorname{Var}(X_i) \\[0.4em] + 2 \sum_{i<j} \operatorname{Cov}(X_i, X_j). \end{gathered}

If the XiX_i are independent, or merely uncorrelated, every covariance is 00. If in addition they share the variance σ2\sigma^2, as IID observations with finite variance do, then Var⁡(Sn)=nσ2\operatorname{Var}(S_n) = n\sigma^2 and

Var⁡(Xˉn)=nσ2n2=σ2n.\operatorname{Var}(\bar{X}_n) = \frac{n\sigma^2}{n^2} = \frac{\sigma^2}{n}.

In plain words Dividing by nn divides the variance by n2n^2, while adding nn uncorrelated observations with a common variance multiplies that variance only by nn, so the variance of the average is the single-observation variance divided by nn. Independence does its work by removing the covariance terms. Positive covariances add variance back, and identical distributions alone do not remove them.

Example For two independent delays, the ordered samples (0,0)(0, 0), (0,4)(0, 4), (4,0)(4, 0) and (4,4)(4, 4) are equally likely and have averages 00, 22, 22 and 44. So Var⁡(Xˉ2)=14⋅4+12⋅0+14⋅4=2\operatorname{Var}(\bar{X}_2) = \tfrac14 \cdot 4 + \tfrac12 \cdot 0 + \tfrac14 \cdot 4 = 2, which is 4/24/2. For four independent delays the average equals the number of 44-minute delays, a Bin⁡(4,12)\operatorname{Bin}(4, \tfrac12) count, so it takes the values 00 to 44 with probabilities 116\tfrac{1}{16}, 416\tfrac{4}{16}, 616\tfrac{6}{16}, 416\tfrac{4}{16} and 116\tfrac{1}{16}, and its variance is 1=4/41 = 4/4. If instead one delay XX is copied into all nn positions, every covariance equals Var⁡(X)=4\operatorname{Var}(X) = 4, and

Var⁡(Xˉn)=4n+4n(n−1)n2=4\begin{aligned} \operatorname{Var}(\bar{X}_n) &= \frac{4n + 4n(n - 1)}{n^2} \\[0.4em] &= 4 \end{aligned}

for every nn, as it must be, since then Xˉn=X\bar{X}_n = X.

Standard error of the mean

Definition The standard error of the sample mean is its standard deviation,

SE⁡(Xˉn)=SD⁡(Xˉn)=Var⁡(Xˉn).\begin{aligned} \operatorname{SE}(\bar{X}_n) &= \operatorname{SD}(\bar{X}_n) \\[0.4em] &= \sqrt{\operatorname{Var}(\bar{X}_n)} . \end{aligned}

For IID observations with finite standard deviation σ\sigma it equals

SE⁡(Xˉn)=σn.\operatorname{SE}(\bar{X}_n) = \frac{\sigma}{\sqrt{n}} .

When the observations share the mean μ\mu, so that E[Xˉn]=μE[\bar{X}_n] = \mu, the square of the standard error is E[(Xˉn−μ)2]E\bigl[(\bar{X}_n - \mu)^2\bigr], the mean squared error of the sample mean as an estimate of μ\mu. Here σ\sigma comes from a fully specified model. When σ\sigma is estimated from data, the result is an estimate of the standard error.

In plain words The standard error is the typical size of the miss Xˉn−μ\bar{X}_n - \mu across repeated samples, measured as a root mean square. It describes averages, not single observations, whose standard deviation stays σ\sigma however many are collected. It is not a maximum error. Unless the miss has the same size on every outcome, some samples miss by more than one standard error.

Example For IID delays the standard error is 2/n2/\sqrt{n} minutes, which is 0.40.4 minutes at n=25n = 25 and 0.20.2 minutes at n=100n = 100, while each delay still has standard deviation 22 minutes. At n=4n = 4 the standard error is 11 minute, and the miss ∣Xˉ4−2∣\lvert \bar{X}_4 - 2 \rvert equals 00, 11 or 22 minutes with probabilities 38\tfrac38, 12\tfrac12 and 18\tfrac18. So the miss exceeds one standard error with probability 18\tfrac18. The inequality in an accuracy question matters too, because

P(∣Xˉ4−2∣≤1)=78,P(∣Xˉ4−2∣<1)=38,\begin{gathered} P(\lvert \bar{X}_4 - 2 \rvert \le 1) = \tfrac78, \\[0.4em] P(\lvert \bar{X}_4 - 2 \rvert < 1) = \tfrac38, \end{gathered}

and the difference is the probability 12\tfrac12 that sits on the boundary values 11 and 33.

Square-root scaling

Definition For IID observations with standard deviation σ>0\sigma > 0, the standard error σ/n\sigma/\sqrt{n} is proportional to 1/n1/\sqrt{n}. Multiplying the sample size by a factor c>0c > 0, with cncn a whole number, divides the standard error by c\sqrt{c}, so dividing the standard error by k>0k > 0 takes k2k^2 times as many observations. A target s>0s > 0 is met, meaning σ/n≤s\sigma/\sqrt{n} \le s, exactly when

n≥σ2s2.n \ge \frac{\sigma^2}{s^2}.

If σ=0\sigma = 0, every observation equals μ\mu with probability 11 and the standard error is 00 for every nn.

In plain words Precision gets more expensive as it improves. Each halving of the standard error costs four times as many independent observations, so doubling the sample size reduces the standard error by a factor of only about 1.411.41.

Example For the delays the standard error is 0.40.4, 0.20.2 and 0.10.1 minutes at n=25n = 25, 100100 and 400400. Each step multiplies nn by 44 and halves the standard error. A standard error of at most 0.10.1 minutes needs n≥4/0.01=400n \ge 4/0.01 = 400. Doubling nn from 2525 to 5050 gives 2/50≈0.282/\sqrt{50} \approx 0.28 minutes, not 0.20.2. The scaling counts independent observations, and nn copies of one delay keep the standard error at 22 minutes for every nn.

Check yourself

  1. IID measurements have mean 1212 units and standard deviation 66 units. Find the mean, the variance and the standard error of Xˉn\bar{X}_n for n=9n = 9 and for n=36n = 36. How many observations make the standard error at most 11 unit?
Show the answer

The mean of Xˉn\bar{X}_n is 1212 for both sample sizes. The variance of one measurement is 62=366^2 = 36 square units, so Var⁡(Xˉ9)=36/9=4\operatorname{Var}(\bar{X}_9) = 36/9 = 4 and SE⁡(Xˉ9)=2\operatorname{SE}(\bar{X}_9) = 2 units, while Var⁡(Xˉ36)=36/36=1\operatorname{Var}(\bar{X}_{36}) = 36/36 = 1 and SE⁡(Xˉ36)=1\operatorname{SE}(\bar{X}_{36}) = 1 unit. The condition 6/n≤16/\sqrt{n} \le 1 means n≥36n \ge 36, so 3636 observations are the fewest that suffice. Using 66 as the variance would give the wrong standard error 6/9≈0.82\sqrt{6/9} \approx 0.82 for n=9n = 9.

  1. In the same model, a technician makes one measurement XX and enters it 3636 times. Is the average of the 3636 entries unbiased for 1212? What is its standard error, and why does the answer to question 1 not apply?
Show the answer

Each entry equals XX, so the average equals XX and its mean is 1212. It is unbiased, because linearity of expectation does not need independence. Its standard error is SD⁡(X)=6\operatorname{SD}(X) = 6 units, not 11. In the covariance formula every pair has Cov⁡(Xi,Xj)=Var⁡(X)=36\operatorname{Cov}(X_i, X_j) = \operatorname{Var}(X) = 36, so

Var⁡(S36)=36⋅36+2⋅630⋅36=46656,\begin{aligned} \operatorname{Var}(S_{36}) &= 36 \cdot 36 \\[0.4em] &\quad + 2 \cdot 630 \cdot 36 \\[0.4em] &= 46656 , \end{aligned}

using (362)=630\binom{36}{2} = 630 pairs, and Var⁡(Xˉ36)=46656/362=36\operatorname{Var}(\bar{X}_{36}) = 46656/36^2 = 36. The formula σ2/n\sigma^2/n assumes zero covariances, and copies of one measurement carry no new information.

  1. Three observations are independent, and each equals 33 with probability 13\tfrac13 and 00 otherwise. Find the distribution, the mean, the variance and the standard error of Xˉ3\bar{X}_3. How likely is the miss ∣Xˉ3−1∣\lvert \bar{X}_3 - 1 \rvert to exceed the standard error? Compare P(∣Xˉ3−1∣≤1)P(\lvert \bar{X}_3 - 1 \rvert \le 1) with P(∣Xˉ3−1∣<1)P(\lvert \bar{X}_3 - 1 \rvert < 1).
Show the answer

One observation has mean 3⋅13=13 \cdot \tfrac13 = 1 and variance 9⋅13−12=29 \cdot \tfrac13 - 1^2 = 2. Let K∼Bin⁡(3,13)K \sim \operatorname{Bin}(3, \tfrac13) count the observations equal to 33. The sum is 3K3K, so Xˉ3=K\bar{X}_3 = K, which takes the values 00, 11, 22 and 33 with probabilities 827\tfrac{8}{27}, 1227\tfrac{12}{27}, 627\tfrac{6}{27} and 127\tfrac{1}{27}. Its mean is 11, and its variance is σ2/n=2/3\sigma^2/n = 2/3, which agrees with the direct calculation E[(K−1)2]=(8+0+6+4)/27=18/27E[(K - 1)^2] = (8 + 0 + 6 + 4)/27 = 18/27. The standard error is 2/3≈0.816\sqrt{2/3} \approx 0.816. The miss ∣K−1∣\lvert K - 1 \rvert is 00 when K=1K = 1 and at least 11 otherwise, so it exceeds 0.8160.816 with probability 1−1227=591 - \tfrac{12}{27} = \tfrac59, more than half the time. Finally P(∣Xˉ3−1∣≤1)=1−127=2627P(\lvert \bar{X}_3 - 1 \rvert \le 1) = 1 - \tfrac{1}{27} = \tfrac{26}{27}, while P(∣Xˉ3−1∣<1)=P(K=1)=49P(\lvert \bar{X}_3 - 1 \rvert < 1) = P(K = 1) = \tfrac49, because the values 00 and 22 sit exactly on the boundary.

How this lesson connects