From STA238: Probability, Statistics and Data Analysis II

Confidence Intervals

A single number hides its own uncertainty. Reporting that the mean failure time is 649 CPU seconds says nothing about whether the truth is plausibly 600 or plausibly 400. A confidence interval reports a range together with a statement about how often that procedure captures the parameter.

Definition. Let α(0,1)\alpha \in (0,1). The interval (n,un)(\ell_n, u_n), where n=g(x1,,xn)\ell_n = g(x_1, \dots, x_n) and un=h(x1,,xn)u_n = h(x_1, \dots, x_n), is a 100(1α)%100(1-\alpha)\% confidence interval for θ\theta if the corresponding random variables Ln=g(X1,,Xn)L_n = g(X_1, \dots, X_n) and Un=h(X1,,Xn)U_n = h(X_1, \dots, X_n) satisfy P(Ln<θ<Un)=1αP(L_n < \theta < U_n) = 1 - \alpha for every value of θ\theta. If P(Ln<θ<Un)1αP(L_n < \theta < U_n) \ge 1-\alpha, the interval is conservative.

1α1-\alpha is the confidence level, α\alpha is the significance level.

Which symbols are random is the whole subject and it is examined directly.

  • Random: LnL_n and UnU_n, because they are functions of the random sample.
  • Not random: θ\theta, which is a fixed unknown constant; α\alpha, which you chose; and n,un\ell_n, u_n, which are numbers computed from data already in hand.

1. The pivot

Constructing an interval means finding a quantity whose distribution is known even though θ\theta is not.

Definition. A pivot is a random variable that (1) depends only on the random sample and the parameter of interest θ\theta, and not on any other parameter, and (2) has a distribution that does not depend on θ\theta or on any other unknown parameter.

The two conditions do different work. The first makes θ\theta the only unknown in the expression, so it can be isolated. The second makes the probability statement usable, since a distribution depending on the unknown could not supply numerical quantiles.

The standard pivot for a normal mean with known variance is

Xˉnθσ/nN(0,1)\frac{\bar{X}_n - \theta}{\sigma/\sqrt{n}} \sim \mathcal{N}(0,1)

It contains Xˉn\bar{X}_n and θ\theta and nothing else unknown, and its distribution is standard normal regardless of what θ\theta is.

Critical values

Definition. zpz_p is the critical value of the standard normal satisfying P(Z>zp)=pP(Z > z_p) = p. Equivalently zpz_p is the (1p)(1-p)th quantile. By symmetry, z1p=zpz_{1-p} = -z_p.

For a 95% interval, α=0.05\alpha = 0.05 and zα/2=z0.025z_{\alpha/2} = z_{0.025} is the 0.975 quantile, which is qnorm(0.975) =1.959964= 1.959964, usually written 1.96.

2. Inversion: turning a probability statement into an interval

The derivation below is the one to be able to reproduce. Every interval in the course is this argument with a different pivot.

Start from the pivot and its known distribution. By construction, the middle 1α1-\alpha of a standard normal lies between zα/2-z_{\alpha/2} and zα/2z_{\alpha/2}:

P(zα/2<Xˉnθσ/n<zα/2)=1αP\left(-z_{\alpha/2} < \frac{\bar{X}_n - \theta}{\sigma/\sqrt{n}} < z_{\alpha/2}\right) = 1-\alpha

Now isolate θ\theta inside the inequality, one operation at a time.

Multiply through by σ/n\sigma/\sqrt{n}, which is positive so the inequalities are unchanged:

P(zα/2σn<Xˉnθ<zα/2σn)=1αP\left(-z_{\alpha/2}\frac{\sigma}{\sqrt{n}} < \bar{X}_n - \theta < z_{\alpha/2}\frac{\sigma}{\sqrt{n}}\right) = 1-\alpha

Subtract Xˉn\bar{X}_n throughout:

P(Xˉnzα/2σn<θ<Xˉn+zα/2σn)=1αP\left(-\bar{X}_n - z_{\alpha/2}\frac{\sigma}{\sqrt{n}} < -\theta < -\bar{X}_n + z_{\alpha/2}\frac{\sigma}{\sqrt{n}}\right) = 1-\alpha

Multiply by 1-1, which reverses both inequalities:

P(Xˉnzα/2σn<θ<Xˉn+zα/2σn)=1αP\left(\bar{X}_n - z_{\alpha/2}\frac{\sigma}{\sqrt{n}} < \theta < \bar{X}_n + z_{\alpha/2}\frac{\sigma}{\sqrt{n}}\right) = 1-\alpha

Comparing with the definition, Ln=Xˉnzα/2σnL_n = \bar{X}_n - z_{\alpha/2}\frac{\sigma}{\sqrt{n}} and Un=Xˉn+zα/2σnU_n = \bar{X}_n + z_{\alpha/2}\frac{\sigma}{\sqrt{n}}. Substituting the observed xˉn\bar{x}_n gives the realized interval

