Lemma
← All topics
Statistics

Hypothesis testing

Deciding whether evidence is strong enough.

Introduction

A hypothesis test asks whether data provide enough evidence to reject an assumption. You start by assuming nothing has changed (the null hypothesis H0H_0), work out how likely your observed result would be under that assumption, and reject H0H_0 only if the result would be very unlikely. This topic covers one- and two-tailed tests for a binomial proportion, critical regions, testing the mean of a normal distribution, and testing a correlation coefficient.

Why it matters

A drug company claims a new treatment works better than the old one. A coin seems to land heads too often. A factory wonders whether a machine has drifted. Each needs a fair way to decide when a difference is real and not just chance. Hypothesis testing is the standard method in science and medicine.

Intuitive explanation

IntuitionInnocent until proven guilty

H0H_0 is like the presumption of innocence. The data are the evidence. You only "convict" (reject H0H_0) if the evidence would be really surprising were H0H_0 true. If the evidence is not strong enough, you do not conclude H0H_0 is true: you just say there is insufficient evidence to reject it.

IntuitionThe significance level is how surprised you need to be

A 5% significance level means you reject H0H_0 if a result at least this extreme would happen less than 5% of the time under H0H_0.

Formal definitions

DefinitionHypotheses
  • Null hypothesis H0H_0: the parameter has its assumed value, e.g. H0:p=0.3H_0: p = 0.3.
  • Alternative hypothesis H1H_1: what you suspect, e.g. H1:p>0.3H_1: p > 0.3 (one-tailed) or H1:p≠0.3H_1: p \ne 0.3 (two-tailed).
DefinitionTest statistic, pp-value, critical region
  • Test statistic: the value calculated from the sample, used to decide.
  • pp-value: the probability, under H0H_0, of a result at least as extreme as the one observed.
  • Critical region: the set of values of the test statistic that lead to rejecting H0H_0. Its boundary is the critical value.
  • Actual significance level: the probability of the test statistic falling in the critical region when H0H_0 is true.

Notation

  • Hypotheses are always about a population parameter (pp, μ\mu or ρ\rho), never a sample statistic.
  • Xˉ∼N ⁣(μ,σ2n)\bar X \sim N\!\left(\mu, \dfrac{\sigma^2}{n}\right) for the mean of a sample of size nn from N(μ,σ2)N(\mu, \sigma^2).
  • rr is the sample correlation coefficient; ρ\rho the population one.

The procedure

MethodEvery test, in five steps
  1. State H0H_0 and H1H_1, defining the parameter.
  2. State the distribution of the test statistic under H0H_0.
  3. Calculate the pp-value (or find the critical region).
  4. Compare with the significance level. In a two-tailed test, compare each tail with half the level.
  5. Conclude in context, non-assertively: "There is sufficient evidence at the 5% level to suggest that..."

Key results

TheoremDistribution of the sample mean

If X∼N(μ,σ2)X \sim N(\mu, \sigma^2) then the mean of a random sample of size nn satisfies Xˉ∼N ⁣(μ,σ2n)\bar X \sim N\!\left(\mu, \frac{\sigma^2}{n}\right), so Z=Xˉ−μσ/n∼N(0,1)Z = \dfrac{\bar X - \mu}{\sigma/\sqrt n} \sim N(0, 1).

PropositionCorrelation test

For H0:ρ=0H_0: \rho = 0, compare ∣r∣|r| (or rr, for a one-tailed test) with the critical value from tables for the sample size and significance level.

Why the sample mean varies less

IntuitionAveraging cancels noise

Individual values scatter around μ\mu with standard deviation σ\sigma. In an average of nn values, high and low values partly cancel. The spread of the average shrinks to σn\frac{\sigma}{\sqrt n}: four times the data halves the spread. That is why larger samples detect smaller effects.

ProofThe variance of the sample mean

Let X1,…,XnX_1, \ldots, X_n be independent with mean μ\mu and variance σ2\sigma^2. By linearity, E(Xˉ)=1n∑E(Xi)=μE(\bar X) = \frac1n\sum E(X_i) = \mu. Independence makes the covariances vanish, so

