Course guide

3.1 Populations and random samples

Define the target, the selection mechanism and the observed data

3.1.1 What are we trying to learn about?

Suppose we want the average grade across all examination scripts, but can inspect only some scripts. The available grades describe the inspected scripts exactly. Learning about the uninspected scripts requires a connection between the inspected group and the target group. Statistics studies that connection and the uncertainty it creates.

Definition. A population is the collection or distribution about which we want to make a statement. A sample is the set of observations obtained through a specified selection mechanism.

A finite population can be enumerated: all scripts for one examination, or all people meeting a stated eligibility rule on a stated date. A model population can instead be a distribution that generates possible measurements. The latter need not correspond to a finite list. In either case, specify the units, variable and target before choosing a formula.

A sample is usually cheaper and faster to obtain than a census. Its usefulness depends on how it was obtained. A very large sample from the wrong group can answer the wrong question with great precision. Likewise, measuring everyone does not eliminate measurement error.

The sampling frame is the operational list from which units can be selected. An electoral register may be a frame for registered electors; it is not automatically a complete frame for every resident. Coverage gaps between the frame and the target population must be considered separately from random sampling variation.

3.1.2 Random selection and representativeness

For a fixed-size simple random sample without replacement, every subset of nn distinct population units has the same chance of selection. Consequently, each unit has inclusion probability n/Mn/M. Equal individual inclusion probabilities alone are a weaker property: a design could always select whole clusters and still give each person the same chance.

Random selection makes uncertainty assessable under the design. It does not guarantee that one realised sample exactly matches every population feature. A sample mean may be above or below the population mean. The frequency and size of such discrepancies depend on the design, sample size and population variation; “random” by itself supplies no numerical assurance.

In quota sampling, recruitment is arranged to match specified characteristics. For instance, a hypothetical population with 20%20\% graduates would yield a graduate quota of 2020 in a sample of 100100; a subgroup making up 5%5\% would have quota 55. Meeting these quotas does not make selection within each subgroup random. People who are easy to contact may differ in income or attitudes from those who are hard to contact.

Even a probability sample can lose its intended properties through nonresponse. If high-income people are systematically less likely to answer an income survey, the responding sample may understate the population mean. Increasing the number of respondents does not automatically remove that bias. Frame quality, recruitment, response and measurement all contribute to the inference.

Before calculating: Who is absent from the frame? Who is selected? Who responds? Which of these steps is random, and does the reported standard error account for the actual design?

3.1.3 A random sample and its realised values

Before sampling, write the measurements as random variables X1,…,XnX_1,\ldots,X_n. These are functions of the random selection outcome. After observing the selection, write their realised values as x1,…,xnx_1,\ldots,x_n. A classroom sample of ten people's heights illustrates the distinction: the identities chosen, and hence their heights, are uncertain beforehand; once recorded, the ten numbers are fixed. For an abstract measurement, the first selection could yield 1414 in one sampling outcome or 12.112.1 in another. These are alternative possible values of X1X_1, not two observations in the same first position.

Definition. The sample is independent and identically distributed, abbreviated iid, when the observations are jointly independent and each has the same distribution.

The two requirements do different jobs. Identical distributions mean each draw has the same probability law. Independence means learning other draws does not change a draw's distribution. Having the same mean and variance is weaker than having the same distribution; having the same distribution is weaker than being iid.

Examination scripts: why replacement matters

Consider ten scripts with grades 30,30,30,60,60,80,80,80,90,10030,30,30,60,60,80,80,80,90,100. Select a script uniformly. The grade of the first draw has the following distribution. Now suppose the first selected grade is 9090, and it is not replaced.

Original probabilities and conditional probabilities after removing the only grade-90 script
Grade xxP(X1=x)P(X_1=x)P(X2=x∣X1=90)P(X_2=x\mid X_1=90)
30303/103/103/93/9
60602/102/102/92/9
80803/103/103/93/9
90901/101/1000
1001001/101/101/91/9

The right column is conditional on the first result. Before observing either draw, X2X_2 has the same marginal distribution as X1X_1: every script is equally likely to occupy the second position. The draws therefore have identical marginal distributions but are dependent. Independence fails because, for example, P(X2=90∣X1=90)=0≠1/10P(X_2=90\mid X_1=90)=0\ne1/10.

If the script is replaced and each selection is made independently, every subsequent draw again has the original probabilities. This mechanism supplies both identical distributions and independence. With 1,0001{,}000 scripts in the same grade proportions, removing a grade-90 script changes the conditional probabilities to 300/999300/999, 200/999200/999, 300/999300/999, 99/99999/999, 100/999100/999. The change after one draw is small. Across a large sample, however, the sampling fraction n/Mn/M matters; a large population alone does not justify ignoring dependence.

Finite population correction

For a simple random sample without replacement, let σ2=M−1∑j=1M(xj−μ)2\sigma^2=M^{-1}\sum_{j=1}^M(x_j-\mu)^2. Then

Var⁡(Xˉ)=σ2nM−nM−1.\operatorname{Var}(\bar X)=\frac{\sigma^2}{n}\frac{M-n}{M-1}.

The correction becomes small when the sample is a small fraction of the population. At n=Mn=M, the sample mean equals the finite population mean and its selection variance is zero. The usual iid formula σ2/n\sigma^2/n deliberately omits this correction.

3.1.4 Check the mechanism

Exercise. In the ten-script population, is the probability of drawing grade 9090 on the second draw always zero without replacement? Explain why “the observations have the same distribution, so they are iid” is invalid.

Solution

It is zero only conditional on the first draw already removing the sole grade-90 script. Unconditionally each script has probability 1/101/10 of being second, so P(X2=90)=1/10P(X_2=90)=1/10. Marginal equality does not imply independence. The conditional probability changes with the first draw, proving dependence.

Exercise. A sample matches the population's graduate proportion exactly. Does its mean income necessarily estimate the target population mean without bias?

Solution

No. Within both education groups, recruitment might disproportionately include low-income respondents. Matching one marginal feature does not determine the joint distribution of education, income and response. We need an appropriate selection/response model, not just a quota count.

3.2 Parameters, statistics and estimation

A target, a rule and a realised answer are different objects

3.2.1 What changes across samples?

For a finite enumerated population, its mean is μ=M−1∑j=1Mxj\mu=M^{-1}\sum_{j=1}^M x_j. A parameter describes the population: its mean μ\mu, variance σ2\sigma^2, or success probability pp. In frequentist inference it is fixed, although unknown. An estimand is the particular population quantity we choose to learn about. For example, we may care about μx−μy\mu_x-\mu_y rather than either mean separately.

A statistic is a function of the sample that does not require an unknown parameter to compute. An estimator is a statistic used to estimate an estimand. Its realised numerical value is an estimate. The sample mean is a random estimator before data arrive; the observed sample mean is a fixed number after they arrive.

θ^=g(X1,…,Xn),θ^obs=g(x1,…,xn).\begin{aligned}\hat\theta&=g(X_1,\ldots,X_n),\\ \hat\theta_{\rm obs}&=g(x_1,\ldots,x_n).\end{aligned}

A hat marks an estimator of the quantity beneath it. It does not itself guarantee accuracy. The function gg specifies the rule applied to every possible sample. Its distribution across repeated samples is the sampling distribution, which is different from the distribution of individual observations within a sample.

3.2.2 Sample analogues of population moments

The population mean is a probability-weighted average of possible values. Its sample analogue gives the observed values equal weights. For iid data with finite moments, use

Xˉ=1n∑i=1nXi,s2=1n−1∑i=1n(Xi−Xˉ)2,s=s2.\begin{aligned}\bar X&=\frac1n\sum_{i=1}^nX_i,\\ s^2&=\frac1{n-1}\sum_{i=1}^n(X_i-\bar X)^2,\\ s&=\sqrt{s^2}.\end{aligned}

The realised sample 1,2,1,3,4,41,2,1,3,4,4 has sum 1515, size 66, and mean 2.52.5. Its sum of squared deviations is 9.59.5, so its sample variance is 9.5/5=1.99.5/5=1.9 and sample SD is 1.9≈1.378\sqrt{1.9}\approx1.378. Squaring deviations prevents positive and negative deviations cancelling; division sets the variance's scale.

For binary indicators Xi∈{0,1}X_i\in\{0,1\}, the mean is the proportion of ones. Thus 0,1,0,1,10,1,0,1,1 gives p^=3/5=0.6\hat p=3/5=0.6. A Bernoulli population has mean pp and variance p(1−p)p(1-p). Two related sample quantities are

plug-in variance=p^(1−p^),s2=nn−1p^(1−p^).\begin{gathered}\text{plug-in variance}\\ =\hat p(1-\hat p),\\ s^2=\frac{n}{n-1}\hat p(1-\hat p).\end{gathered}

The first estimates the population variance by substituting the estimated probability. The second is the usual sample variance with the unbiased denominator. Here they are 0.240.24 and 0.300.30, respectively. They approach each other as nn grows, but they are not identical.

Covariance needs information about pairs

The population covariance is σXY=E[(X−μX)(Y−μY)]\sigma_{XY}=E[(X-\mu_X)(Y-\mu_Y)]; when both population SDs are positive, population correlation is ρXY=σXY/(σXσY)\rho_{XY}=\sigma_{XY}/(\sigma_X\sigma_Y). Read ρ\rho as “rho.” For paired measurements (Xi,Yi)(X_i,Y_i), sample covariance measures whether deviations tend to share a sign:

sXY=1n−1×∑i(Xi−Xˉ)(Yi−Yˉ),rXY=sXYsXsY.\begin{aligned}s_{XY}&=\frac1{n-1}\\ &\quad{}\times\sum_i(X_i-\bar X)(Y_i-\bar Y),\\ r_{XY}&=\frac{s_{XY}}{s_Xs_Y}.\end{aligned}

Read sXYs_{XY} as “sample covariance of X and Y” and rXYr_{XY} as “sample correlation of X and Y.” Correlation is defined only when both sample SDs are positive. Covariance carries the product of the two variables' units; correlation has no units.

For two binary variables, writing pX=P(X=1)p_X=P(X=1), pY=P(Y=1)p_Y=P(Y=1), and q=P(X=1,Y=1)q=P(X=1,Y=1),

