CalcPath
ProgressProblem setsFeedback
← Question sheet

Statistics · Solutions

Statistical Inference: Hypothesis Testing

12 questions · about 106 minutes

Work this sheet on paper, showing every step — the method is what is being tested, and the solutions are written so you can check your route rather than just your verdict. For every test, write down H0​, H1​ and the rejection region before you compute anything, name the theorem that gives the statistic its null distribution (“by the one-sample z-test”, “by the Neyman–Pearson lemma”, “by duality”), and state each conclusion in the form the theorem actually licenses. No calculator is needed: every critical value and every value of Φ you need is printed in the question, and every other number is exact. Full worked solutions are on a separate page; each question also has its own reveal, so you can check one answer without seeing the rest.

  1. 1.Computation

    A laboratory's assay is supposed to read a reference sample at 50 units. The measurement error is known to have standard deviation σ=6 units. A technician takes n=36 readings and obtains xˉ=52. Use z0.05​=1.645, z0.025​=1.96 and z0.005​=2.576.

    1. (a)Test H0​:μ=50 against H1​:μ>50 at α=0.05. State the rejection region before computing the statistic.
    2. (b)Now test H0​:μ=50 against the two-sided alternative, first at α=0.05 and then at α=0.01.
    3. (c)Write the 1% two-sided verdict in one correct sentence, and explain why the sentence “at the 1% level we accept that μ=50” is not licensed by the test.

    Solution

    (a) Set up, then compute. The hypotheses are H0​:μ=50 and H1​:μ>50. By the one-sample z-test the statistic Z=(Xˉ−μ0​)/(σ/n​) is standard normal under H0​, and for an upward alternative the rejection region is Z>z0.05​=1.645.

    The standard error is σ/n​=6/36​=1, so

    z=152−50​=2.

    Since 2>1.645, reject H0​ at the 5% level: the readings are consistent with the assay reading high.

    (b) Two-sided. The region is now ∣Z∣>zα/2​, and the statistic is unchanged, z=2.

    At α=0.05: ∣2∣>z0.025​=1.96, so reject.

    At α=0.01: ∣2∣<z0.005​=2.576, so fail to reject.

    The same data yield different verdicts because the standard of doubt is different, and that standard is fixed before the data are seen — it is not to be adjusted afterwards to reach a preferred verdict.

    (c) A correct sentence: “At the 1% level the data do not provide sufficient evidence that the assay's mean reading differs from 50.”

    The test controls one error only: the probability of rejecting a true null. It says nothing about how often it fails to reject a false one. Failing to reject can happen because H0​ is true or because the test lacks the power to see the departure — and here the second explanation is live, since z=2 is fairly unusual under H0​ (the 5% test rejected). Absence of evidence is not evidence of absence.

    If one wanted to argue that μ is close to 50, the tool is a confidence interval: the 99% interval is 52±2.576(1)=(49.42,54.58). It contains 50, but it also contains 54, which is hardly a demonstration that μ=50.

  2. 2.Computation

    A supplier claims that at most 20% of its components are defective. An inspector tests 400 components and finds 100 defective. Use z0.025​=1.96, z0.01​=2.326 and z0.005​=2.576.

    1. (a)Check that the normal approximation is usable, then test H0​:p=0.2 against H1​:p=0.2 at α=0.05.
    2. (b)At α=0.01, give the verdict of the one-sided test against H1​:p>0.2 and of the two-sided test. They differ. Under what circumstances is the one-sided verdict the legitimate one to report?
    3. (c)Explain why the standard error in a test of a proportion uses p0​ and not p^​. Then recompute the statistic with p^​ in the denominator, give the exact value, and say what it would have done to the one-sided 1% verdict.

    Solution

    (a) Under H0​, np0​=400(0.2)=80 and n(1−p0​)=320, both far above 5, so the normal approximation to the sample proportion applies.

    The observed proportion is p^​=100/400=0.25. The standard error is computed under the null:

    SE0​=np0​(1−p0​)​​=4000.2×0.8​​=4000.16​​=200.4​=0.02.

    So z=(0.25−0.20)/0.02=2.5. The two-sided rejection region is ∣Z∣>1.96, and 2.5>1.96, so reject H0​ at the 5% level.

    (b) One-sided against p>0.2: the region is Z>z0.01​=2.326, and 2.5>2.326, so reject. Two-sided: the region is ∣Z∣>z0.005​=2.576, and 2.5<2.576, so fail to reject.

    The one-sided verdict is legitimate only if the direction was fixed before the data were seen — for instance because the inspector's brief was specifically to detect a rate above the claimed one, and a rate below 20% would never have been reported as a violation however small. If the direction was chosen because p^​ happened to come out above 0.2, the procedure rejects whenever ∣Z∣>2.326, an event of probability 0.02 under H0​: it is a 2% test being reported as a 1% one.

    (c) The null hypothesis p=0.2 specifies the distribution of the count completely — Binomial(400,0.2) — and in particular its variance np0​(1−p0​). A test asks how surprising the data would be if H0​ held, so the null variance is the one to use. (An interval has no null value available, which is why it falls back on p^​.)

    With p^​ in the denominator, p^​(1−p^​)=0.25×0.75=0.1875, so

    z=0.1875/400​0.05​=0.1875​0.05×20​=0.1875​1​=316​​=3​4​≈2.31.

    It is smaller than 2.5 because 0.1875>0.16: the function p(1−p) is largest at p=21​, and 0.25 is nearer to 21​ than 0.2 is. Since 2.31<2.326, the one-sided 1% test would now fail to reject — the choice of denominator is not a technicality here, it changes the verdict.

  3. 3.Computation

    A quality engineer adopts the rule: reject H0​:μ=100 in favour of H1​:μ>100 whenever Xˉ>105, using n=16 observations from a population with σ=20. Use Φ(1)=0.8413, Φ(2)=0.9772 and z0.05​=1.645.

    1. (a)Find the significance level α of this rule.
    2. (b)Find the Type II error probability β and the power when the true mean is 110, and again when it is 115. In each case say which mean you standardise with, and why.
    3. (c)Keeping the rule “reject when Xˉ>105” fixed, find the smallest n for which α≤0.05. Show that at that n the Type II error at μ=110 is also smaller than in (b), and reconcile this with the statement that α and β trade against each other.

    Solution

    (a) The standard error is σ/n​=20/16​=5. The significance level is the rejection probability computed under H0​, so standardise with μ0​=100:

    α=P(Xˉ>105∣μ=100)=P(Z>5105−100​)=P(Z>1)=1−Φ(1)=0.1587.

    This is a lax rule: it convicts a correctly calibrated process about one time in six.

    (b) A Type II error is failing to reject when the alternative holds, so the probability is computed under the true mean, not under μ0​: it is Xˉ that is normal with mean μ1​, and it is (Xˉ−μ1​)/5 that is standard normal.

    At μ1​=110:

    β=P(Xˉ≤105∣μ=110)=P(Z≤5105−110​)=P(Z≤−1)=1−Φ(1)=0.1587,

    so the power is Φ(1)=0.8413. (That α=β here is not a coincidence: the cutoff 105 sits exactly halfway between 100 and 110, one standard error from each.)

    At μ1​=115: β=P(Z≤−2)=1−Φ(2)=0.0228, so the power is 0.9772. Power rises with the distance of the alternative from the null, as it must.

    (c) With the cutoff fixed and n free, σ/n​=20/n​ and

    α(n)=P(Z>20/n​5​)=1−Φ(4n​​).

    We need n​/4≥z0.05​=1.645, i.e. n​≥6.58, i.e. n≥6.582=43.30. So the smallest n is 44.

    At n=44 the Type II error at μ=110 is

    β=P(Z≤20/44​105−110​)=P(Z≤−444​​)=1−Φ(444​​),

    and since 44​/4>16​/4=1, this is less than 1−Φ(1)=0.1587. Both errors fell.

    There is no contradiction. The trade-off is a statement about the cutoff at fixed n: sliding 105 upward lowers α and raises β, and vice versa. Increasing n shrinks the standard error, so the sampling distributions under μ=100 and μ=110 both tighten around their means and overlap less; the tail of each beyond 105 shrinks at once. Sample size is the lever that relaxes the trade-off, which is exactly why it is computed before a study, not after.

  4. 4.Computation

    A process has nominal mean μ0​=20 and known σ=8. A sample of n=64 gives xˉ=21.5. Use Φ(1.5)=0.9332.

    1. (a)Compute the p-value against H1​:μ>20 and the p-value against H1​:μ=20. Write each as a probability statement about the test statistic before you evaluate it.
    2. (b)Give all four verdicts: each alternative at α=0.10 and at α=0.05.
    3. (c)A colleague writes: “p=0.0668, so the probability that the mean really is 20 is about 6.7%, and there is a 93.3% chance the effect is real.” Say precisely what the p-value does assert, then explain why each half of the colleague's sentence is wrong.

    Solution

    (a) The standard error is 8/64​=1, so z=(21.5−20)/1=1.5.

    Against H1​:μ>20, “at least as extreme” means at least as far above 0, so

    p=P(Z≥1.5∣H0​)=1−Φ(1.5)=0.0668.

    Against H1​:μ=20, deviations of either sign count, so by symmetry of the normal

    p=P(∣Z∣≥1.5∣H0​)=2(1−Φ(1.5))=0.1336.

    (b) The rule is: reject exactly when p≤α.

    One-sided: 0.0668≤0.10, reject at 10%; 0.0668>0.05, fail to reject at 5%.

    Two-sided: 0.1336>0.10 and 0.1336>0.05, fail to reject at both levels.

    The one-sided verdicts are only available if the upward direction was specified before the data; otherwise the two-sided pair is the honest report.

    (c) What p=0.0668 asserts: if the true mean were exactly 20, a sample of 64 would produce a mean at least 1.5 units above 20 about 6.7% of the time. It is a probability of data, computed assuming H0​.

    First half. “The probability that the mean is 20” is P(H0​∣data), which conditions in the opposite direction. Converting from P(data∣H0​) to P(H0​∣data) needs Bayes' theorem and a prior probability for H0​, and the p-value contains no such thing. The two numbers can differ enormously.

    Second half. 1−p is not the probability of anything about the hypotheses. Under a true null the p-value is uniform on (0,1), so 1−p is a uniform random number — it is not a level of confidence in H1​. The sentence is also internally inconsistent: the two-sided p is 0.1336, and the same reasoning would then give the effect an 86.6% chance of being real, so the “probability the effect is real” would depend on which alternative the colleague happened to write down.

  5. 5.Sketch

    A one-sided z-test of H0​:μ=10 against H1​:μ>10 is run at α=0.05 with σ=6. Use z0.05​=1.645 and z0.20​=0.8416.

    A sketch with no formula beside it earns nothing here: every feature you draw must be justified by an equation or a limit.

    1. (a)For n=9, write the power as an explicit function of the true mean μ1​, and find the values of μ1​ at which the power equals 0.05, 0.5 and 0.8.
    2. (b)Do the same for n=36.
    3. (c)Sketch both power curves on one pair of axes for 8≤μ1​≤18. Mark the three labelled points on each curve, the horizontal line at height α, and the behaviour for μ1​<10. State the shape of each curve and where it is steepest, and explain in one sentence how the n=36 curve is obtained geometrically from the n=9 curve.

    Solution

    (a) For n=9 the standard error is 6/9​=2, so the test rejects when Xˉ>10+1.645(2)=13.29. By the theorem on the power of the one-sided z-test,

    power(μ1​)=1−Φ(1.645−2μ1​−10​).

    Power 0.05: we need Φ(⋅)=0.95, so the argument is 1.645, so μ1​=10. The power at the null is the significance level, always.

    Power 0.5: the argument must be 0, so (μ1​−10)/2=1.645, giving μ1​=13.29 — the critical value itself. A true mean sitting exactly on the cutoff is detected half the time.

    Power 0.8: we need Φ(a)=0.2, so a=−z0.20​=−0.8416. Then (μ1​−10)/2=1.645+0.8416=2.4866, giving μ1​=10+4.973=14.97.

    (b) For n=36 the standard error is 1, the cutoff is 11.645, and

    power(μ1​)=1−Φ(1.645−(μ1​−10)).

    The three points are μ1​=10 (power 0.05), μ1​=11.645 (power 0.5) and μ1​=10+2.4866=12.49 (power 0.8).

    (c) Rewrite each curve using 1−Φ(a)=Φ(−a):

    power(μ1​)=Φ(SEμ1​−10​−1.645)=Φ(SEμ1​−c​),c=10+1.645SE.

    So each power curve is a normal distribution function in μ1​, centred at the critical value c with scale SE: an increasing S-shape, rising from 0 on the far left to 1 on the far right, steepest at its centre where the power is 0.5 (at μ1​=13.29 for n=9 and 11.645 for n=36), and symmetric about that point.

    The sketch: horizontal axis μ1​ from 8 to 18, vertical axis from 0 to 1, a dashed horizontal line at 0.05. Both curves pass through the point (10,0.05) where they cross the dashed line, since power at the null equals α whatever n is. To the left of 10 both curves lie below the dashed line and flatten toward 0: at μ1​=8 the n=9 curve is Φ(−2.645), essentially zero, and the n=36 curve is Φ(−3.645), smaller still — a true mean below the null is almost never “detected” as being above it. To the right, the n=9 curve passes through (13.29,0.5) and (14.97,0.8) and is close to 1 by μ1​=18 (there it is Φ(2.355)≈0.99); the n=36 curve passes through (11.645,0.5) and (12.49,0.8) and is visually 1 from about μ1​=14 on.

    Geometry: since (μ1​−10)/1=2⋅(μ1​−10)/2, the n=36 curve at μ1​ equals the n=9 curve at 10+2(μ1​−10). The n=36 curve is the n=9 curve compressed horizontally by a factor of 2 toward the pivot μ1​=10 — quadrupling the sample halves the effect size that can be detected at any given power, which is the n​ law.

  6. 6.Computation

    A single observation X is drawn from the density f(x;θ)=θxθ−1 on 0<x<1, so that θ=1 is the uniform distribution and the distribution function is F(x;θ)=xθ. Throughout, α=0.10.

    1. (a)Construct the most powerful level-0.10 test of H0​:θ=1 against H1​:θ=2. State the likelihood ratio, the direction in which it is monotone, the rejection region in terms of X, and the power.
    2. (b)A colleague proposes instead: reject when X<0.1. Verify that this test also has level 0.10, compute its power against θ=2, and explain what the comparison with (a) illustrates. Comment on the fact that its power is below its level.
    3. (c)Now construct the most powerful level-0.10 test of H0​:θ=1 against H1​:θ=21​, and give its power exactly. Then say whether a uniformly most powerful test exists against H1​:θ=1, and why.

    Solution

    (a) The likelihood ratio of H1​ to H0​ is

    Λ(x)=f(x;1)f(x;2)​=12x​=2x,

    strictly increasing in x. So {Λ>k} is the event {X>c} for a corresponding constant c, and by the Neyman–Pearson lemma the most powerful test rejects for large X.

    Choose c for level 0.10 under H0​, where X is uniform: P(X>c)=1−c=0.10, so c=0.9.

    Power: under θ=2, F(x)=x2, so

    P(X>0.9∣θ=2)=1−0.92=1−0.81=0.19.

    By the lemma, no level-0.10 test has power above 0.19 against θ=2.

    (b) Level: under H0​, P(X<0.1)=0.1 ✓. Power: under θ=2, P(X<0.1)=0.12=0.01.

    So a test of the same level has power 0.01 against 0.19: the two tests spend the same Type I budget, and the likelihood-ratio test buys nineteen times as much power with it. This is the content of the lemma — controlling α is a constraint every admissible test satisfies, not a criterion for choosing among them, and the likelihood ratio tells you where to place the rejection region.

    The power 0.01 is below the level 0.10: this test is more likely to reject when H0​ is true than when H1​ is true, so its rejections are evidence in favour of the null. The reason is visible in the densities: θ=2 has density 2x, which puts very little mass near 0, so a small observation is evidence for the uniform and against θ=2. The colleague has the direction backwards.

    (c) Now

    Λ(x)=f(x;1)f(x;21​)​=121​x−1/2​=2x​1​,

    strictly decreasing in x. So {Λ>k} is {X<c}: the most powerful test rejects for small X. Under H0​, P(X<c)=c=0.10, so c=0.1.

    Power: under θ=21​, F(x)=x1/2, so

    P(X<0.1∣θ=21​)=0.1​=10​1​≈0.316.

    (The density 2x​1​ is unbounded near 0, which is why small observations are the evidence here.)

    No uniformly most powerful test exists against θ=1. The most powerful test against any θ1​>1 rejects for large X — the ratio θ1​xθ1​−1 is increasing whenever θ1​>1 — while the most powerful test against any θ1​<1 rejects for small X. A single rejection region cannot be the upper tail and the lower tail at once, so no one test is best against both sides simultaneously.

  7. 7.Critique

    A student pre-registers a two-sided z-test of H0​:μ=μ0​ at α=0.05, collects the data, and obtains z=1.8. Using Φ(1.8)=0.9641, the write-up reads:

    Step 1. The two-sided p-value is 2(1−Φ(1.8))=2(0.0359)=0.0718, which exceeds 0.05.

    Step 2. However, xˉ came out above μ0​, so the effect is clearly in the positive direction and the appropriate test is one-sided. The one-sided p-value is 0.0359<0.05, so we reject H0​.

    Step 3. There is therefore only a 3.6% chance that H0​ is true. The effect is real with probability 96.4%, and a replication of the study would succeed with the same probability.

    Step 1 is correct. Nothing after it is.

    1. (a)Identify every error in Steps 2 and 3. For each, name the definition or theorem it violates and say exactly what the quantity in question actually is.
    2. (b)Compute the true Type I error rate of the procedure used in Step 2 — “test one-sided at 5% in whichever direction the data point” — and then give the correct verdict and a correct one-sentence report of the result.

    Solution

    (a) There are four distinct errors.

    Step 2: the direction was chosen from the data. The one-sided test's guarantee — level exactly α — is a statement about a rejection region fixed before the data are seen. The sentence “the effect is clearly in the positive direction” assumes the conclusion: under H0​, xˉ lands above μ0​ half the time, so the sign of xˉ−μ0​ is not evidence of a direction. Picking the tail after looking at the sign is the error the chapter's caution on one-sided tests is about; its true level is computed in (b).

    Step 3, first clause: “3.6% chance that H0​ is true.” By definition, p=P(T at least as extreme as tobs​∣H0​): a probability of data, computed assuming the null. The clause describes P(H0​∣data), which conditions the other way round and requires a prior for H0​ via Bayes' theorem. The p-value contains no prior and cannot be converted without one.

    Step 3, second clause: “real with probability 96.4%.” 1−p is not P(H1​∣data), for the same reason, and it is not a probability of anything about the hypotheses. Under a true null, p is uniform on (0,1) by the theorem that the p-value is uniform under the null, so 1−p is a uniform random number.

    Step 3, third clause: replication. The probability that a replication reaches significance is the power of the replication, which depends on the true effect size and the replication's sample size, neither of which p encodes. If H0​ is in fact true, a replication “succeeds” with probability α=0.05 — that is what uniformity of p under the null means — and if H0​ is false the probability could be anything from near 0 to near 1.

    (b) The procedure rejects whenever the one-sided p in the observed direction is below 0.05, i.e. whenever Z>z0.05​ or Z<−z0.05​, i.e. whenever ∣Z∣>1.645. Under H0​,

    P(∣Z∣>1.645)=P(Z>1.645)+P(Z<−1.645)=0.05+0.05=0.10.

    So the “5% test” of Step 2 is a 10% test: choosing the direction after the fact doubles the Type I error rate while reporting the nominal one. (Equivalently, the honest p-value for this procedure is the two-sided one, 0.0718.)

    Correct verdict: the pre-registered test was two-sided, p=0.0718>0.05, so fail to reject H0​ at the 5% level. A correct report: “z=1.80, two-sided p=0.072; the data do not provide sufficient evidence at the 5% level that μ differs from μ0​.” Failing to reject is not a finding that μ=μ0​, and a confidence interval for μ would say more than the verdict does — it would show the size of the estimated effect and how imprecisely it is pinned down.

  8. 8.Computation

    Nine subjects have a reading taken before and after a treatment.

    subjectbeforeafter​14040​25253​33839​46164​54548​65559​74751​83338​95864​​

    Use t0.025,8​=2.306 and t0.025,16​=2.120. Assume the differences are approximately normal.

    1. (a)Form the differences Di​=afteri​−beforei​, compute dˉ and sd​ exactly, and test H0​:μD​=0 against H1​:μD​=0 at α=0.05.
    2. (b)Write down the 95% confidence interval for μD​ and show, by rearranging the inequality, that it gives the same verdict as (a) — and what it says that the verdict does not.
    3. (c)A colleague ignores the pairing and treats the two rows as independent samples of size 9. Each row has standard deviation close to 10 (the exact values are 9.6 and 10.3); take sp​=10. Compute the colleague's statistic exactly, give its verdict, and explain which analysis is valid and why the two disagree so sharply.

    Solution

    (a) Differences. After minus before, subject by subject: 0,1,1,3,3,4,4,5,6. Their sum is 27, so dˉ=27/9=3.

    Deviations from 3: −3,−2,−2,0,0,1,1,2,3; their squares 9,4,4,0,0,1,1,4,9 sum to 32. Hence

    sd2​=9−132​=4,sd​=2.

    The test. By the paired t-test — the one-sample t-test applied to the differences — the statistic T=Dˉ/(Sd​/n​) is t8​ under H0​:μD​=0. The standard error is 2/9​=2/3, so

    t=2/33​=4.5on 8 degrees of freedom.

    The two-sided region is ∣T∣>2.306, and 4.5>2.306, so reject H0​ at the 5% level: the treatment changes the reading.

    (b) The 95% interval is

    dˉ±t0.025,8​n​sd​​=3±2.306⋅32​=3±1.537=(1.46, 4.54).

    Duality: the test rejects exactly when ∣dˉ−0∣/(sd​/n​)>t0.025,8​, and multiplying through by the positive sd​/n​ this is ∣dˉ−0∣>1.537, i.e. 0 lies outside dˉ±1.537. Zero is indeed outside (1.46,4.54), so the interval rejects too — the same inequality read two ways.

    What it adds: the test says “not zero”; the interval says the mean improvement is somewhere between about 1.5 and 4.5 units, which is the effect size and its precision, neither of which t=4.5 reports.

    (c) The difference of the row means is the mean of the differences, so the numerator is again 3. With sp​=10 and n1​=n2​=9 the pooled standard error is

    sp​91​+91​​=1092​​=3102​​≈4.71,

    so the colleague's statistic is

    t=102​/33​=102​9​=2092​​≈0.64on 9+9−2=16 degrees of freedom.

    Since 0.64<2.120, the colleague fails to reject — nowhere near significance.

    The paired analysis is the valid one. The two-sample t-test assumes the two samples are independent, and they are not: they are the same nine people measured twice. The disagreement is not a matter of taste but of a violated hypothesis.

    Why so sharp: the readings vary a great deal between subjects (from 33 to 61 before treatment — a spread of about 10), but that variation is common to both of a subject's readings and cancels completely in the difference, whose spread is only sd​=2. The unpaired analysis leaves the between-subject noise in the denominator, inflating the standard error by a factor of 2/3102​/3​=52​≈7, and a real effect of 3 units disappears into it.

  9. 9.Computation

    Use χ0.05,32​=7.815, χ0.05,12​=3.841 and χ0.01,12​=6.635.

    1. (a)A genetic model predicts that four phenotypes occur in the ratio 9:3:3:1. Among 160 plants the observed counts are 100, 25, 27, 8. Test the model at α=0.05, giving X2 as an exact fraction, and state the conclusion in the form the test licenses.
    2. (b)Fifty patients receive treatment A and fifty receive treatment B. Under A, 36 recover and 14 do not; under B, 24 recover and 26 do not. Test whether recovery is independent of treatment at α=0.05 and at α=0.01.
    3. (c)Explain why the degrees of freedom are 3 in (a) but 1 in (b), and why all four deviations Oij​−Eij​ in (b) have the same magnitude. Then state the condition under which the χ2 approximation is trusted, and decide whether the test in (a) would still be usable if the same ratios had been observed in a sample of 40 plants.

    Solution

    (a) Under H0​ the category probabilities are 169​,163​,163​,161​, so the expected counts are Ei​=160pi​:

    E=90, 30, 30, 10,

    all at least 5. The deviations Oi​−Ei​ are 10,−5,−3,−2 (they sum to 0, as they must). By the chi-square goodness-of-fit theorem,

    X2=90100​+3025​+309​+104​=910​+65​+103​+52​=90100+75+27+36​=90238​=45119​≈2.64.

    No parameter was estimated, so df=k−1−m=4−1−0=3. Since 2.64<7.815, fail to reject: the counts are consistent with 9:3:3:1. What is licensed is “not shown to depart from the model”, not “the model is confirmed”; and the scale is reassuring, since the mean of a χ32​ is 3 and 2.64 is entirely typical of what the model itself would produce.

    (b) The row totals are 50 and 50, the column totals 60 (recovered) and 40 (not), and n=100. By the proposition on the test for independence, Eij​=(row total)(column total)/n:

    E11​=10050⋅60​=30,E12​=20,E21​=30,E22​=20,

    all at least 5. The deviations are 36−30=6, 14−20=−6, 24−30=−6, 26−20=6, so

    X2=3036​+2036​+3036​+2036​=1.2+1.8+1.2+1.8=6.

    With df=(2−1)(2−1)=1: 6>3.841, so reject independence at 5%; 6<6.635, so fail to reject at 1%. The recovery rates are 72% under A and 48% under B; the evidence that they differ is moderate, not overwhelming.

    (c) Degrees of freedom. Each counts the freely varying deviations. In (a) there are 4 categories and one constraint (the counts sum to 160), and the null specifies every probability outright, so nothing is estimated: 4−1=3. In (b) there are 4 cells and the same one constraint, but the null “independence” does not specify the cell probabilities — the two marginal proportions (row and column) are estimated from the data, costing one degree each: 4−1−2=1, which is (r−1)(c−1).

    Equal magnitudes. With the margins fixed, the whole table is determined by one cell: O12​=50−O11​, O21​=60−O11​, O22​=O11​−10. Since the expected counts satisfy the same margins, every deviation is ±(O11​−E11​)=±6. One free cell is another way of seeing df=1.

    The condition. The χ2 distribution is an approximation, trusted when every expected count is at least about 5; the condition is on expected counts, not observed ones. With n=40 the expected counts under 9:3:3:1 would be 22.5, 7.5, 7.5, 2.5, and the last is below 5: the statistic is discrete and skewed where χ32​ is continuous, and the test would reject too often. The remedy is an exact multinomial test or more data — not pooling the rare category into another, which changes the hypothesis being tested.

  10. 10.Proof

    Let X1​,…,Xn​ be i.i.d. Poisson(λ), so P(Xi​=x)=λxe−λ/x!. Use e−1≈0.3679 and e−2≈0.1353 in part (c) only.

    1. (a)For λ1​>λ0​, write the likelihood ratio Λ of H1​:λ=λ1​ to H0​:λ=λ0​ in terms of S=∑i​Xi​, and prove that the Neyman–Pearson test rejects for large S.
    2. (b)Prove that the test in (a) is uniformly most powerful against the composite alternative λ>λ0​, and explain why no uniformly most powerful test exists against λ=λ0​.
    3. (c)Take n=1 and λ0​=1. Show that the rule “reject when X≥3” has level 1−25​e−1 and the rule “reject when X≥4” has level 1−38​e−1. Deduce that no rule of the form “reject when X≥c” has level exactly 0.05, identify the one whose level is largest without exceeding 0.05, and find its power against λ=2 as an exact expression.

    Solution

    (a) The likelihood is

    L(λ)=i=1∏n​xi​!λxi​e−λ​=∏i​xi​!λse−nλ​,s=i∑​xi​.

    The factorials are the same under both hypotheses and cancel in the ratio:

    Λ=L(λ0​)L(λ1​)​=(λ0​λ1​​)se−n(λ1​−λ0​),logΛ=slogλ0​λ1​​−n(λ1​−λ0​).

    Since λ1​>λ0​, the coefficient log(λ1​/λ0​) is positive, so logΛ — and hence Λ — is a strictly increasing function of s alone. Therefore {Λ>k}={S>c} with c=(logk+n(λ1​−λ0​))/log(λ1​/λ0​). By the Neyman–Pearson lemma the most powerful test of level α rejects when S exceeds the constant that gives level α. ■

    (b) The constant c is fixed by the requirement P(S>c∣λ0​)=α, and under H0​ the statistic S is Poisson(nλ0​). So c depends on λ0​, n and α only — the alternative λ1​ dropped out, exactly as it did for the normal mean. The same rejection region {S>c} is therefore most powerful against every λ1​>λ0​ at once, which is the definition of uniformly most powerful for H1​:λ>λ0​.

    For λ1​<λ0​ the coefficient log(λ1​/λ0​) is negative, so Λ is strictly decreasing in s and the most powerful test rejects for small S. The two-sided alternative contains values on both sides; the best region against one side is an upper tail and against the other a lower tail, and no single region can be both. So no test is most powerful against every λ=λ0​ simultaneously. ■

    (c) Under λ=1, P(X=k)=e−1/k!, so

    P(X≤2)=e−1(1+1+21​)=25​e−1,P(X≥3)=1−25​e−1≈1−0.9197=0.080,

    P(X≤3)=e−1(25​+61​)=38​e−1,P(X≥4)=1−38​e−1≈1−0.9810=0.019.

    The level of “reject when X≥c” is P(X≥c∣λ=1), which is decreasing in c and takes only the discrete values 1, 1−e−1, 1−2e−1, 0.080, 0.019,…. The value 0.05 is not among them: c=3 overshoots and c=4 undershoots. The rule with the largest level not exceeding 0.05 is c=4, with level about 0.019.

    Its power against λ=2: P(X=k)=2ke−2/k!, so

    P(X≤3∣λ=2)=e−2(1+2+2+34​)=319​e−2,power=1−319​e−2≈1−0.857=0.143.

    One observation carries little information about a rate, and the discreteness has forced the test to run at level 0.019 rather than the nominal 0.05, which costs power on top of that.

    A remark on the lemma's wording. “k chosen so that the level is exactly α” is not achievable with a non-randomised rule when the data are discrete. The exact-level Neyman–Pearson test here rejects when X≥4, and when X=3 rejects with a probability γ chosen so that 0.019+γP(X=3∣λ=1)=0.05; since P(X=3∣λ=1)=e−1/6≈0.0613, this gives γ≈0.51. In practice one reports the attainable level instead.

  11. 11.Proof

    Throughout, the test statistic T has a continuous distribution under H0​ with distribution function F.

    1. (a)Suppose F is symmetric about 0, so F(−t)=1−F(t), and the test is two-sided with p=P(∣T∣≥∣tobs​∣ ​ H0​)=2(1−F(∣tobs​∣)). Prove that, when H0​ is true, p is uniform on (0,1).
    2. (b)For the one-sided z-test rejecting when Z>zα​, with observed value zobs​ and p=1−Φ(zobs​), prove that p is the smallest significance level at which the observed data lead to rejection: p=inf{α∈(0,1):zobs​>zα​}.
    3. (c)A journal publishes a result only if its p-value is at most 0.05. Suppose every null hypothesis submitted is in fact true. Prove that the p-values appearing in the journal are uniform on (0,0.05), find the fraction of published p-values below 0.01 and the fraction in (0.04,0.05], and say what an observed pile-up of published p-values just below 0.05 would therefore indicate.

    Solution

    (a) Let G(t)=P(∣T∣≤t∣H0​) for t≥0. By symmetry,

    G(t)=P(−t≤T≤t)=F(t)−F(−t)=2F(t)−1,

    which is continuous and strictly increasing on the support of ∣T∣, from 0 to 1. The two-sided p-value is p=P(∣T∣≥∣tobs​∣)=1−G(∣tobs​∣)=2(1−F(∣tobs​∣)), matching the stated formula; as a random variable, p=1−G(∣T∣).

    Now fix u∈(0,1). Because G is continuous and strictly increasing it has an inverse on (0,1), and

    P(p≤u)=P(G(∣T∣)≥1−u)=P(∣T∣≥G−1(1−u))=1−G(G−1(1−u))=u,

    where the third equality uses continuity, so that P(∣T∣=G−1(1−u))=0 and the inequality may be taken strict or not. A random variable with P(p≤u)=u on (0,1) is uniform on (0,1). ■

    The argument is the one-sided proof applied to the statistic ∣T∣: symmetry was used only to write G in terms of F. In particular P(p≤α∣H0​)=α, so “reject when p≤α” is a level-α test, and it coincides with rejecting when ∣T∣>G−1(1−α), the two-sided critical value.

    (b) By definition zα​=Φ−1(1−α), which is a strictly decreasing function of α because Φ−1 is increasing. Then, for α∈(0,1),

    zobs​>zα​⟺Φ(zobs​)>1−α⟺α>1−Φ(zobs​)=p,

    applying the increasing function Φ in the first step and rearranging in the second. So the set of levels at which the data are rejected is exactly the interval (p,1), whose infimum is p. ■

    At α=p itself the strict rule Z>zα​ does not reject — zobs​=zp​ exactly — which is why the statement is an infimum rather than a minimum; the distinction has probability zero and is invisible in practice. This is the operational meaning of a p-value: it is the level at which the verdict flips, so reporting p tells every reader the verdict at their own α.

    (c) Let p be the p-value of a submitted test. Its null is true, so by the theorem that the p-value is uniform under the null (or by (a)), p∼Uniform(0,1). Publication is the event {p≤0.05}, of probability 0.05. For 0<u≤0.05,

    P(p≤u∣p≤0.05)=P(p≤0.05)P(p≤u and p≤0.05)​=0.05P(p≤u)​=0.05u​,

    and for u>0.05 the conditional probability is 1. This is the distribution function of Uniform(0,0.05). ■

    Hence P(p<0.01∣published)=0.01/0.05=51​, and likewise P(0.04<p≤0.05∣published)=0.01/0.05=51​: each fifth of the interval receives 20% of the published values.

    Interpretation. If the published nulls were all true and the filter were the only selection, the published p-values would be flat across (0,0.05). If instead some effects were real, their p-values would concentrate near 0 — under a real effect the distribution of p piles up at the low end — and the published histogram would be heavier below 0.01 than just below 0.05. Neither honest scenario produces an excess just under the threshold. A pile-up in (0.04,0.05] relative to (0,0.01) is therefore the signature of results that were nudged across the line: choosing among analyses, subgroups, or stopping times until p dipped below 0.05, which the printed p-value does not record.

  12. 12.Computation

    Use ln2≈0.6931, ln0.95≈−0.0513 and (0.95)20≈0.3585.

    1. (a)A study runs m independent tests, each at level α, and every null is true. Show that the number K of false rejections is Binomial(m,α), and find E[K] and P(K≥1) for m=20, α=0.05. Then find the smallest m for which P(K≥1)≥21​ at α=0.05.
    2. (b)Prove that testing each hypothesis at level α/m keeps the probability of at least one false rejection at most α under any dependence between the tests. Then, for independent tests with all nulls true, write the exact family-wise error rate under this correction and prove from Bernoulli's inequality (1−x)m≥1−mx (valid for 0≤x≤1) that it is at most α — so the correction is conservative even in the independent case.
    3. (c)In a field, a fraction π of tested hypotheses are genuinely non-null, and tests have level α and power 1−β. Show that a rejected null is more likely true than false — that is, P(H1​∣reject)≥21​ — exactly when (1−β)π≥α(1−π). With π=0.05, find the power required at α=0.05 and at α=0.005, and draw the conclusion.

    Solution

    (a) Let Ai​ be the event that test i falsely rejects, and Ii​ its indicator. Since every null is true, P(Ai​)=α, so each Ii​ is Bernoulli(α); the tests are independent, so the Ii​ are independent; and K=∑i=1m​Ii​ is a sum of m independent Bernoulli(α) variables, which is Binomial(m,α).

    For m=20, α=0.05: E[K]=mα=1 — on average one false finding per study of pure noise — and

    P(K≥1)=1−P(K=0)=1−(1−α)m=1−(0.95)20≈1−0.3585=0.6415,

    which is the family-wise error rate under multiplicity.

    Smallest m with P(K≥1)≥21​: we need (0.95)m≤21​. Taking logarithms (which reverses the inequality, since ln0.95<0),

    mln0.95≤−ln2⟺m≥−ln0.95ln2​≈0.05130.6931​≈13.5,

    so m=14. Check: (0.95)10≈0.5987 and (0.95)3≈0.8574, so (0.95)13≈0.513>21​ while (0.95)14≈0.488<21​ ✓. Fourteen honest tests on noise are more likely than not to yield a “finding”.

    (b) Bonferroni under arbitrary dependence. With each test at level α/m, P(Ai​)≤α/m for every true null. By the union bound — subadditivity of probability, which needs no independence —

    P(i=1⋃m​Ai​)≤i=1∑m​P(Ai​)≤m⋅mα​=α.■

    The independent case. By (a) with α/m in place of α, the number of false rejections is Binomial(m,α/m) and the exact family-wise error rate is

    1−(1−mα​)m.

    Bernoulli's inequality with x=α/m∈[0,1] gives (1−α/m)m≥1−m⋅α/m=1−α, hence

    1−(1−mα​)m≤α.■

    (For completeness, Bernoulli's inequality by induction: it is an equality at m=1, and if (1−x)m≥1−mx then, multiplying by 1−x≥0, (1−x)m+1≥(1−mx)(1−x)=1−(m+1)x+mx2≥1−(m+1)x.)

    The inequality is strict for m≥2 and x>0, so even independent tests do not use the whole budget: at m=20, α=0.05 the true rate is 1−(0.9975)20≈0.049. The shortfall is small here — of order α2 — but it grows when the tests are positively correlated, where the union bound is far from tight and the correction costs power for a guarantee that was already met.

    (c) By the post-test probability theorem,

    P(H1​∣reject)=(1−β)π+α(1−π)(1−β)π​.

    This is at least 21​ exactly when the numerator is at least half the denominator, i.e. 2(1−β)π≥(1−β)π+α(1−π), i.e.

    (1−β)π≥α(1−π),

    and every step reverses, since the denominator is positive. In words: the rate of true positives must at least match the rate of false positives.

    With π=0.05: the false-positive rate is α(1−π)=0.95α.

    At α=0.05: 0.05(1−β)≥0.05(0.95), so the power must be at least 0.95.

    At α=0.005: 0.05(1−β)≥0.005(0.95)=0.00475, so the power must be at least 0.095.

    Conclusion. In a field that tests long shots — one hypothesis in twenty being real — a significant result at the conventional 5% level is more likely false than true unless the study has 95% power, which almost no study has; and even at perfect power the post-test probability is only 0.05+0.04750.05​≈0.51. Power cannot rescue such a literature, because the false positives come from the large pool of true nulls, not from the small pool of real effects. Lowering α tenfold shrinks that pool's contribution tenfold, and then even a modest 10% power makes a rejection more likely right than wrong. The p-value's meaning depends on two things it does not contain: how plausible the hypothesis was before the data, and how powerful the test was.

← Back to the question sheet

CalcPath·Free university mathematics

SubjectsProblem setsProgressFeedbackAbout