Var⁡(Xˉ)=1n2∑i=1nVar⁡(Xi)=nσ2n2=σ2n.\operatorname{Var}(\bar X) = \frac1{n^2}\sum_{i = 1}^n\operatorname{Var}(X_i) = \frac{n\sigma^2}{n^2} = \frac{\sigma^2}{n}.

If the XiX_i are normal, so is any linear combination of them (a property of the normal distribution, best proved with moment generating functions), so Xˉ∼N ⁣(μ,σ2n)\bar X \sim N\!\left(\mu, \frac{\sigma^2}n\right) exactly. For other distributions the central limit theorem makes this approximately true for large nn.

∎
ProofWhy a test at level α\alpha rejects a true H0H_0 with probability at most α\alpha

For a continuous statistic the pp-value is uniform on [0,1][0, 1] under H0H_0 (Q51), so P(p≤α)=αP(p \le \alpha) = \alpha exactly. For a discrete statistic the rejection set is a tail whose probability is the pp-value of its boundary point, which is at most α\alpha (Q52). Either way, "reject when p≤αp \le \alpha" and "reject when the statistic is in the critical region" are the same rule.

∎
ProofLarger samples give more power

For the one-tailed zz-test of H0:μ=μ0H_0: \mu = \mu_0 at level α\alpha, the power at a true mean μ0+δ\mu_0 + \delta is

β=Φ ⁣(δnσ−zα)\beta = \Phi\!\left(\frac{\delta\sqrt n}{\sigma} - z_\alpha\right)

(Q54). It increases with δ\delta and with nn, tends to 11 as n→∞n \to \infty, and equals α\alpha when δ=0\delta = 0. Solving β≥1−β0\beta \ge 1 - \beta_0 gives the sample-size formula n≥((zα+zβ0)σ/δ)2n \ge \left((z_\alpha + z_{\beta_0})\sigma/\delta\right)^2 (Q55): the "four times the data halves the spread" rule in action.

∎

Methods

MethodFinding a critical region (binomial)

For an upper-tail test at 5%, find the smallest cc with P(X≥c)≤0.05P(X \ge c) \le 0.05. For a lower tail, the largest cc with P(X≤c)≤0.05P(X \le c) \le 0.05. Write both probabilities either side of the boundary to justify your choice.

MethodConcluding

Never say "H0H_0 is true" or "this proves". Say whether there is (or is not) sufficient evidence, and translate back into the context of the question.

Examples

ExampleA quick one-tailed test

H0:p=0.3H_0: p = 0.3, H1:p>0.3H_1: p > 0.3, X∼B(20,0.3)X \sim B(20, 0.3), observed x=10x = 10. P(X≥10)=0.048<0.05P(X \ge 10) = 0.048 < 0.05: reject H0H_0 at 5%.

The Worked examples tab has full model answers in exam format.

Common mistakes

Common mistakeUsing P(X=x)P(X = x)

The pp-value is P(X≥x)P(X \ge x) (or P(X≤x)P(X \le x)), not the probability of exactly the observed value.

Common mistakeForgetting to halve in a two-tailed test

At the 5% level, each tail is compared with 2.5%.

Common mistakeHypotheses about the sample

Write H0:p=0.3H_0: p = 0.3, not H0:p^=0.3H_0: \hat p = 0.3 or "H0:X=6H_0: X = 6".

Common mistakeOver-claiming

"There is evidence to suggest the coin is biased", not "the coin is biased".

Applications

  • Clinical trials: whether a treatment improves recovery rates.
  • Manufacturing: whether a machine's mean output has changed.
  • Science: whether two variables are genuinely correlated.

Connections

Summary

  • H0H_0 (assume no change) and H1H_1 (one- or two-tailed), about a population parameter.
  • Binomial: compare P(X≥x)P(X \ge x) or P(X≤x)P(X \le x) with the significance level (halve for two tails).
  • Critical region: values leading to rejection; actual significance is its probability under H0H_0.
  • Normal mean: Xˉ∼N(μ,σ2/n)\bar X \sim N(\mu, \sigma^2/n).
  • Conclude in context and non-assertively.

Worked examples

Try each one yourself first, then open the solution.

Example 1A one-tailed binomial test

A spinner is supposed to land on red with probability 0.30.3. Ali thinks it lands on red more often. In 20 spins it lands on red 10 times. Test Ali's claim at the 5% level.