Cov⁡(X,Y)=q−pXpY.\operatorname{Cov}(X,Y)=q-p_Xp_Y.

The product of marginal probabilities is not the covariance. Independence would make q=pXpYq=p_Xp_Y and covariance zero. With observed joint proportion q^\hat q, the sample covariance is n(q^−p^Xp^Y)/(n−1)n(\hat q-\hat p_X\hat p_Y)/(n-1). Marginal percentages alone cannot recover it. This fact will determine the correct uncertainty for before-and-after proportions.

3.2.3 Bias and the variance denominator

Definition. Bias⁡(θ^)=E[θ^]−θ\operatorname{Bias}(\hat\theta)=E[\hat\theta]-\theta. An estimator is unbiased if this difference is zero.

Unbiasedness concerns an average over repeated samples. It does not mean every realised estimate equals the target. If each observation has finite expectation μ\mu, linearity gives

E[Xˉ]=1n∑iE[Xi]=μ.E[\bar X]=\frac1n\sum_iE[X_i]=\mu.

This proof needs common expectations, not independence. Independence will matter for the variance of the mean. A histogram of means from samples of 2020 drawn from a discrete uniform population 1,…,1001,\ldots,100 should centre near 50.550.5. Ten illustrative simulated means are 46.1046.10, 55.1555.15, 58.1058.10, 52.7052.70, 41.3041.30, 52.0052.00, 53.3553.35, 49.1049.10, 53.5053.50, 46.7546.75. Their variation is compatible with an unbiased rule; a finite simulation need not centre exactly on the parameter.

Why divide squared deviations by n−1n-1?

  1. Separate the unknown true centre from the fitted centre. Expanding the squares and using ∑i(Xi−Xˉ)=0\sum_i(X_i-\bar X)=0 gives ∑i(Xi−Xˉ)2=∑i(Xi−μ)2−n(Xˉ−μ)2.\begin{aligned}\sum_i(X_i-\bar X)^2&=\sum_i(X_i-\mu)^2\\ &\quad-n(\bar X-\mu)^2.\end{aligned}
  2. Take expectations under iid finite-variance sampling. The first sum has expectation nσ2n\sigma^2. Since EXˉ=μE\bar X=\mu and Var⁡(Xˉ)=σ2/n\operatorname{Var}(\bar X)=\sigma^2/n, the second term has expectation σ2\sigma^2.
  3. Correct the systematic shortfall. The expected sum is (n−1)σ2(n-1)\sigma^2. Dividing by nn therefore gives expectation (n−1)σ2/n(n-1)\sigma^2/n, below the target. Dividing by n−1n-1, for n>1n>1, gives E[s2]=σ2E[s^2]=\sigma^2.

Estimating the centre from the same data makes deviations artificially small: the fitted mean minimises their squared sum. The nn residuals obey one linear constraint, leaving n−1n-1 degrees of freedom. They are not themselves independent observations. Also, an unbiased variance does not make its square root an unbiased SD: averaging and taking square roots do not commute.

3.2.4 Standard deviation versus standard error

The population SD σ\sigma describes variation among individual measurements. The standard error of an estimator is its sampling-distribution SD. For a mean from iid observations,

Var⁡(Xˉ)=1n2∑iVar⁡(Xi)=σ2n,SE⁡(Xˉ)=σn,SE⁡^(Xˉ)=sn.\begin{aligned}\operatorname{Var}(\bar X)&=\frac1{n^2}\sum_i\operatorname{Var}(X_i)\\ &=\frac{\sigma^2}{n},\\ \operatorname{SE}(\bar X)&=\frac{\sigma}{\sqrt n},\\ \widehat{\operatorname{SE}}(\bar X)&=\frac{s}{\sqrt n}.\end{aligned}

The variance scaling rule supplies 1/n21/n^2; independence makes all cross-covariances zero; identical variances supply nσ2n\sigma^2. The true SE uses the unknown population SD. The estimated SE uses its sample analogue. Both have the measurement's original units. Read ∑i\sum_i as “sum over i”; each indexed observation contributes once.

Without independence the general expression also includes 2∑i<jCov⁡(Xi,Xj)/n22\sum_{i<j}\operatorname{Cov}(X_i,X_j)/n^2. Positive dependence can increase uncertainty relative to an iid calculation. The next topics explain why time dependence and sampling design cannot be ignored.

For the discrete uniform population 0,…,1000,\ldots,100, μ=50\mu=50 and σ2=850\sigma^2=850. Mean variances are 850/20=42.5850/20=42.5 and 850/40=21.25850/40=21.25. An illustrative set of 100100 replications gave empirical variances 45.2445.24 and 23.6423.64. These are finite simulation results, not alternative theoretical identities. Doubling sample size halves variance; quadrupling it halves SE.

Before playing, predict: one score has SD 29.15.29.15\text{.} Is the SD of a mean of 2020 scores 29.15,29.15\text{,} 29.15/2029.15/20 or 29.15/2029.15/\sqrt{20}?The animation’s final frame. Its numbered steps describe how the picture is built.
  1. One score is uniform on 0,…,100,0,\dots,100\text{,} with variance σ2=850\sigma^2=850 and SD ≈29.15.\approx29.15\text{.}
  2. The variance of a sum of 2020 scores adds up all 20×20=40020\times20=400 cells of a grid, where cell (i,j)(i,j) is Cov⁡(Xi,Xj).\operatorname{Cov}(X_i,X_j)\text{.}
  3. Independent scores have zero covariance, so only the 2020 diagonal cells remain, each 850:850\text{:} the sum has variance 20×850=17000.20\times850=17000\text{.}
  4. The mean divides the sum by 20,20\text{,} so its variance is divided by 202=400:20^2=400\text{:} spread evenly, 42.542.5 per cell, so Var⁡(Xˉ)=850/20.\operatorname{Var}(\bar X)=850/20\text{.}
  5. So SE⁡(Xˉ)=42.5=29.15/20≈6.52:\operatorname{SE}(\bar X)=\sqrt{42.5}=29.15/\sqrt{20}\approx6.52\text{:} a mean of 2020 scores varies far less than one score.

3.2.5 Efficiency and consistency

Among unbiased estimators of the same target under the same model, the one with smaller sampling variance is more efficient. A noisy sample median and a sample mean may both converge to 5050 for the symmetric uniform population 0,…,1000,\ldots,100. That example does not establish a universal ranking, and a median generally targets a population median rather than a mean.

Definition. θ^n\hat\theta_n is consistent for θ\theta if, for every ε>0\varepsilon>0, P(∣θ^n−θ∣>ε)→0P(|\hat\theta_n-\theta|>\varepsilon)\to0 as n→∞n\to\infty.

Read this as “the probability of an error larger than epsilon tends to zero.” It is a statement about a sequence of sampling distributions, not a promise that a realised estimate moves closer at every step.

A useful sufficient condition is vanishing mean squared error:

MSE⁡(θ^n)=Var⁡(θ^n)+Bias⁡(θ^n)2,P(∣θ^n−θ∣>ε)≤MSE⁡(θ^n)ε2.\begin{aligned}\operatorname{MSE}(\hat\theta_n)&=\operatorname{Var}(\hat\theta_n)\\ &\quad+\operatorname{Bias}(\hat\theta_n)^2,\\ P(|\hat\theta_n-\theta|>\varepsilon)&\leq\frac{\operatorname{MSE}(\hat\theta_n)}{\varepsilon^2}.\end{aligned}

The inequality follows by applying Markov's inequality to squared error. Thus bias tending to zero and variance tending to zero imply consistency. This is sufficient, not a necessary characterisation of all consistent estimators.

Consistency does not require finite-sample unbiasedness. For iid draws uniformly from 0,…,10000,\ldots,1000, use their maximum to estimate the population maximum 10001000. It never exceeds the target, and has positive probability of falling short for every finite nn, so it is biased downwards. Yet P(max⁡iXi<1000)=(1000/1001)n→0P(\max_i X_i<1000)=(1000/1001)^n\to0. With a nested growing sample, the maximum can only stay the same or rise; it cannot bounce downwards.

Exercise. In the sample 1,2,1,3,4,41,2,1,3,4,4, calculate the estimated SE of the mean and explain why it is smaller than the sample SD.

Solution

We found s2=1.9s^2=1.9, so s≈1.378s\approx1.378 and s/6=1.9/6≈0.563s/\sqrt6=\sqrt{1.9/6}\approx0.563. The first describes variation among six observed values; the second estimates variation of the mean across iid samples of size six. Averaging reduces independent noise. Six observations alone do not establish a normal approximation.

3.3 Sampling distributions, LLN and CLT

Concentration of averages and the shape of their remaining uncertainty

3.3.1 One sample is not a sampling distribution

A histogram of nn observations depicts the observed data. A histogram of RR sample means, each calculated from a separate sample of size nn, depicts a simulation of the mean's sampling distribution. Keep those two counts separate: nn is observations per sample; RR, read “capital R,” is the number of repeated samples.

The parameter stays fixed across this thought experiment. The estimator varies because each sample changes. After one sample has been realised, its estimate is fixed too; its standard error describes the rule's uncertainty across other possible samples under the model.

For independent uniform draws on 0,…,1000,\ldots,100, individuals have SD 850≈29.15\sqrt{850}\approx29.15. The mean from 2020 draws has SE 850/20≈6.52\sqrt{850/20}\approx6.52. Individuals can remain widely spread even when their averages are concentrated. This separation is the basis of statistical inference.

3.3.2 The law of large numbers

Weak law of large numbers. Under iid sampling with a finite mean and finite variance, the sample mean converges in probability to the population mean:

Xˉn→pμ,P(∣Xˉn−μ∣>ε)→0(ε>0).\begin{gathered}\bar X_n\xrightarrow{p}\mu,\\ P(|\bar X_n-\mu|>\varepsilon)\to0\quad(\varepsilon>0).\end{gathered}