(xˉnzα/2σn, xˉn+zα/2σn)\left(\bar{x}_n - z_{\alpha/2}\frac{\sigma}{\sqrt{n}},\ \bar{x}_n + z_{\alpha/2}\frac{\sigma}{\sqrt{n}}\right)

Sign-flipping on the multiplication by 1-1 is where this derivation is usually lost. For a symmetric pivot the two errors cancel and the answer still looks right, which is why it survives; for the chi-squared pivot below it does not.

3. The four intervals for a mean

Which construction applies depends on what you know. The decision is a two-question tree: is the data normal, and is σ\sigma known.

Chebyshev, when nothing is known about the shape

Applicable to any distribution with finite mean and variance. Recall Chebyshev’s inequality: P(YE[Y]ε)Var(Y)/ε2P(|Y - \mathbb{E}[Y]| \ge \varepsilon) \le \mathrm{Var}(Y)/\varepsilon^2.

Applied to Xˉn\bar{X}_n, which has mean θ\theta and variance σ2/n\sigma^2/n:

P(Xˉnθ<ε)1σ2nε2P\left(|\bar{X}_n - \theta| < \varepsilon\right) \ge 1 - \frac{\sigma^2}{n\varepsilon^2}

Set the right side to 1α1-\alpha and solve for ε\varepsilon.

Worked example: a conservative 80% interval. Set 1σ2nε2=0.81 - \frac{\sigma^2}{n\varepsilon^2} = 0.8, so σ2nε2=0.2\frac{\sigma^2}{n\varepsilon^2} = 0.2 and

ε2=σ20.2n=5σ2n,ε=5σ2n\varepsilon^2 = \frac{\sigma^2}{0.2n} = \frac{5\sigma^2}{n}, \qquad \varepsilon = \sqrt{\frac{5\sigma^2}{n}}

giving the interval

(xˉn5σ2n, xˉn+5σ2n)\left(\bar{x}_n - \sqrt{\frac{5\sigma^2}{n}},\ \bar{x}_n + \sqrt{\frac{5\sigma^2}{n}}\right)

The statement is that we are at least 80% confident, since Chebyshev gives an inequality rather than an equality. That is what makes it conservative: the true coverage is at least the stated level and usually much more, so the interval is wider than necessary.

Normal data, known variance

The construction derived above:

(xˉnzα/2σn, xˉn+zα/2σn)\left(\bar{x}_n - z_{\alpha/2}\frac{\sigma}{\sqrt{n}},\ \bar{x}_n + z_{\alpha/2}\frac{\sigma}{\sqrt{n}}\right)

Normal data, unknown variance

σ\sigma is almost never known. Replacing it with the sample standard deviation SnS_n puts a random quantity in the denominator, so the pivot is no longer standard normal:

XˉnθSn/nt(n1)\frac{\bar{X}_n - \theta}{S_n/\sqrt{n}} \sim t(n-1)

This is the studentized mean, as against the standardized mean which divides by the known σ\sigma. The extra randomness makes the distribution more spread out than a normal, so the correct critical values come from t(n1)t(n-1):

(xˉntn1,α/2snn, xˉn+tn1,α/2snn)\left(\bar{x}_n - t_{n-1,\alpha/2}\frac{s_n}{\sqrt{n}},\ \bar{x}_n + t_{n-1,\alpha/2}\frac{s_n}{\sqrt{n}}\right)

Because tt has heavier tails than the normal, tn1,α/2>zα/2t_{n-1,\alpha/2} > z_{\alpha/2}, so the interval is wider. That extra width is the price of not knowing σ\sigma, and the effect vanishes as nn grows.

The interval depends on neither the mean nor the variance of the data-generating distribution, which is what makes it computable.

Large sample, unknown distribution

If the data are not normal but nn is large, the central limit theorem gives

XˉnθSn/n ˙ N(0,1)\frac{\bar{X}_n - \theta}{S_n/\sqrt{n}} \ \dot\sim\ \mathcal{N}(0,1)

approximately, so

(xˉnzα/2snn, xˉn+zα/2snn)\left(\bar{x}_n - z_{\alpha/2}\frac{s_n}{\sqrt{n}},\ \bar{x}_n + z_{\alpha/2}\frac{s_n}{\sqrt{n}}\right)

is an approximate interval. Note the combination: sns_n in place of σ\sigma, but the normal critical value rather than the tt one, because the justification here is the central limit theorem rather than an exact distributional result.

The fifth case, a small sample from an unknown distribution, is the bootstrap.

The comparison, on one data set

100 simulated observations from N(0,1)\mathcal{N}(0,1), with xˉn=0.206\bar{x}_n = -0.206:

Method95% intervalWidth
Normal, σ\sigma known(0.402, 0.010)(-0.402,\ -0.010)0.392
t(n1)t(n-1), σ\sigma unknown(0.414,  0.003)(-0.414,\ \ 0.003)0.417
CLT with sns_n(0.412,  0.000)(-0.412,\ \ 0.000)0.412
Bootstrap(0.410,  0.019)(-0.410,\ \ 0.019)0.429

Every interval that estimates the variance is wider than the one that knows it. Uncertainty about σ\sigma propagates into uncertainty about θ\theta.

4. Interpretation

This is the most-tested conceptual point in the course, and the tempting reading is wrong.

The correct statement. Before the data are seen, LnL_n and UnU_n are random and θ\theta is fixed, so

P(Ln<θ<Un)=1αP(L_n < \theta < U_n) = 1-\alpha

is a genuine probability statement about a random interval. Its meaning is a frequency across repeated sampling: 95% of all possible samples of size nn yield an interval containing the true θ\theta, and 5% yield one that does not.

Why the realized interval is different. Once you compute n=2\ell_n = 2 and un=5u_n = 5, nothing in the statement "2<θ<52 < \theta < 5" is random. θ\theta is a fixed constant and so are 2 and 5. The statement is either true or false, and no probability attaches to it. You cannot know which, but that is ignorance, not randomness.

So these are all wrong for a realized interval (2,5)(2,5):

  1. “95% of all samples will yield a sample mean between 2 and 5.”
  2. “The true mean is between 2 and 5 with 95% probability.”
  3. “There is a 95% chance the true mean is between 2 and 5.”
  4. “There is a 95% chance that the interval 2 to 5 includes the true mean.”

Statement 1 confuses the distribution of θ\theta with the distribution of Xˉn\bar{X}_n. Statements 2 and 3 assign a probability to a fixed constant. Statement 4 is the subtle one: moving the “chance” onto the interval does not help, because the realized interval is also fixed.

The approved form uses the word confidence rather than probability: we are 95% confident that the true value of θ\theta lies between n\ell_n and unu_n. The confidence attaches to the procedure, not to the particular numbers it produced.

Fifty simulated 95% intervals from N(0,1)\mathcal{N}(0,1) data illustrate it: each interval either contains 0 or does not, and roughly two or three of the fifty miss.

5. Sample size and precision

nn appears in every interval through n\sqrt{n} in the denominator, so wider samples give narrower intervals. The width shrinks like 1/n1/\sqrt{n}, so quartering the width takes sixteen times the data.

What more data does not buy is coverage. The probability that the interval misses θ\theta is α\alpha regardless of nn. A 95% interval computed from a million observations is extremely narrow and still misses 5% of the time. Precision and coverage are separate knobs, and only precision responds to sample size.

6. Worked example: an interval for a standard deviation

The machinery is not restricted to means. Any pivot supports the same inversion.

Speed of light measurements, n=100n = 100, modelled as N(μ,σ2)\mathcal{N}(\mu, \sigma^2) with both unknown, and we want a 95% interval for σ\sigma.

There is no simple distribution for SnS_n itself, but there is one for a function of it:

(n1)Sn2σ2χ2(n1)\frac{(n-1)S_n^2}{\sigma^2} \sim \chi^2(n-1)

which is a pivot: it contains only the sample and σ\sigma, and its distribution depends on neither.

P(cl<(n1)Sn2σ2<cu)=0.95P\left(c_l < \frac{(n-1)S_n^2}{\sigma^2} < c_u\right) = 0.95

The chi-squared distribution is not symmetric, so the two critical values must be looked up separately rather than differing by a sign:

r
qchisq(0.025, n - 1)   # 73.36108
qchisq(0.975, n - 1)   # 128.422

Inverting for σ\sigma requires taking reciprocals, which reverses the inequalities and swaps which critical value goes where:

(n1)Sn2cu<σ<(n1)Sn2cl\sqrt{\frac{(n-1)S_n^2}{c_u}} < \sigma < \sqrt{\frac{(n-1)S_n^2}{c_l}}

With sn=79.01s_n = 79.01:

r
sqrt((n - 1) / c(c_u, c_l)) * s_n   # 69.3718 91.7846

The interval is (69.37,91.78)(69.37, 91.78), and sn=79.01s_n = 79.01 is not at its centre, because the chi-squared distribution is skewed. Any interval built on a non-symmetric pivot is asymmetric about the estimate.

Vocabulary to deploy

  • Confidence interval, confidence level 1α1-\alpha, significance level α\alpha.
  • Conservative interval: coverage at least 1α1-\alpha.
  • Pivot: depends only on the sample and θ\theta, with a distribution free of unknowns.
  • Inversion: rearranging a probability statement about a pivot to isolate θ\theta.
  • Critical value zpz_p, tm,pt_{m,p}; standard error, the standard deviation of an estimator.
  • Standardization (divide by σ\sigma) against studentization (divide by SnS_n).
  • Coverage against precision: nn buys precision only.