Show the solution
  1. 1Hypotheses

    Let pp be the probability of red. H0:p=0.3H_0: p = 0.3, H1:p>0.3H_1: p > 0.3.

  2. 2Distribution under H0H_0

    X∼B(20,0.3)X \sim B(20, 0.3).

  3. 3pp-value

    P(X≥10)=1−P(X≤9)=1−0.9520=0.0480P(X \ge 10) = 1 - P(X \le 9) = 1 - 0.9520 = 0.0480.

  4. 4Compare

    0.0480<0.050.0480 < 0.05, so reject H0H_0.

  5. 5Conclusion in context

    There is sufficient evidence at the 5% level to suggest the spinner lands on red more often than 30% of the time.

Answer

Reject H0H_0: evidence that p>0.3p > 0.3

Example 2Finding a critical region

X∼B(25,0.4)X \sim B(25, 0.4). Find the critical region for a test of H0:p=0.4H_0: p = 0.4 against H1:p<0.4H_1: p < 0.4 at the 5% level, and the actual significance level.

Show the solution
  1. 1Lower tail probabilities

    P(X≤5)=0.0294P(X \le 5) = 0.0294, P(X≤6)=0.0736P(X \le 6) = 0.0736.

  2. 2Choose the boundary

    0.0294≤0.050.0294 \le 0.05 but 0.0736>0.050.0736 > 0.05.

  3. 3Critical region

    X≤5X \le 5; actual significance level 0.02940.0294 (2.94%).

Answer

X≤5X \le 5; actual significance 2.94%2.94\%

Example 3A two-tailed critical region

A coin is tossed 30 times to test whether it is fair, at the 5% level. Find the critical region.

Show the solution
  1. 1Hypotheses

    H0:p=0.5H_0: p = 0.5, H1:p≠0.5H_1: p \ne 0.5. Each tail at 2.5%2.5\%.

  2. 2Lower tail

    P(X≤9)=0.0214P(X \le 9) = 0.0214, P(X≤10)=0.0494P(X \le 10) = 0.0494: lower region X≤9X \le 9.

  3. 3Upper tail

    By symmetry, P(X≥21)=0.0214P(X \ge 21) = 0.0214: upper region X≥21X \ge 21.

  4. 4Critical region

    X≤9X \le 9 or X≥21X \ge 21. Actual significance 2×0.0214=0.04282 \times 0.0214 = 0.0428.

Answer

X≤9X \le 9 or X≥21X \ge 21

Example 4Testing a normal mean

Bags of flour have masses N(μ,62)N(\mu, 6^2) grams, with μ\mu supposed to be 500500. A sample of 16 bags has mean 502.7502.7 g. Test at the 5% level whether the mean has increased.

Show the solution
  1. 1Hypotheses

    H0:μ=500H_0: \mu = 500, H1:μ>500H_1: \mu > 500.

  2. 2Sampling distribution

    Under H0H_0, Xˉ∼N ⁣(500,3616)\bar X \sim N\!\left(500, \frac{36}{16}\right), standard deviation 1.51.5.

  3. 3pp-value

    z=502.7−5001.5=1.8z = \frac{502.7 - 500}{1.5} = 1.8; P(Xˉ≥502.7)=0.0359P(\bar X \ge 502.7) = 0.0359.

  4. 4Conclusion

    0.0359<0.050.0359 < 0.05: reject H0H_0. There is evidence that the mean mass has increased.

Answer

Reject H0H_0 (p=0.036p = 0.036)

Example 5Testing correlation

For 12 pairs of data, r=0.62r = 0.62. Test at the 5% level whether there is positive correlation. (Critical value for n=12n = 12, one-tailed 5%: 0.49730.4973.)

Show the solution
  1. 1Hypotheses

    H0:ρ=0H_0: \rho = 0, H1:ρ>0H_1: \rho > 0.

  2. 2Compare

    0.62>0.49730.62 > 0.4973, so rr lies in the critical region.

  3. 3Conclusion

    Reject H0H_0: there is evidence of positive correlation in the population.

Answer

Reject H0H_0

Beyond the specification

University-level ideas and the deeper mathematics behind this topic. Not needed for exams, but this is where the subject really opens up.