There are versions requiring weaker assumptions, but these conditions are enough for our derivation. “Weak” identifies the mode of convergence, not the practical usefulness of the result. Convergence in probability means a fixed error tolerance is increasingly unlikely to be exceeded.

  1. Centre. EXˉn=μE\bar X_n=\mu.
  2. Measure spread. Independence gives Var⁡(Xˉn)=σ2/n\operatorname{Var}(\bar X_n)=\sigma^2/n.
  3. Bound the chance of a large error. Chebyshev's inequality gives P(∣Xˉn−μ∣>ε)≤σ2/(nε2)P(|\bar X_n-\mu|>\varepsilon)\leq\sigma^2/(n\varepsilon^2), which tends to zero.

The bound provides a conservative finite-sample statement when the variance is known. With variance 850850, sample size 1,0001{,}000, and tolerance 55, the error probability is at most 850/(1000×25)=0.034850/(1000\times25)=0.034. The LLN itself is a limiting result; it does not specify that every chosen finite sample is already accurate.

A running mean may move away from its target temporarily as new observations arrive. That does not contradict convergence. Nor does more data remove selection bias: if the sample comes from the wrong distribution, the average can converge very precisely to the wrong target.

3.3.3 The central limit theorem

The LLN says the unscaled error disappears. To study the shape of the remaining error, divide it by its shrinking SE. Under iid sampling with 0<σ2<∞0<\sigma^2<\infty, the CLT states

Zn=Xˉn−μσ/n,Zn→dN(0,1).\begin{aligned}Z_n&=\frac{\bar X_n-\mu}{\sigma/\sqrt n},\\ Z_n&\xrightarrow{d}N(0,1).\end{aligned}

The standardisation subtracts the centre and divides by the SD of the mean. Thus ZnZ_n has mean zero and variance one for every nn under these assumptions, while its shape approaches a standard normal distribution.

More precisely, P(Zn≤z)→Φ(z)P(Z_n\leq z)\to\Phi(z) for each real zz, where Φ\Phi is the standard normal cumulative distribution function. For sufficiently suitable large samples this motivates

Xˉn ∼˙ N ⁣(μ,σ2n).\bar X_n\ \dot\sim\ N\!\left(\mu,\frac{\sigma^2}{n}\right).

The dotted relation denotes an approximation. If the parent distribution is normal, the mean is exactly normal at any sample size. Otherwise “large enough” depends on skewness, tails and rare outcomes; it has no universal threshold such as n=30n=30.

A strongly non-normal parent

A Beta distribution with parameters 1/2,1/21/2,1/2 is U-shaped on (0,1)(0,1), with mean 1/21/2 and variance 1/81/8. Individual samples retain that U-shaped tendency. Means from 1,0001{,}000 independent samples of 5050 observations can have a bell-shaped sampling histogram even though the individual measurements do not.

SE⁡(Xˉ50)=1/850=0.05.\operatorname{SE}(\bar X_{50})=\sqrt{\frac{1/8}{50}}=0.05.

Standardising each mean as (Xˉ50−0.5)/0.05(\bar X_{50}-0.5)/0.05 allows comparison with a standard normal curve. Neither a bell-shaped simulation nor agreement with a curve proves the theorem. The assumptions and mathematical limit do that work; the simulation illustrates the distinct distributions involved.

Compare individual draws, a running mean and a histogram of repeated sample means. The seeded simulation reports the distribution, sample size and number of replications; it illustrates concentration and shape separately.

3.3.4 From the theorem to an estimated SE

The CLT denominator contains σ\sigma, often unknown. If ss consistently estimates σ>0\sigma>0, replacing the population SD by the sample SD preserves the asymptotic normal limit. This substitution is justified by the combination of consistency and Slutsky's theorem; it does not make the finite-sample distribution exactly normal.

Xˉn−μs/n→dN(0,1).\frac{\bar X_n-\mu}{s/\sqrt n}\xrightarrow{d}N(0,1).

For iid Bernoulli data, μ=p\mu=p and σ2=p(1−p)\sigma^2=p(1-p). The mean is a proportion, so its estimated SE is p^(1−p^)/n\sqrt{\hat p(1-\hat p)/n}. Normal approximation can be poor when expected successes npnp or failures n(1−p)n(1-p) are small. Values near the boundaries require particular care.

Variance is a nuisance parameter when our target is the mean: it is not the main object of interest, but it governs the uncertainty calculation. Estimating it matters especially with small samples. The next chapter distinguishes exact normal/known-variance inference, normal/unknown-variance inference using Student's tt, and large-sample approximations.

Exercise. With the U-shaped Beta parent, find the SE for n=8n=8 and n=128n=128. Does reducing SE imply the individual values become normally distributed?

Solution

Use (1/8)/n\sqrt{(1/8)/n}: the SEs are 1/8=0.1251/8=0.125 and 1/32=0.031251/32=0.03125. Multiplying sample size by 1616 divides SE by 44. The parent distribution remains U-shaped. The CLT concerns standardised means, and does not guarantee a good approximation at n=8n=8.

3.4 Confidence intervals for means

Invert a sampling statement to describe uncertainty about a fixed target

3.4.1 What does confidence describe?

A point estimate gives one answer. A confidence interval adds a range constructed by a procedure whose coverage can be assessed across repeated samples. The population parameter remains fixed; the interval endpoints change when the sample changes.

Definition. A confidence procedure [L(X),U(X)][L(X),U(X)] has coverage 1−α1-\alpha for a parameter value θ\theta when

Pθ{L(X)≤θ≤U(X)}=1−α.P_\theta\{L(X)\leq\theta\leq U(X)\}=1-\alpha.

The probability is over the random sample under the model with parameter θ\theta. For an exact procedure this statement holds as specified by its model; a large-sample procedure generally has approximate coverage.

After observing the data, the computed endpoints and the parameter are fixed. The realised interval either covers the parameter or does not. A 95%95\% confidence interval is not a 95%95\% posterior probability that the fixed parameter lies inside these observed endpoints. Such a probability would require a Bayesian model and prior.

If we repeatedly draw samples of size 55 from N(0,1)N(0,1), the known-SD intervals Xˉ±1.96/5\bar X\pm1.96/\sqrt5 have approximately 95%95\% coverage. Among 2020 repetitions, the number covering is random, not guaranteed to be 1919. A single observed interval cannot reveal its own coverage status when the true mean is unknown.

Before playing, predict: once one 95%95\% interval has been computed, is there a 95%95\% chance that it contains μ\mu?The animation’s final frame. Its numbered steps describe how the picture is built.
  1. Samples of n=5n=5 from N(0,1):N(0,1)\text{:} the mean Xˉ∼N(0,1/5)\bar X\sim N(0,1/5) lands within 1.96/5≈0.8771.96/\sqrt5\approx0.877 of the fixed μ=0\mu=0 with probability 0.95.0.95\text{.}
  2. Each sample gives its own interval xˉ±0.877.\bar x\pm0.877\text{.} The means −0.10-0.10 and 0.400.40 give intervals that contain 0.0\text{.}
  3. The mean 1.001.00 lands outside the central 95%,95\%\text{,} so its interval [0.123,1.877][0.123,1.877] misses 0.0\text{.} An interval misses exactly when its mean lands outside that band.
  4. Forty simulated samples: in this run 3737 of the 4040 intervals contain 0.0\text{.} The 95%95\% describes the procedure over many samples; one computed interval either contains μ\mu or does not.
The fixed population mean is a vertical reference. Every row is a fresh random interval. The simulation reports coverage over all replications and draws only its first rows; a short run need not equal the nominal confidence level.

3.4.2 Deriving a mean interval

Start with a statement about a statistic whose distribution we know or approximate. For iid normal observations with known σ>0\sigma>0, Z=(Xˉ−μ)/(σ/n)Z=(\bar X-\mu)/(\sigma/\sqrt n) is exactly standard normal. Let c=z1−α/2c=z_{1-\alpha/2} be the quantile with probability α/2\alpha/2 above it. Symmetry puts the same probability below −c-c.

  1. Central probability. P(−c≤Z≤c)=1−αP(-c\leq Z\leq c)=1-\alpha.
  2. Rescale by a positive number. Multiply the inequalities by σ/n\sigma/\sqrt n, obtaining −cσ/n≤Xˉ−μ≤cσ/n-c\sigma/\sqrt n\leq\bar X-\mu\leq c\sigma/\sqrt n.
  3. Solve for the target. Subtract Xˉ\bar X, reverse the inequalities when multiplying by −1-1, and reorder:
e=σ/n,P(Xˉ−ce≤μ≤Xˉ+ce)=1−α,interval:Xˉ±ce.\begin{gathered}e=\sigma/\sqrt n,\\ P(\bar X-ce\leq\mu\leq\bar X+ce)\\ =1-\alpha,\\ \text{interval:}\quad\bar X\pm c e.\end{gathered}

The algebra has not made the unknown mean random. It has turned a probability statement about a random estimator into one about random endpoints containing a fixed mean. Read ±\pm as “plus or minus”: it specifies both endpoints.

For 90%,95%,99%90\%,95\%,99\% confidence, the standard normal critical values are approximately 1.645,1.960,2.5761.645,1.960,2.576. Higher confidence requires a wider interval at the same SE. Width is 2cSE⁡2c\operatorname{SE}; quadrupling an iid sample size halves width when population variation is held fixed. Extra precision and extra confidence are different objectives.

Which critical value belongs to which model?

With an unknown SD and a suitable large sample, use Xˉ±cs/n\bar X\pm c s/\sqrt n as an approximate interval. With iid normal data and unknown SD, the exact pivot is instead

T=Xˉ−μs/n∼tn−1.T=\frac{\bar X-\mu}{s/\sqrt n}\sim t_{n-1}.

Read tn−1t_{n-1} as “t with n minus one degrees of freedom.” Student's tt distribution has heavier tails, accounting for uncertainty in the SD estimate. Use its quantile tn−1,1−α/2t_{n-1,1-\alpha/2} in place of cc. This exact small-sample result needs normality, not just independence. For non-normal small samples, neither normal nor tt calibration is automatically reliable.

3.4.3 One mean: a complete calculation

A sample has n=100n=100, observed mean xˉ=64\bar x=64, and sample variance s2=8s^2=8. Under the iid large-sample model, estimate the uncertainty in the population mean.

  1. Identify the estimator. Xˉ\bar X estimates μ\mu, with realised value 6464.
  2. Convert data spread into uncertainty of the mean. s=8s=\sqrt8; estimated SE is 8/100≈0.28284\sqrt{8/100}\approx0.28284. The number 88 is a variance, not an SD.
  3. Choose the confidence level. At 95%95\%, use c≈1.96c\approx1.96. Margin 1.96×0.28284≈0.554371.96\times0.28284\approx0.55437.
  4. Report endpoints and conditions. 64±0.5543764\pm0.55437, approximately [63.446,64.554][63.446,64.554]. This is a large-sample mean interval, not a range containing 95%95\% of individual grades.

3.4.4 Two independent means

For iid samples within each group and independence between groups, target δ=μX−μY\delta=\mu_X-\mu_Y, estimated by δ^=Xˉ−Yˉ\hat\delta=\bar X-\bar Y. Subtracting changes the sign of the centre, but independent variances still add:

Var⁡(Xˉ−Yˉ)=σX2nX+σY2nY,SE⁡^(δ^)=sX2nX+sY2nY,large-sample CI:δ^±cSE⁡^(δ^).\begin{aligned}\operatorname{Var}(\bar X-\bar Y)&=\frac{\sigma_X^2}{n_X}+\frac{\sigma_Y^2}{n_Y},\\ \widehat{\operatorname{SE}}(\hat\delta)&=\sqrt{\frac{s_X^2}{n_X}+\frac{s_Y^2}{n_Y}},\\ \text{large-sample CI}&:\quad\hat\delta\pm c\widehat{\operatorname{SE}}(\hat\delta).\end{aligned}

The estimated expression is not the unknown true variance itself. No equality of population variances is assumed in this formula.

Anchoring: state the direction before subtracting

Use the lecture's illustrative anchoring exercise: 8989 students were split between a low prompt, 1010, and a high prompt, 6565, before giving a percentage estimate in a UN-membership question. Treat the reported summaries as teaching inputs: low group nX=43,xˉ=17.1,sX2=86n_X=43,\bar x=17.1,s_X^2=86; high group nY=46,yˉ=30.7,sY2=253n_Y=46,\bar y=30.7,s_Y^2=253. No current factual percentage is needed to analyse the responses.

  1. Define the contrast. Low minus high is 17.1−30.7=−13.617.1-30.7=-13.6 percentage points.
  2. Estimate its sampling variance. 86/43+253/46=2+5.5=7.586/43+253/46=2+5.5=7.5. SE is 7.5≈2.73861\sqrt{7.5}\approx2.73861.
  3. Construct the interval. Margin 1.967.5≈5.367681.96\sqrt{7.5}\approx5.36768, giving [−18.968,−8.232][-18.968,-8.232] percentage points.
  4. Interpret the sign. The interval is entirely negative for low minus high. Reversing the contrast gives [8.232,18.968][8.232,18.968], not the same signed interval.

Under the working model, the response difference is inconsistent with zero at the corresponding two-sided level. Random assignment can support a causal comparison of prompts, subject to implementation and response assumptions. It does not itself make these students representative of a wider population. Sampling and treatment assignment answer different questions.

Supplement: Welch's interval

For independent normal groups with unknown, possibly unequal variances, a common small-sample improvement uses Welch's approximate tt calibration. Set a=sX2/nXa=s_X^2/n_X, b=sY2/nYb=s_Y^2/n_Y, and

ν=(a+b)2a2/(nX−1)+b2/(nY−1).\nu=\frac{(a+b)^2}{a^2/(n_X-1)+b^2/(n_Y-1)}.

Use tν,1−α/2a+bt_{\nu,1-\alpha/2}\sqrt{a+b} for the margin. This is an approximation with estimated degrees of freedom ν\nu, read “nu”; it is not the exact known-variance normal case.

3.4.5 Paired means: analyse the within-pair difference

If each student takes both examinations, scores within a student may be related. Define Di=Xi−YiD_i=X_i-Y_i for each student. Treat the nn pairs as independent sampling units; there are nn differences, not 2n2n independent observations.

Dˉ=Xˉ−Yˉ,sD2=sX2+sY2−2sXY,SE⁡^(Dˉ)=sDn.\begin{aligned}\bar D&=\bar X-\bar Y,\\ s_D^2&=s_X^2+s_Y^2-2s_{XY},\\ \widehat{\operatorname{SE}}(\bar D)&=\frac{s_D}{\sqrt n}.\end{aligned}

Read sDs_D as “s sub D,” the sample SD of differences. The covariance term follows by expanding Var⁡(X−Y)\operatorname{Var}(X-Y). Positive covariance reduces variation of differences: a student who scores high on both exams may still have a modest score difference. Marginal score SDs alone do not supply sDs_D.

For the lecture's 7171 students, the exam means are 79.679.6 and 81.481.4, variances 117117 and 151151, and sample correlation approximately 0.540.54. The supplied difference variance is 124.45124.45, consistent with those rounded summaries. With exam 1 minus exam 2, the displayed example pairs (57.1,60.7)(57.1,60.7) and (78.6,82.9)(78.6,82.9) have differences −3.6-3.6 and −4.3-4.3.

  1. Centre. dˉ=79.6−81.4=−1.8\bar d=79.6-81.4=-1.8.
  2. SE of the difference mean. 124.45/71≈1.32394\sqrt{124.45/71}\approx1.32394.
  3. Margin and interval. 1.96×1.32394≈2.594921.96\times1.32394\approx2.59492, so the large-sample 95%95\% interval is [−4.395,0.795][-4.395,0.795].
  4. Conclusion. The interval includes zero. These data do not establish a nonzero population mean score difference at this level. They do not prove equal means, and score differences alone cannot isolate exam difficulty from all other changes.

Exercise. Why is 117/71+151/71\sqrt{117/71+151/71} inappropriate for these paired scores?

Solution

It assumes zero cross-covariance and treats the two exam samples as independent. The same students supply both measurements. The actual covariance is approximately 0.54117×1510.54\sqrt{117\times151}, so difference variance is 117+151−2sXY≈124.45117+151-2s_{XY}\approx124.45. The appropriate SE is 124.45/71\sqrt{124.45/71}, not 268/71\sqrt{268/71}.

3.5 Confidence intervals for proportions

Binary means, independent contrasts and paired transitions

3.5.1 A proportion is a mean of indicators

Record Xi=1X_i=1 when person ii gives the response of interest and Xi=0X_i=0 otherwise. Then p=P(Xi=1)p=P(X_i=1) is the population proportion, and p^=n−1∑iXi=k/n\hat p=n^{-1}\sum_iX_i=k/n is the sample proportion when kk successes are observed. Under iid Bernoulli sampling,

E[p^]=p,Var⁡(p^)=p(1−p)n,SE⁡^(p^)=p^(1−p^)n.\begin{aligned}E[\hat p]&=p,\\ \operatorname{Var}(\hat p)&=\frac{p(1-p)}n,\\ \widehat{\operatorname{SE}}(\hat p)&=\sqrt{\frac{\hat p(1-\hat p)}n}.\end{aligned}

The large-sample Wald interval substitutes this estimated SE into a normal margin:

p^±cp^(1−p^)n.\hat p\pm c\sqrt{\frac{\hat p(1-\hat p)}n}.

Read “p hat plus or minus c times its estimated standard error.” The population variance is determined by pp, but pp is unknown, so the CI denominator uses p^\hat p. This will differ from a null-based test denominator. Applying the generic mean formula s/ns/\sqrt n to binary data instead gives p^(1−p^)/(n−1)\sqrt{\hat p(1-\hat p)/(n-1)}. The customary Wald formula uses the plug-in convention shown here; these two estimated SEs are asymptotically equivalent, and neither makes the interval exact.

A survey example with bounded assumptions

The lecture reports a historical survey example with n=1502n=1502 and an approval proportion p^=0.39\hat p=0.39. Use these as classroom inputs for an iid, unweighted approximation. A published survey may have weighting and a more complex design; these summaries alone do not establish its actual design-based standard error. The rounded percentage also does not determine an exact integer success count.

  1. Variance of an individual indicator. Plug-in value 0.39(1−0.39)=0.23790.39(1-0.39)=0.2379.
  2. Variance and SE of the mean. Divide by 15021502, then take the square root: 0.2379/1502≈0.0125853\sqrt{0.2379/1502}\approx0.0125853.
  3. Margin. 1.96×0.0125853≈0.02466711.96\times0.0125853\approx0.0246671.
  4. Interval. [0.3653,0.4147][0.3653,0.4147], or approximately 36.53%36.53\% to 41.47%41.47\%.

The margin is about 2.472.47 percentage points, not a 2.47%2.47\% relative change in approval. Keeping probability and percentage scales explicit avoids a factor-of-100100 error.

Why boundaries require a better procedure

When p^=0\hat p=0 or 11, the Wald SE is zero. The resulting zero-width interval clearly does not express the uncertainty from a small sample. Wald endpoints can also lie outside [0,1][0,1], and coverage may be poor near boundaries. Merely clipping the endpoints does not repair the coverage calculation. The score-test inversion below produces a Wilson interval that respects the probability scale; exact binomial procedures are another option.

3.5.2 Two independent proportions

For independent groups, estimate the difference δ=pX−pY\delta=p_X-p_Y by δ^=p^X−p^Y\hat\delta=\hat p_X-\hat p_Y. The two estimated variances add because the samples are independent:

a=p^X(1−p^X)nX,b=p^Y(1−p^Y)nY,e=SE⁡^(δ^)=a+b,Wald CI:δ^±ce.\begin{aligned}a&=\frac{\hat p_X(1-\hat p_X)}{n_X},\\ b&=\frac{\hat p_Y(1-\hat p_Y)}{n_Y},\\ e&=\widehat{\operatorname{SE}}(\hat\delta)=\sqrt{a+b},\\ \text{Wald CI}&:\quad\hat\delta\pm c e.\end{aligned}

There is no reason to pool the two proportions for this interval: the target permits different population proportions. The equality test later imposes a common proportion under its null and consequently uses a different denominator.