Optimal tests: the Neyman–Pearson lemma (university)

A test makes two kinds of mistake. A Type I error (rejecting a true H0H_0) has probability α\alpha, the size. A Type II error (keeping a false H0H_0) has probability 1−β1 - \beta, where β\beta is the power. Shrinking one usually grows the other, so the classical approach, due to Neyman and Pearson (1933), is to fix the size and then make the power as large as possible.

DefinitionTests as functions

A (possibly randomised) test is a function ϕ(x)∈[0,1]\phi(x) \in [0, 1]: the probability of rejecting H0H_0 when the data are xx. Its size is E0[ϕ(X)]E_0[\phi(X)] and its power is E1[ϕ(X)]E_1[\phi(X)], where E0E_0 and E1E_1 are expectations under the two hypotheses. An ordinary test has ϕ\phi taking only the values 00 and 11; the randomised test of Q58 has ϕ(8)=γ\phi(8) = \gamma.

TheoremNeyman–Pearson lemma

Let f0f_0 and f1f_1 be the densities (or probability functions) under simple hypotheses H0H_0 and H1H_1. For k≥0k \ge 0, let

ϕ∗(x)={1f1(x)>kf0(x),γf1(x)=kf0(x),0f1(x)<kf0(x),\phi^*(x) = \begin{cases}1 & f_1(x) > k f_0(x),\\ \gamma & f_1(x) = k f_0(x),\\ 0 & f_1(x) < k f_0(x),\end{cases}

with kk and γ\gamma chosen so that E0[ϕ∗]=αE_0[\phi^*] = \alpha. Then every test ϕ\phi with E0[ϕ]≤αE_0[\phi] \le \alpha has E1[ϕ]≤E1[ϕ∗]E_1[\phi] \le E_1[\phi^*].

Proof

For every xx, the product (ϕ∗(x)−ϕ(x))(f1(x)−kf0(x))≥0\big(\phi^*(x) - \phi(x)\big)\big(f_1(x) - kf_0(x)\big) \ge 0: where f1>kf0f_1 > kf_0, ϕ∗=1≥ϕ\phi^* = 1 \ge \phi; where f1<kf0f_1 < kf_0, ϕ∗=0≤ϕ\phi^* = 0 \le \phi; and where they are equal the product is 00. Integrating (or summing) over xx:

E1[ϕ∗]−E1[ϕ]≥k(E0[ϕ∗]−E0[ϕ])=k(α−E0[ϕ])≥0.■E_1[\phi^*] - E_1[\phi] \ge k\big(E_0[\phi^*] - E_0[\phi]\big) = k\big(\alpha - E_0[\phi]\big) \ge 0. \qquad\blacksquare
∎

The proof is a single inequality, yet it settles the question completely: reject where the likelihood ratio f1/f0f_1/f_0 is largest. Think of it as a budget problem. Each point xx "costs" f0(x)f_0(x) of the size budget α\alpha and "earns" f1(x)f_1(x) of power; the best buys are those with the highest earnings per unit cost.

DefinitionMonotone likelihood ratio

A family fθf_\theta has a monotone likelihood ratio in a statistic TT if, for θ1>θ0\theta_1 > \theta_0, the ratio fθ1(x)/fθ0(x)f_{\theta_1}(x)/f_{\theta_0}(x) is an increasing function of T(x)T(x).

TheoremKarlin–Rubin

If fθf_\theta has a monotone likelihood ratio in TT, then the test "reject when T>cT > c" (randomising at T=cT = c if needed), with size α\alpha at θ0\theta_0, is uniformly most powerful for H0:θ≤θ0H_0: \theta \le \theta_0 against H1:θ>θ0H_1: \theta > \theta_0.

The normal mean with known σ\sigma has a monotone likelihood ratio in xˉ\bar x (Q53), and the binomial has one in xx, since

fp1(x)fp0(x)=(1−p11−p0)n(p1(1−p0)p0(1−p1))x\frac{f_{p_1}(x)}{f_{p_0}(x)} = \left(\frac{1 - p_1}{1 - p_0}\right)^n\left(\frac{p_1(1 - p_0)}{p_0(1 - p_1)}\right)^x

increases in xx when p1>p0p_1 > p_0. So the one-tailed tests of this topic are the best possible tests. Karlin–Rubin also explains why the boundary value goes in H0H_0: the power function is increasing (Q56), so the largest Type I error over θ≤θ0\theta \le \theta_0 occurs at θ0\theta_0.

ExampleNo uniformly most powerful two-tailed test

For H1:μ≠μ0H_1: \mu \ne \mu_0, the most powerful test against μ1>μ0\mu_1 > \mu_0 rejects for large xˉ\bar x, and against μ1<μ0\mu_1 < \mu_0 for small xˉ\bar x. No single test can be best against both, so the symmetric two-tailed test is a compromise. It is the uniformly most powerful unbiased test: the best among tests whose power is never below α\alpha.

Likelihood ratio tests, confidence intervals and the correlation test (university)

Most real hypotheses are composite: the null leaves some parameters free (an unknown variance, say). The general recipe replaces each simple likelihood by its maximum.

DefinitionGeneralised likelihood ratio

For H0:θ∈Θ0H_0: \theta \in \Theta_0 inside a larger model Θ\Theta,

Λ(x)=sup⁡θ∈Θ0L(θ;x)sup⁡θ∈ΘL(θ;x)∈[0,1],\Lambda(x) = \frac{\sup_{\theta \in \Theta_0}L(\theta; x)}{\sup_{\theta \in \Theta}L(\theta; x)} \in [0, 1],

and H0H_0 is rejected when Λ\Lambda is small.

TheoremWilks' theorem

Under regularity conditions, if H0H_0 is true then

−2ln⁡Λ→dχd2(n→∞),-2\ln\Lambda \xrightarrow{d} \chi^2_d \quad (n \to \infty),

where d=dim⁡Θ−dim⁡Θ0d = \dim\Theta - \dim\Theta_0 is the number of parameters fixed by H0H_0.

ProofSketch

Write ℓ(θ)=ln⁡L(θ)\ell(\theta) = \ln L(\theta) and let θ^\hat\theta be the maximum likelihood estimate. In one dimension with Θ0={θ0}\Theta_0 = \{\theta_0\}, a Taylor expansion about θ^\hat\theta, where ℓ′(θ^)=0\ell'(\hat\theta) = 0, gives

−2ln⁡Λ=2(ℓ(θ^)−ℓ(θ0))≈−ℓ′′(θ^)(θ^−θ0)2.-2\ln\Lambda = 2\big(\ell(\hat\theta) - \ell(\theta_0)\big) \approx -\ell''(\hat\theta)(\hat\theta - \theta_0)^2.

Asymptotically θ^≈N ⁣(θ0,1nI(θ0))\hat\theta \approx N\!\left(\theta_0, \frac1{nI(\theta_0)}\right) and −ℓ′′(θ^)≈nI(θ0)-\ell''(\hat\theta) \approx nI(\theta_0), where II is the Fisher information. So −2ln⁡Λ≈Z2-2\ln\Lambda \approx Z^2 with Z∼N(0,1)Z \sim N(0, 1), which is χ12\chi^2_1. ■\blacksquare

∎
ExampleTesting a normal mean with σ\sigma unknown

For H0:μ=μ0H_0: \mu = \mu_0 with σ2\sigma^2 free, the maximised likelihoods give Λ=(σ^2/σ^02)n/2\Lambda = \left(\hat\sigma^2/\hat\sigma_0^2\right)^{n/2}, where σ^2=1n∑(xi−xˉ)2\hat\sigma^2 = \frac1n\sum(x_i - \bar x)^2 and σ^02=1n∑(xi−μ0)2=σ^2+(xˉ−μ0)2\hat\sigma_0^2 = \frac1n\sum(x_i - \mu_0)^2 = \hat\sigma^2 + (\bar x - \mu_0)^2. Hence

Λ−2/n=1+(xˉ−μ0)2σ^2=1+t2n−1,t=xˉ−μ0s/n,\Lambda^{-2/n} = 1 + \frac{(\bar x - \mu_0)^2}{\hat\sigma^2} = 1 + \frac{t^2}{n - 1}, \qquad t = \frac{\bar x - \mu_0}{s/\sqrt n},

so the likelihood ratio test is Student's tt-test, which is exact for every nn (Gosset, 1908).

TheoremTests and confidence intervals are the same thing

Suppose that for each θ0\theta_0 there is a test of H0:θ=θ0H_0: \theta = \theta_0 of size α\alpha with acceptance region A(θ0)A(\theta_0). Then

C(x)={θ0:x∈A(θ0)}C(x) = \{\theta_0 : x \in A(\theta_0)\}

is a 100(1−α)%100(1 - \alpha)\% confidence set, since Pθ(θ∈C(X))=Pθ(X∈A(θ))≥1−αP_\theta(\theta \in C(X)) = P_\theta(X \in A(\theta)) \ge 1 - \alpha. Conversely, a confidence interval gives a test: reject θ0\theta_0 when it lies outside the interval.

For instance, the two-tailed test of Q28 accepts μ0=150\mu_0 = 150 exactly when xˉ\bar x lies within 3.923.92 of it. Turned round, xˉ±3.92\bar x \pm 3.92 is the 95%95\% confidence interval for μ\mu: the μ0\mu_0 values that the data do not reject.

ExampleWhere the correlation tables come from

For bivariate normal data with ρ=0\rho = 0, the statistic T=rn−21−r2T = \frac{r\sqrt{n - 2}}{\sqrt{1 - r^2}} has a tn−2t_{n - 2} distribution. Equivalently, rr has density proportional to (1−r2)(n−4)/2(1 - r^2)^{(n - 4)/2} on (−1,1)(-1, 1), and inverting TT gives the critical values (Q57). For ρ≠0\rho \ne 0 the distribution of rr is skewed. Fisher's transformation

z=tanh⁡−1r=12ln⁡1+r1−r≈N ⁣(tanh⁡−1ρ,1n−3)z = \tanh^{-1} r = \tfrac12\ln\frac{1 + r}{1 - r} \approx N\!\left(\tanh^{-1}\rho, \frac1{n - 3}\right)

makes it nearly normal, which gives tests of H0:ρ=ρ0H_0: \rho = \rho_0 and confidence intervals for ρ\rho.

The correlation test also needs care with its assumptions. The tables assume a random sample from a bivariate normal population; with outliers or curved relationships, Spearman's rank correlation (which uses only the order of the data) is safer.

What p-values do not tell you: Bayes, multiple testing and replication (university)

A pp-value is P(data at least this extreme∣H0)P(\text{data at least this extreme} \mid H_0). Almost every misuse of hypothesis testing comes from treating it as something else.

TheoremBayes' theorem for hypotheses

With prior probability π0=P(H0)\pi_0 = P(H_0), the posterior odds against H0H_0 after seeing data xx are

P(H1∣x)P(H0∣x)=P(x∣H1)P(x∣H0)⋅1−π0π0=B10⋅1−π0π0,\frac{P(H_1 \mid x)}{P(H_0 \mid x)} = \frac{P(x \mid H_1)}{P(x \mid H_0)}\cdot\frac{1 - \pi_0}{\pi_0} = B_{10}\cdot\frac{1 - \pi_0}{\pi_0},

where B10B_{10} is the Bayes factor.

The pp-value is neither the Bayes factor nor the posterior probability. Q50 shows the gap directly: with 90%90\% of nulls true, 5%5\% tests with power 0.80.8 give a false discovery rate of 36%36\%.

ExampleLindley's paradox

Test H0:μ=0H_0: \mu = 0 against H1:μ∼N(0,τ2)H_1: \mu \sim N(0, \tau^2) with data Xˉ∼N(μ,1n)\bar X \sim N(\mu, \frac1n), and suppose z=n xˉz = \sqrt n\,\bar x is fixed at 1.961.96, so p=0.05p = 0.05 for every nn. The Bayes factor in favour of H0H_0 is

B01=1+nτ2 exp⁡ ⁣(−z22⋅nτ21+nτ2)→∞(n→∞).B_{01} = \sqrt{1 + n\tau^2}\,\exp\!\left(-\frac{z^2}{2}\cdot\frac{n\tau^2}{1 + n\tau^2}\right) \to \infty \quad (n \to \infty).

So with a large enough sample, a result "significant at 5%5\%" can be strong evidence for H0H_0. The reason: with huge nn, a just-significant xˉ\bar x is tiny, and such a small effect is better explained by μ=0\mu = 0 than by a typical μ\mu under H1H_1. Fixed significance levels ignore sample size; Bayes factors do not.

DefinitionError rates for many tests

When mm tests are run, let VV be the number of true nulls that are rejected and RR the total number of rejections.

  • Family-wise error rate: FWER=P(V≥1)\text{FWER} = P(V \ge 1). Bonferroni (each test at α/m\alpha/m) keeps it at most α\alpha under any dependence (Q59).
  • False discovery rate: FDR=E ⁣[Vmax⁡(R,1)]\text{FDR} = E\!\left[\frac{V}{\max(R, 1)}\right], the expected fraction of discoveries that are false.
TheoremBenjamini–Hochberg (1995)

Order the pp-values p(1)≤⋯≤p(m)p_{(1)} \le \cdots \le p_{(m)}, let kk be the largest ii with p(i)≤imqp_{(i)} \le \frac{i}{m}q, and reject the hypotheses with the kk smallest pp-values. If the tests are independent, FDR≤m0mq≤q\text{FDR} \le \frac{m_0}{m}q \le q, where m0m_0 is the number of true nulls.

Bonferroni suits a handful of tests where any false claim is costly. Benjamini–Hochberg suits screening thousands of genes or features, where some false leads are acceptable but they should be a controlled fraction of the discoveries.

ExampleOptional stopping and the garden of forking paths

In Q60, testing after 1010 tosses and again after 2020 raised the true size from 5%5\% to 5.43%5.43\%. With unlimited looks the law of the iterated logarithm guarantees that ∣z∣|z| eventually exceeds 1.961.96, so "keep collecting until p<0.05p < 0.05" rejects a true H0H_0 with probability 11. Choosing the tail after seeing the data (Q47), dropping awkward observations, or trying several analyses and reporting the best are the same mistake in disguise. Sequential methods (Wald's sequential probability ratio test, alpha-spending in clinical trials) handle repeated looks properly by planning them in advance.

These issues are behind the replication crisis: in 2015 a large collaboration repeated 100100 published psychology experiments and obtained significant results in only about 36%36\% of them. The response includes pre-registration (fixing hypotheses and analysis before collecting data), reporting effect sizes with confidence intervals rather than bare pp-values, larger samples (Q55), and in some fields stricter thresholds such as p<0.005p < 0.005, or the 5σ5\sigma rule (p≈3×10−7p \approx 3\times10^{-7}) used in particle physics for the Higgs boson.

Why does this work?

Why does this work?Why fix the significance level in advance?

The significance level is the probability of rejecting H0H_0 when it is true (a Type I error). If you look at the data first and then choose the test or the level that gives a "significant" result, that probability is no longer what you claim. Deciding in advance keeps the test honest.

Beyond the syllabus

Beyond the syllabusType II errors and power

A Type II error is failing to reject a false H0H_0. The power of a test is 1−P(Type II error)1 - P(\text{Type II error}), which depends on how far the truth is from H0H_0 and on the sample size. The Neyman–Pearson lemma shows that for testing one simple hypothesis against another, the most powerful test rejects when the likelihood ratio L(H1)L(H0)\frac{L(H_1)}{L(H_0)} is large.

Beyond the syllabusBayesian versus frequentist

A frequentist test asks how surprising the data would be if H0H_0 were true. A Bayesian assigns prior probabilities to hypotheses and updates them with Bayes' theorem, giving P(H0∣data)P(H_0 \mid \text{data}) directly. The two approaches can disagree strikingly: with huge samples a tiny pp-value can coexist with strong evidence for H0H_0 (Lindley's paradox).

Mathematical curiosities

Mathematical curiosityThe replication crisis

If 20 independent true null hypotheses are each tested at 5%, the chance that at least one is "significant" is 1−0.9520≈64%1 - 0.95^{20} \approx 64\%. Testing many hypotheses and reporting only the significant ones (pp-hacking) has led to many published results that later failed to replicate.

Further exploration

Further explorationInvestigations
  • For X∼B(20,p)X \sim B(20, p) with critical region X≥10X \ge 10, plot the power P(X≥10)P(X \ge 10) as a function of pp.
  • Look up the Bonferroni correction for multiple tests.
Now practise60 questions from Very easy to Extreme →