For a historical lecture knowledge question about identifying John Roberts, take the reported inputs as illustrative: 239239 Republican respondents with correct-response proportion 0.470.47, and 238238 Democrat respondents with proportion 0.310.31. These rounded figures describe one specific question. They do not measure general political knowledge or prove one group is “better informed” overall.

  1. Define the contrast. Republican minus Democrat correct-response proportion: 0.47−0.31=0.160.47-0.31=0.16.
  2. Unpooled SE. Compute the two variance contributions: a=0.47(0.53)/239,b=0.31(0.69)/238,e=a+b≈0.044057.\begin{aligned}a&=0.47(0.53)/239,\\ b&=0.31(0.69)/238,\\ e&=\sqrt{a+b}\approx0.044057.\end{aligned}
  3. Interval. 0.16±1.96(0.044057)0.16\pm1.96(0.044057), approximately [0.07365,0.24635][0.07365,0.24635], or 7.377.37 to 24.6324.63 percentage points.
  4. Scope. Under the working independent-sample approximation the population contrast for this response is positive. Representativeness, wording, response and design affect any broader inference.

3.5.3 Paired proportions need the joint table

With before-and-after smoking status for the same people, the two proportions are dependent. Let BiB_i be before status, AiA_i after status, with 11 denoting smoking, and define Di=Ai−BiD_i=A_i-B_i. Its possible values are −1-1 for quitting, 00 for no change, and +1+1 for starting. A difference of two indicators is not itself a Bernoulli indicator.

The mean difference is Dˉ=p^A−p^B\bar D=\hat p_A-\hat p_B. Its estimated SE is sD/ns_D/\sqrt n, and the large-sample interval is Dˉ±csD/n\bar D\pm cs_D/\sqrt n. Independence is required between people/pairs, not between measurements on the same person.

Before smoking is reported as 30%30\% and after smoking as 25%25\% for 100100 people. Those margins give the change −0.05-0.05, but not its SE. People who quit and people who start create the variance; people unchanged in either state create zero differences.

A coherent illustrative paired table

The following table is an explicitly constructed teaching example with those same marginal counts. It is not a recovered dataset from the lecture summary.

Illustrative transitions for 100100 independent people
Before statusAfter smokingAfter not smokingTotal
Smoking202010103030
Not smoking5565657070
Total25257575100100
  1. Compute the difference sum. Ten quitters contribute −10-10, five starters +5+5, and 8585 unchanged people zero. Therefore ∑Di=−5\sum D_i=-5 and dˉ=−0.05\bar d=-0.05.
  2. Compute squared differences. Each discordant pair contributes 11, so ∑Di2=15\sum D_i^2=15. Use ∑(Di−dˉ)2=∑Di2−ndˉ2=15−0.25=14.75\sum(D_i-\bar d)^2=\sum D_i^2-n\bar d^2=15-0.25=14.75.
  3. Estimate variance and SE. sD2=14.75/99≈0.14899s_D^2=14.75/99\approx0.14899; sD/100≈0.03860s_D/\sqrt{100}\approx0.03860.
  4. Construct the interval. −0.05±1.96(0.03860)-0.05\pm1.96(0.03860), approximately [−0.12565,0.02565][-0.12565,0.02565].

The interval includes zero under this approximate procedure. That does not show that there is no change. It describes substantial uncertainty about the mean change. A before-and-after comparison without a suitable counterfactual also does not isolate the program's causal effect from other changes over time.

Correction to the supplied smoking summaries

The lecture lists marginal variance values 0.210.21 and 0.18750.1875, correlation 0.660.66, and difference variance 0.40.4. These cannot all describe the same paired data. The covariance identity would imply

Var⁡(A−B)=0.21+0.1875−2(0.66)×0.21(0.1875)≈0.13557,\begin{aligned}\operatorname{Var}(A-B)&=0.21+0.1875\\ &\quad-2(0.66)\\ &\quad{}\times\sqrt{0.21(0.1875)}\\ &\approx0.13557,\end{aligned}

rather than 0.40.4. Moreover, the marginal values use the plug-in Bernoulli convention rather than the n−1n-1 sample-variance correction. If one simply stipulates sD2=0.4s_D^2=0.4, the arithmetic gives [−0.17396,0.07396][-0.17396,0.07396]; that is a calculation conditional on an inconsistent supplied summary, not a verified interval for the original participants. The coherent table above makes every input and calculation inspectable.

3.5.4 Practise choosing the denominator

Exercise. Another table has the same 3030 before smokers and 2525 after smokers, but 2525 smoke at both times. Find the difference variance and compare its CI with the constructed table above.

Solution

There are 55 quitters, 00 starters and 9595 unchanged people. The mean remains −0.05-0.05, but ∑Di2=5\sum D_i^2=5. Thus sD2=(5−100(0.05)2)/99=4.75/99≈0.04798s_D^2=(5-100(0.05)^2)/99=4.75/99\approx0.04798, SE 0.04798/100≈0.02190\sqrt{0.04798/100}\approx0.02190, and the approximate Wald CI is [−0.09293,−0.00707][-0.09293,-0.00707]. Same marginal change, different uncertainty. With only five discordant pairs the normal approximation is fragile; an exact paired-binomial test is preferable to treating this result as definitive.

Exercise. Why is the single-proportion SE based on p^(1−p^)\hat p(1-\hat p), but the paired-change SE cannot be found from that expression applied to −0.05-0.05?

Solution

A Bernoulli variable takes values 0,10,1 and has a probability mean between zero and one. A paired difference takes −1,0,1-1,0,1, and its mean can be negative. Its variance depends on the proportion of discordant pairs, not just its mean. Compute sD2s_D^2 from the differences or from the full paired table.

3.6 Hypothesis testing and evidence

Calibrate a decision under a null model without reversing its probability

In this chapter

By the end you should be able to:

  • State null and alternative hypotheses about a population parameter, with the direction fixed in advance.
  • Explain Type I and Type II errors, the significance level and power.
  • Calculate a large-sample zz statistic and its p-value, and reach a decision at a stated level.
  • Interpret a p-value correctly and report a test result in context.

Builds on 3.3 Sampling distributions, LLN and CLT · 3.4 Confidence intervals for means · 2.7 Normal standardisation · 1.3 Independence and Bayes’ rule

3.6.1 State a claim about the population

A hypothesis concerns a population parameter, not the already observed statistic. “The population mean grade is 6666” is a testable claim H0:μ=66H_0:\mu=66. “The observed sample mean is 6464” is a description of data, not an uncertain population hypothesis.

For a two-sided test of a specified value, write

H0:θ=θ0,H1:θ≠θ0.H_0:\theta=\theta_0,\qquad H_1:\theta\ne\theta_0.

Here H0H_0 is the null hypothesis, H1H_1 the alternative, and θ0\theta_0 the numerical value hypothesised. A null of equal average A-level scores for two demographic groups has θ=μX−μY\theta=\mu_X-\mu_Y, θ0=0\theta_0=0. Equal outcome proportions across two groups similarly uses θ=pX−pY\theta=p_X-p_Y. A hypothetical COVID-19 mortality comparison must first define the population, denominator and time period consistently; naming two groups alone does not define comparable probabilities.

A one-sided alternative, such as θ>θ0\theta>\theta_0, asks a different question and puts rejection probability in one tail. Its null includes values θ≤θ0\theta\leq\theta_0; calibration commonly uses the boundary θ0\theta_0. Choose the direction before examining the result, rather than selecting whichever tail looks favourable.

3.6.2 Error rates describe repeated decisions

Truth and decision are distinct dimensions
Population truthFail to rejectReject
H0H_0 trueCorrect decisionType I error
H0H_0 falseType II errorCorrect detection

A Type I error rejects a true null. A Type II error fails to reject a false null. The significance level α\alpha controls the rejection probability under the null:

P(reject H0∣H0 true)≤α.P(\text{reject }H_0\mid H_0\text{ true})\leq\alpha.

Think first. A test at the 5%5\% level rejects the null. Is there now only a 5%5\% chance that the null is true?

Answer

No. The level bounds P(reject H0∣H0 true)P(\text{reject }H_0\mid H_0\text{ true}): how often the procedure rejects when the null is true. The question asks for P(H0 true∣reject)P(H_0\text{ true}\mid\text{reject}), which reverses the conditioning, as in Bayes’ rule (1.3). That reversed probability also depends on how often the hypotheses being tested are true and on the test’s power. A 5%5\% level therefore does not mean an observed rejection has a 5%5\% chance of being wrong.

At a specified alternative value θ\theta, the Type II probability is β(θ)\beta(\theta), read “beta at theta,” and power is 1−β(θ)1-\beta(\theta): the probability of rejecting there. Power depends on effect size, variation, sample size and the rejection rule. Lowering α\alpha with everything else fixed usually makes rejection harder and reduces power.

Before playing, predict: if a two-sided test at 5%5\% is made stricter, at 1%,1\%\text{,} what happens to its chance of detecting a real effect?The animation’s final frame. Its numbered steps describe how the picture is built.
  1. If H0H_0 is true, Z∼N(0,1).Z\sim N(0,1)\text{.} If the true mean lies 2.52.5 standard errors above the null value, Z∼N(2.5,1).Z\sim N(2.5,1)\text{.}
  2. At 5%,5\%\text{,} reject when ∣Z∣>1.96:|Z|>1.96\text{:} the red tails of the null curve have area 0.05.0.05\text{.} The power is the green area of the true curve beyond the cutoffs, Φ(0.54)≈0.705.\Phi(0.54)\approx0.705\text{.}
  3. Lower the level to 1%:1\%\text{:} the cutoffs move out to ±2.576.\pm2.576\text{.} The red tails shrink to 0.01,0.01\text{,} and the power falls to Φ(−0.076)≈0.470.\Phi(-0.076)\approx0.470\text{.}
  4. The yellow strip between 1.961.96 and 2.5762.576 is the power given up, about 0.235.0.235\text{.} A smaller Type I error bound costs power unless the sample size rises.

The trial analogy helps explain “fail to reject” versus “prove true”: an acquittal does not establish innocence. But the analogy does not make Type I errors universally worse. Error costs depend on the application, and statistical thresholds are not legal standards.

3.6.3 Build and calibrate the statistic

The test compares the observed distance from the null with the distance expected from sampling variation under that null. A common large-sample form is

Z=θ^−θ0SE⁡^0(θ^).Z=\frac{\hat\theta-\theta_0}{\widehat{\operatorname{SE}}_0(\hat\theta)}.

The subscript 00 stresses null calibration. The numerator is an effect in its original units; division expresses it in SE units. Under the assumptions of the relevant procedure, ZZ is approximately N(0,1)N(0,1) under H0H_0. A statistic far from zero is unusual under the whole null model, including its sampling and variance assumptions.

  1. State the estimand and hypotheses. Fix the subtraction direction and whether the alternative is one- or two-sided.
  2. Construct the statistic. Use the SE appropriate to the design and the null.
  3. State the null distribution and assumptions. Distinguish exact calibration from an approximation.
  4. Choose the level. For a two-sided normal test, reject when ∣Z∣>z1−α/2|Z|>z_{1-\alpha/2}; each tail has probability α/2\alpha/2.
  5. Report the decision in context. Give the estimated effect, uncertainty and evidence. Use “fail to reject,” not “accept” or “prove equal.”

Two-sided normal critical values are 1.6451.645 at 10%10\%, 1.9601.960 at 5%5\%, and 2.5762.576 at 1%1\%. For a pre-specified upper-sided 5%5\% test, the critical value is 1.6451.645. The same numerical cutoff can therefore have different meanings depending on the tail rule.

3.6.4 A p-value is a null-model tail area

Definition. A p-value is the probability, calculated under the null model, of a test statistic at least as extreme as the observed statistic according to the pre-specified alternative.

For a two-sided standard normal test with observed value zobsz_{\rm obs},

pval=2{1−Φ(∣zobs∣)}.p_{\rm val}=2\{1-\Phi(|z_{\rm obs}|)\}.

Here pvalp_{\rm val} labels a p-value; it is unrelated to a population proportion pp. For an upper-sided test use 1−Φ(zobs)1-\Phi(z_{\rm obs}); for a lower-sided test use Φ(zobs)\Phi(z_{\rm obs}). A small p-value indicates that the statistic is unusual under the null model.

Common mistake

Reading a p-value as the probability that the null is true. The p-value is calculated assuming the null model, so it cannot also be the probability of that model. Nor is it the probability that chance “caused” the observation, or that a future experiment will reproduce the result.

For a continuous calibrated statistic, the rule pval<αp_{\rm val}<\alpha matches the critical-value rule. Discrete exact tests can have attainable rejection probabilities below the nominal level; precise equality conventions can matter at a boundary. We use non-rejection at equality in the displayed continuous rules.

The shaded region represents outcomes at least as extreme under the selected alternative. Changing the alternative changes the tail area; the observed statistic alone does not define a p-value.

3.6.5One test from start to finish

Return to the grade sample from 3.4: n=100n=100 scripts, sample mean xˉ=64\bar x=64 and sample variance s2=8s^2=8. Suppose a department claims that the population mean grade is still 64.564.5. Follow the five steps of 3.6.3.

Worked example

  1. State the estimand and hypotheses. The estimand is the population mean grade μ\mu. Before looking at the result, choose a two-sided alternative: H0:μ=64.5H_0:\mu=64.5, H1:μ≠64.5H_1:\mu\ne64.5.
  2. Construct the statistic. The estimated SE is 8/100≈0.2828\sqrt{8/100}\approx0.2828, so z=64−64.50.2828≈−1.77.z=\frac{64-64.5}{0.2828}\approx-1.77. The sample mean lies 1.771.77 standard errors below the claimed value.
  3. State the null distribution and assumptions. With iid sampling and n=100n=100, ZZ is approximately N(0,1)N(0,1) under H0H_0. This is a large-sample approximation, not an exact result.
  4. Choose the level and compare. At α=0.05\alpha=0.05 the two-sided critical value is 1.9601.960, and ∣z∣=1.77<1.960|z|=1.77<1.960. Equivalently, pval=2{1−Φ(1.77)}≈0.077>0.05.\begin{aligned}p_{\rm val}&=2\{1-\Phi(1.77)\}\\&\approx0.077>0.05.\end{aligned}
  5. Report the decision in context. We fail to reject H0H_0 at 5%5\%. The sample mean is below 64.564.5, but a difference at least this large, in either direction, would occur in about 8%8\% of samples if the claim were true. Report the estimate, the 95%95\% interval [63.45,64.55][63.45,64.55] and pval≈0.077p_{\rm val}\approx0.077, not only the decision.
Before playing, predict: the sample mean lies 1.771.77 standard errors below the claimed 64.5.64.5\text{.} Is that significant in a two-sided test at 5%5\%?The animation’s final frame. Its numbered steps describe how the picture is built.
  1. If H0:μ=64.5H_0:\mu=64.5 were true, means of 100100 scores would vary around 64.564.5 with SE⁡=8/100≈0.2828.\operatorname{SE}=\sqrt{8/100}\approx0.2828\text{.} The observed mean is 64.64\text{.}
  2. Standardise: z=(64−64.5)/0.2828≈−1.77.z=(64-64.5)/0.2828\approx-1.77\text{.} The observed mean lies 1.771.77 standard errors below the claim.
  3. Two-sided, a result at least as extreme lies 1.771.77 or more standard errors away in either direction: p=2{1−Φ(1.77)}≈0.077.p=2\{1-\Phi(1.77)\}\approx0.077\text{.}
  4. At 5%5\% the cutoffs are ±1.96\pm1.96 and 0.077>0.05,0.077>0.05\text{,} so we fail to reject H0;H_0\text{;} at 10%,10\%\text{,} with cutoff 1.645,1.645\text{,} we would reject. The p-value is computed assuming H0,H_0\text{,} so it is not the probability that H0H_0 is true.

Two comparisons show what the decision depends on. At α=0.10\alpha=0.10 the critical value is 1.645<1.771.645<1.77, so the same data would reject: the level is part of the rule and must be fixed in advance. In 3.7.1 the same sample rejects the claim μ=65\mu=65, which lies 3.543.54 standard errors from xˉ\bar x. The interval [63.45,64.55][63.45,64.55] contains 64.564.5 but not 6565; 3.8 shows why intervals and tests agree in this way.

Common mistake

“We failed to reject, so μ=64.5\mu=64.5.” Non-rejection says the data are compatible with 64.564.5 at this level. They are also compatible with other values inside the interval, such as 64.064.0 or 64.364.3. Showing that a parameter is close to a value needs a pre-specified tolerance and a procedure designed for that question (3.6.6).

3.6.6 Significance, relevance and replication

A small effect can be statistically significant in a large precise sample; a consequential effect can remain uncertain in a small noisy sample. Report effect size and an interval alongside the test. Failure to reject zero is not an equivalence result. To establish practical equivalence, pre-specify a meaningful tolerance and use a procedure designed for that question.

Repeated testing also changes the chance of a false finding. Under 2020 independent true-null tests at 5%5\%, the probability of at least one rejection is 1−0.9520≈0.6421-0.95^{20}\approx0.642. Without independence, the union bound still gives an upper bound of 20×0.0520\times0.05, capped at 11. Choosing analyses after observing their p-values can therefore invalidate the promised error rate.

Replication examples and what their percentages mean

The 2015 Open Science Collaboration study examined 100100 studies from three psychology journals. It reported 36%36\% statistically significant replications and 39%39\% subjectively judged replications. These are different criteria; neither is a universal replication probability.

The 2016 economics replication study found a significant effect in the original direction in 1111 of 1818 laboratory studies, approximately 61%61\%, with other criteria giving other rates. A subsequent proposal advocated a 0.0050.005 threshold for claims of new discoveries. That proposal is not a theorem making one cutoff universally appropriate. Design, power, multiplicity, effect estimation and transparent analysis remain essential.

3.6.7Exercises

Try each question before opening any help. A hint points to the first step, the answer lets you check your result, and the full solution shows every step.

Exercise 1. A two-sided test gives z=1.5z=1.5 and p-value approximately 0.1340.134. At 5%5\%, can we say the null has probability 0.8660.866 or that the effect is zero?

Hint

Under which model is a p-value calculated? What does non-rejection allow you to say?

Answer

No to both. We fail to reject at 5%5\%, but that neither gives the null a probability nor shows that the effect is zero.

Full solution

No to both. The p-value is a probability of sufficiently extreme statistics under the null model, not a probability assigned to the hypothesis. Since 0.134>0.050.134>0.05, we fail to reject at the chosen level. The estimate and interval can still permit substantively important nonzero effects.

Exercise 2. A random sample of n=64n=64 scripts has mean xˉ=67.8\bar x=67.8 and sample standard deviation s=8s=8. (a) Test H0:μ=66H_0:\mu=66 against H1:μ≠66H_1:\mu\ne66 at 5%5\%. (b) What would the p-value be if the upper-sided alternative μ>66\mu>66 had been chosen before seeing the data? (c) Why may the upper-sided test not be chosen after seeing xˉ=67.8\bar x=67.8?

Hint

Start with SE⁡^=s/n\widehat{\operatorname{SE}}=s/\sqrt n. A two-sided p-value counts both tails; an upper-sided p-value counts one.

Answer

(a) z=1.8z=1.8 and pval≈0.072p_{\rm val}\approx0.072: fail to reject at 5%5\%. (b) pval≈0.036p_{\rm val}\approx0.036. (c) Choosing the tail after seeing the data makes the Type I error rate 10%10\%, not 5%5\%.

Full solution
  1. Standard error. SE⁡^=8/64=1\widehat{\operatorname{SE}}=8/\sqrt{64}=1.
  2. Statistic. z=(67.8−66)/1=1.8z=(67.8-66)/1=1.8.
  3. Two-sided p-value. 2{1−Φ(1.8)}≈2(0.036)=0.072>0.052\{1-\Phi(1.8)\}\approx2(0.036)=0.072>0.05, so we fail to reject at 5%5\%. Equivalently, 1.8<1.9601.8<1.960.
  4. Upper-sided p-value. 1−Φ(1.8)≈0.036<0.051-\Phi(1.8)\approx0.036<0.05. A pre-specified upper-sided test rejects, because its critical value is 1.6451.645.
  5. Why the tail must come first. If the tail is chosen to match the sign of zz, the procedure rejects whenever ∣Z∣>1.645|Z|>1.645. Under the null that happens with probability 2(0.05)=0.102(0.05)=0.10, double the stated level.

Exercise 3. A study keeps its sample size fixed but lowers the level of a two-sided normal test from 5%5\% to 1%1\%. Suppose the true mean lies 2.52.5 standard errors above the null value, so that ZZ is approximately N(2.5,1)N(2.5,1). Find the power at each level and explain the trade-off.

Hint

Power is the probability of rejection. Use the critical values 1.9601.960 and 2.5762.576, and find P(Z>c)P(Z>c) when Z∼N(2.5,1)Z\sim N(2.5,1); the opposite tail is negligible here.

Answer

Power is about 0.7050.705 at 5%5\% and 0.4700.470 at 1%1\%. The smaller Type I error bound costs power unless the sample size rises.

Full solution
  1. Standardise under the alternative. If Z∼N(2.5,1)Z\sim N(2.5,1), then P(Z>c)=1−Φ(c−2.5)=Φ(2.5−c)P(Z>c)=1-\Phi(c-2.5)=\Phi(2.5-c).
  2. Level 5%5\%. With c=1.960c=1.960, power ≈Φ(0.54)≈0.705\approx\Phi(0.54)\approx0.705. The lower tail adds Φ(−4.46)\Phi(-4.46), which is below 0.000010.00001.
  3. Level 1%1\%. With c=2.576c=2.576, power ≈Φ(−0.076)≈0.470\approx\Phi(-0.076)\approx0.470.
  4. Trade-off. The Type I error bound falls from 0.050.05 to 0.010.01, while the probability of detecting this effect falls from about 0.710.71 to 0.470.47. A stricter level can be worth it when false positives are costly. Keeping the power requires a larger sample, which shrinks the SE and moves the true mean further from the null value in SE units.

Exercise 4. A study tests 1010 independent outcomes, and every null hypothesis is true. Each test uses α=0.05\alpha=0.05. (a) Find the probability of at least one rejection. (b) Which per-test level α∗\alpha^\ast, read “alpha star”, keeps the union bound on that probability at 0.050.05, with or without independence?

Hint

For (a), use the complement: no rejection at all. For (b), the union bound adds the ten rejection probabilities.

Answer

(a) 1−0.9510≈0.4011-0.95^{10}\approx0.401. (b) α∗=0.05/10=0.005\alpha^\ast=0.05/10=0.005.

Full solution
  1. Complement. With independent tests, P(no rejection)=0.9510≈0.599P(\text{no rejection})=0.95^{10}\approx0.599.
  2. At least one rejection. 1−0.9510≈0.4011-0.95^{10}\approx0.401. With ten true nulls, at least one false finding has about a 40%40\% chance of appearing.
  3. Union bound. For any dependence between the tests, P(at least one rejection)≤10α∗P(\text{at least one rejection})\leq10\alpha^\ast. Setting 10α∗=0.0510\alpha^\ast=0.05 gives α∗=0.005\alpha^\ast=0.005.
  4. Check under independence. 1−0.99510≈0.049≤0.051-0.995^{10}\approx0.049\leq0.05. This adjustment is the Bonferroni correction. It controls the chance of any false rejection, at a cost in power for each test.

3.6.8Review

Check yourself

Choose an answer to see why it is right or wrong. Nothing is recorded.

1. A new teaching method truly raises mean grades, but a test fails to reject H0H_0: “no change”. What has happened?

Answer

(b) The null is false, because the method works, and the test did not reject it.

2. A two-sided test gives z=−2.3z=-2.3. What is its p-value?

Answer

(b) 2{1−Φ(2.3)}≈2(0.0107)=0.0212\{1-\Phi(2.3)\}\approx2(0.0107)=0.021. The sign of zz gives the direction; the two-sided p-value uses ∣z∣|z|.

3. A two-sided test at 5%5\% fails to reject H0:μ=64.5H_0:\mu=64.5, with pval≈0.077p_{\rm val}\approx0.077. Which conclusion is justified?

Answer

(c) The 95%95\% interval [63.45,64.55][63.45,64.55] lists the values a 5%5\% two-sided test would not reject.

4. With everything else fixed, which change increases the power of a test?

Answer

(b) A larger sample shrinks the SE, so the same true effect lies more standard errors from the null value.

Key ideas

  • A hypothesis is a claim about a population parameter. Fix H0H_0, H1H_1 and the direction before looking at the result.
  • The level α\alpha bounds the probability of rejecting a true null. It is not the probability that a rejection is wrong.
  • A test statistic measures the distance from the null value in standard errors: Z=(θ^−θ0)/SE⁡^0Z=(\hat\theta-\theta_0)/\widehat{\operatorname{SE}}_0.
  • A p-value is a tail area under the null model. Reject when pval<αp_{\rm val}<\alpha; never read it as the probability that H0H_0 is true.
  • “Fail to reject” is not “accept”. Report the estimate and an interval with the decision.
  • Power rises with the effect size and the sample size, and falls as α\alpha falls. Many tests, or tests chosen after seeing the data, inflate false findings.

3.7 Tests for means and proportions

Choose the sampling unit and calibrate the correct denominator

3.7.1 Three mean tests, one pattern

For means, the estimated SE typically does not depend on the hypothesised mean. Use the same independent or paired structure as in the matching confidence interval. The large-sample statistics are

single:Z=Xˉ−μ0s/n,independent:Z=(Xˉ−Yˉ)−δ0sX2/nX+sY2/nY,paired:Z=Dˉ−δ0sD/n.\begin{gathered}\text{single:}\\ Z=\frac{\bar X-\mu_0}{s/\sqrt n},\\ \text{independent:}\\ Z=\frac{(\bar X-\bar Y)-\delta_0}{\sqrt{s_X^2/n_X+s_Y^2/n_Y}},\\ \text{paired:}\\ Z=\frac{\bar D-\delta_0}{s_D/\sqrt n}.\end{gathered}

The numerator subtracts the hypothesised numerical difference δ0\delta_0, not the unknown true population difference. Under a null of equality it is zero. These normal references are approximate for generic iid data. The exact normal-population one-sample or paired procedure uses Student's tt; independent unequal-variance groups can use Welch's approximation.

Single mean: test the claim μ=65\mu=65

  1. Hypotheses. H0:μ=65H_0:\mu=65, H1:μ≠65H_1:\mu\ne65.
  2. Inputs and statistic. With n=100,xˉ=64,s2=8n=100,\bar x=64,s^2=8, SE is 8/100=0.28284\sqrt{8/100}=0.28284, and z=(64−65)/0.28284≈−3.5355z=(64-65)/0.28284\approx-3.5355.
  3. Calibration. Under the iid large-sample model, use standard normal tails. The two-sided p-value is approximately 0.0004070.000407.
  4. Decision. At α=0.05\alpha=0.05, ∣z∣>1.96|z|>1.96, so reject. The observed mean is lower than the claim; the matching interval [63.446,64.554][63.446,64.554] excludes 6565.

Independent means: the anchoring contrast

  1. Hypotheses and direction. Low minus high, H0:μX−μY=0H_0:\mu_X-\mu_Y=0 versus a nonzero difference.
  2. Statistic. The estimate is −13.6-13.6, SE is 86/43+253/46=7.5\sqrt{86/43+253/46}=\sqrt{7.5}, so z≈−4.9660z\approx-4.9660.
  3. Calibration and decision. Approximate two-sided normal p-value 6.83×10−76.83\times10^{-7}. Reject at 5%5\%; the matching interval [−18.968,−8.232][-18.968,-8.232] excludes zero.
  4. Scope. This is evidence about the response contrast under the stated group model. A p-value does not demonstrate accurate answers to the factual question or population representativeness.

Paired means: the examination contrast

  1. Sampling unit. Each of 7171 students contributes one exam-1-minus-exam-2 difference.
  2. Hypotheses. H0:μD=0H_0:\mu_D=0, H1:μD≠0H_1:\mu_D\ne0.
  3. Statistic. dˉ=−1.8\bar d=-1.8, SE 124.45/71≈1.32394\sqrt{124.45/71}\approx1.32394, so z≈−1.3596z\approx-1.3596.
  4. Decision. Approximate p-value 0.17400.1740. Since ∣z∣<1.96|z|<1.96, fail to reject at 5%5\%. The matching interval includes zero, but does not establish equality or identify why scores differ.

3.7.2 One proportion: use the null variance

Under H0:p=p0H_0:p=p_0, the Bernoulli variance is specified by the null, so the null SE is p0(1−p0)/n\sqrt{p_0(1-p_0)/n}. The large-sample score statistic is

Z=p^−p0p0(1−p0)/n.Z=\frac{\hat p-p_0}{\sqrt{p_0(1-p_0)/n}}.

This denominator differs from the Wald CI's estimated denominator. It gives the sampling scale of the proportion if the claim is true. Normal approximation requires adequate expected successes np0np_0 and failures n(1−p0)n(1-p_0). At p0=0p_0=0 or 11, the null distribution is degenerate and this quotient is not defined; use the model directly.

  1. Survey hypotheses. Test an evenly split population: H0:p=0.5H_0:p=0.5, H1:p≠0.5H_1:p\ne0.5.
  2. Null SE. With lecture inputs n=1502,p^=0.39n=1502,\hat p=0.39, use 0.5(0.5)/1502≈0.01290135\sqrt{0.5(0.5)/1502}\approx0.01290135.
  3. Statistic. z=(0.39−0.5)/0.01290135≈−8.5262z=(0.39-0.5)/0.01290135\approx-8.5262.
  4. Decision and assumptions. The normal-reference two-sided p-value is approximately 1.51×10−171.51\times10^{-17}, so reject at 5%5\% under this iid classroom approximation. This is not a reconstruction of an exact survey-design analysis from rounded percentages.
Supplement: an exact binomial reference

If KK is an integer success count from iid Bernoulli trials, then under the null K∼Binomial⁡(n,p0)K\sim\operatorname{Binomial}(n,p_0). An exact test sums probabilities of outcomes at least as extreme according to a specified ordering. Multiple two-sided conventions exist, so state the rule. A rounded reported percentage may not identify KK; do not invent a success count to claim an exact result.

3.7.3 Equality of independent proportions: pool under the null

For H0:pX=pYH_0:p_X=p_Y, the null imposes a common unknown value π\pi, read “pi.” Pool the observed successes to estimate it:

π^=nXp^X+nYp^YnX+nY,SE⁡^0=π^(1−π^)(1nX+1nY),Z=p^X−p^YSE⁡^0.\begin{aligned}\hat\pi&=\frac{n_X\hat p_X+n_Y\hat p_Y}{n_X+n_Y},\\ \widehat{\operatorname{SE}}_0&=\sqrt{\hat\pi(1-\hat\pi)\left(\frac1{n_X}+\frac1{n_Y}\right)},\\ Z&=\frac{\hat p_X-\hat p_Y}{\widehat{\operatorname{SE}}_0}.\end{aligned}

The pooled proportion is a sample-size-weighted mean, not generally the simple average of the two percentages. For exact counts it is total successes divided by total observations. Independent sampling permits the variance terms to add. Pooling is justified here by equality under the null; it is not a valid general recipe for H0:pX−pY=δ0≠0H_0:p_X-p_Y=\delta_0\ne0.

  1. Hypotheses. For the illustrative knowledge-question inputs, test H0:pX−pY=0H_0:p_X-p_Y=0 against a nonzero contrast.
  2. Pool. π^=(239×0.47+238×0.31)/477≈0.390168\hat\pi=(239\times0.47+238\times0.31)/477\approx0.390168.
  3. Null SE and numerator. SE ≈0.0446686\approx0.0446686. The numerator is 0.47−0.31=0.160.47-0.31=0.16, not 0.47−0.390.47-0.39.
  4. Test. z=0.16/0.0446686≈3.58193z=0.16/0.0446686\approx3.58193, with approximate two-sided p-value 0.0003410.000341. Reject equality at 5%5\% under the working model.

The independent-proportion confidence interval used an unpooled SE and answers an estimation question without imposing equality. These two conventional procedures may agree on many examples but are not exact inverses of one another.

3.7.4 Paired proportions: test changes within people

For the coherent illustrative smoking table, keep D=A−BD=A-B. Test H0:E[D]=0H_0:E[D]=0 against a nonzero mean change. The paired Wald statistic uses the observed difference variance:

Z=DˉsD/n.Z=\frac{\bar D}{s_D/\sqrt n}.
  1. Inputs. n=100,dˉ=−0.05,sD2=14.75/99n=100,\bar d=-0.05,s_D^2=14.75/99.
  2. Statistic. z=−0.05/0.0385992≈−1.29536z=-0.05/0.0385992\approx-1.29536.
  3. Normal-reference decision. Approximate two-sided p-value 0.19520.1952, so fail to reject at 5%5\%. The matching paired Wald CI includes zero.
  4. Limits. Discordant pairs number only 1515; the normal reference deserves caution. A before-and-after null of no marginal change is not the same as a demonstrated absence of causal program effects.

If one instead stipulates the inconsistent lecture summary's sD2=0.4s_D^2=0.4, the arithmetic gives z=−0.79057z=-0.79057 for after minus before, and also fails to reject. The sign reverses for before minus after, but the two-sided decision is unchanged. The stipulated variance cannot repair the contradictory paired summaries.

Supplement: why the exact McNemar test uses only discordant pairs

Under equality of the two marginal smoking probabilities, the probability of quitting equals the probability of starting. Conditional on being discordant, either direction therefore has probability 1/21/2. For independent pairs, conditional on mm discordant pairs, the number in one direction is Binomial⁡(m,1/2)\operatorname{Binomial}(m,1/2).

Our table has m=15m=15, with 55 starters and 1010 quitters. The two-sided equal-tail exact p-value is

2∑k=05(15k)2−15=0.3017578.2\sum_{k=0}^{5}{15\choose k}2^{-15}=0.3017578.

This exact conditional test also fails to reject at 5%5\%. Its p-value differs from the Wald normal approximation because the reference distribution and statistic differ. Always match an interval to the test actually chosen.

Exercise. A researcher pools the before and after percentages and uses the independent-proportions SE. What assumption has been inserted?

Solution

The calculation has treated measurements on the same person as independent groups, omitting their covariance. For paired data the variance of the difference depends on transitions. Use within-pair differences or a paired binary procedure, with independence between people as the relevant sampling assumption.

3.8 Matching confidence intervals and tests

An interval is the set of null values not rejected by a specified procedure

3.8.1 Invert the same test

Imagine repeating a test on the same observed data, but changing the proposed population value θ0\theta_0. Some values are too far from the estimate and rejected; others are not rejected. The set of values retained by a level-α\alpha test is its matching (1−α)(1-\alpha) confidence set.

This connection also explains coverage. For the true parameter θ\theta, exclusion from the inverted set happens exactly when its own null is rejected. If the test's Type I probability is at most α\alpha, the inverted set contains θ\theta with probability at least 1−α1-\alpha. Approximate tests yield approximate coverage; the inversion alone does not correct a poorly calibrated model.

A fixed estimated SE gives a symmetric interval

Suppose the test uses the same positive estimated SE ee for every proposed mean. At a two-sided normal level, non-rejection means

  1. Critical-value rule. ∣(θ^−θ0)/e∣≤c\left|(\hat\theta-\theta_0)/e\right|\leq c.
  2. Multiply by e>0e>0. −ce≤θ^−θ0≤ce-ce\leq\hat\theta-\theta_0\leq ce.
  3. Solve for the proposed value. θ^−ce≤θ0≤θ^+ce\hat\theta-ce\leq\theta_0\leq\hat\theta+ce.

The retained nulls form [θ^−ce,θ^+ce][\hat\theta-ce,\hat\theta+ce]. This is exactly the algebra behind the mean interval. It applies equally to an independent difference or a paired difference when the same SE and critical-value method are used.

For the single-mean example, the 95%95\% large-sample interval is [63.446,64.554][63.446,64.554]. A proposed μ0=64.2\mu_0=64.2 lies inside and is not rejected by the matching 5%5\% test; 6565 lies outside and is rejected. If μ0=xˉ−1.97e\mu_0=\bar x-1.97e, the statistic is +1.97+1.97, because subtracting a value below the estimate gives a positive numerator. Only the absolute magnitude controls a two-sided decision.

Vary the proposed null on fixed data. For a mean, the fixed SE produces a symmetric interval. For a proportion, the null-dependent score SE produces a Wilson interval instead of the Wald interval.

3.8.2 A null-dependent SE changes the interval

The one-proportion score test uses p0(1−p0)p_0(1-p_0) in its denominator. When we vary the proposed p0p_0, we vary its SE too. We therefore cannot invert this test merely by adding and subtracting a margin calculated at p^\hat p.

The following derivation is a supplement to the large-sample Wald approach. The score non-rejection inequality, for 0<p0<10<p_0<1, is

(p^−p0)2p0(1−p0)/n≤c2,n(p^−p0)2≤c2p0(1−p0).\begin{aligned}\frac{(\hat p-p_0)^2}{p_0(1-p_0)/n}&\leq c^2,\\ n(\hat p-p_0)^2&\leq c^2p_0(1-p_0).\end{aligned}
  1. Expand and collect terms in p0p_0. (n+c2)p02−(2np^+c2)p0+np^2≤0(n+c^2)p_0^2-(2n\hat p+c^2)p_0+n\hat p^2\leq0.
  2. Find the roots. The leading coefficient is positive, so the retained values lie between the two real quadratic roots.
  3. Write the roots as centre plus/minus margin. Set a=c2/na=c^2/n. Then
centre=p^+a/21+a,margin=c1+a×p^(1−p^)n+c24n2.\begin{gathered}\text{centre}=\frac{\hat p+a/2}{1+a},\\ \text{margin}=\frac{c}{1+a}\\ {}\times\sqrt{\frac{\hat p(1-\hat p)}n+\frac{c^2}{4n^2}}.\end{gathered}

These endpoints form the Wilson interval, the inversion of this score test. Unlike the Wald interval, its centre is pulled toward 1/21/2, and the margin remains positive when no successes or no failures are observed. Boundary points are included using the underlying degenerate-null model.

For a supplementary example of 00 successes in 1010 iid trials, the 95%95\% Wald interval is [0,0][0,0], while the Wilson interval is approximately [0,0.2775][0,0.2775]. Neither implies that a zero observed count proves the population probability zero. Wilson coverage is approximate, not exact at every finite-sample probability.

Similarly, the usual independent-proportion equality test pools under the null, while its common Wald difference CI does not. Do not claim exact duality between those mismatched procedures. A test obtained by inverting a specified difference interval will use that interval's own calibration; a score-based difference interval requires an appropriate constrained calculation.

3.8.3 What must match?

Test–interval duality requires the same data, target, sampling assumptions, SE construction, reference distribution, tail rule and level. A two-sided 5%5\% test matches a two-sided 95%95\% confidence set from that test. A one-sided 5%5\% test instead matches the appropriate one-sided 95%95\% bound. A tt test matches a tt interval with the same degrees of freedom, rather than a normal interval merely sharing a label.

Confidence intervals retain values not rejected by a procedure; they do not establish every retained value as equally plausible or true. Their width makes the remaining uncertainty visible. If zero lies inside a difference interval, examine which nonzero differences also remain compatible with the data before declaring an effect absent.

Exercise. A 95%95\% interval computed as θ^±1.96e\hat\theta\pm1.96e contains θ0\theta_0. Must every two-sided test of that value at 5%5\% fail to reject?

Solution

Only the matching test with statistic (θ^−θ0)/e(\hat\theta-\theta_0)/e and the same normal critical value must fail to reject. A procedure using a null-dependent variance, another distribution, another design, or another target need not agree. Duality connects one specified test to its own inverted confidence set.

Exercise. An interval for μX−μY\mu_X-\mu_Y is [−4.395,0.795][-4.395,0.795]. Give the interval for μY−μX\mu_Y-\mu_X and the corresponding decision for equality.

Solution

Negate and reorder the endpoints, giving [−0.795,4.395][-0.795,4.395]. Both include zero, so both matching two-sided equality tests fail to reject. The estimate's sign reverses; its SE, absolute test statistic and two-sided p-value remain unchanged.