hanegreefs.com/ statistics II
Home / Chapters / 04
Chapter 04 · Course ch. 12

Testing hypotheses

H₀ and H_A, the four-step protocol, the one-proportion z-test and what a p-value really says.

About 15 min read · Lecture material: HOC 4

Priority labels: ImportantNeutralLess important show where to spend revision time.

The logic: proof by contradictionImportant

A hypothesis test starts by assuming a specific claim (the null hypothesis H₀) is true and asks how surprising the observed data would be under that assumption. Very surprising → doubt the claim; not surprising → no reason to drop it. As in a criminal trial, the starting position is "innocent until shown otherwise", and an acquittal is not proof of innocence: you never prove H₀, you only fail to reject it.

Setting up H₀ and H_AImportant

H₀ pins the parameter to one value (H₀: p = p₀), the status quo. H_A holds the values you would act on if H₀ is rejected. Fix both before looking at the data.

AlternativeFormUse when
Two-sidedp ≠ p₀A difference in either direction matters (the default)
Upper one-sidedp > p₀Only an increase matters, decided in advance
Lower one-sidedp < p₀Only a decrease matters, decided in advance

Prefer two-sided unless a deviation in the other direction is impossible or truly irrelevant. Picking the side after seeing which way the data lean is a form of p-hacking. The course writes H₀ with an equals sign even for one-sided tests.

The four-step protocolImportant

StepNameContent
1Set-upName the parameter, state H₀ and H_A in context
2ModelCheck conditions and name the sampling model
3MechanicsCompute the test statistic and p-value
4ConclusionDecide and interpret in the context of the problem

The one-proportion z-testImportant

Conditions: independence (randomisation, and 10% when sampling without replacement) and np₀ ≥ 10, nq₀ ≥ 10. Note the hypothesised p₀ appears here, not p̂, because the null world is where the sampling distribution lives.

Formula
z = (p̂ − p₀) / √( p₀q₀ / n )
ProcedureUsesBecause
Confidence intervalp̂, q̂ → SEp is unknown, so estimate it
Hypothesis testp₀, q₀ → SDH₀ is assumed true, so p = p₀ is "known"

The p-valueImportant

The p-value is the probability, computed assuming H₀ is true, of getting a result at least as extreme as the one observed.

Alternativep-valueTI-84
H_A: p ≠ p₀2 × P(Z > |z|)2·normalcdf(−1E99, −|z|)
H_A: p > p₀P(Z > z)normalcdf(z, 1E99)
H_A: p < p₀P(Z < z)normalcdf(−1E99, z)

What it is not: the probability that H₀ is true, or the chance you made a mistake. A large p-value says the data are consistent with H₀, nothing more.

The decision rule and αImportant

Pick a significance level α in advance (0.05 is conventional; 0.01 for high-stakes calls). Reject H₀ when p < α, otherwise fail to reject. Use a smaller α when wrongly rejecting would be costly or when H₀ is a well-established claim that deserves strong evidence before it is overturned.

Writing the conclusionImportant

  • Say "we fail to reject H₀", never "we accept H₀".
  • Quote the p-value and tie the statement to the real-world setting.
  • Look beyond significance: the effect size |p̂ − p₀|, a confidence interval and the cost of acting decide the business decision. A huge sample can make a trivial difference "significant"; a tiny sample can hide an important one.
Worked example

Home advantage in baseball

In a season of 2,430 games, home teams won 1,295. Is there evidence that home teams win more than half the time?

1

Hypotheses

H₀: p = 0.50 H_A: p > 0.50 (only an advantage is of interest)
2

Conditions

Games treated as independent; 10% fine; np₀ = nq₀ = 1215 ≥ 10
3

Mechanics

p̂ = 1295/2430 = 0.5329; SD = √(0.25/2430) = 0.01014; z = 0.0329/0.01014 ≈ 3.24; p ≈ 0.0006
Answer

The p-value is far below any usual α, so we reject H₀: there is strong evidence of a home advantage (about 3.3 points above 50%).

Link to confidence intervalsNeutral

A two-sided test at level α and a (1 − α) confidence interval carry the same message: values of p₀ inside the interval are not rejected, values outside are. For proportions the match is only approximate, because the interval uses p̂ in its standard error and the test uses p₀. When p̂ is close to p₀ the two agree; when it is far, they can drift apart.

Critical-value approachNeutral

Equivalent to the p-value method: reject when |z| exceeds the critical z* for your α (two-sided: 1.645, 1.960, 2.576 for α = 0.10, 0.05, 0.01; one-sided: 1.282, 1.645, 2.326). The p-value is preferred because it shows how strong the evidence is, not just which side of the line it falls on.

Tools: TI-84 and RNeutral

TI-84: STAT ▸ TESTS ▸ 5:1-PropZTest (p₀, x, n, choose the alternative). R: prop.test(x, n, p = p0, alternative = "greater", correct = FALSE) — its test statistic is z², and with correction off the p-value matches the z-test.

prop.test(1295, 2430, p = 0.5, alternative = "greater", correct = FALSE)

Common pitfallsImportant

  • Writing or switching hypotheses after seeing the data.
  • Reading the p-value as P(H₀ true) or treating "fail to reject" as proof of H₀.
  • Using p̂ in the test's standard deviation instead of p₀.
  • Forgetting to double the tail for a two-sided p-value.
  • Equating statistical with practical significance.
  • Skipping the conditions.
Since the lectureThe statistical community has kept debating the 0.05 cut-off. The American Statistical Association issued a statement on p-values in 2016 (Wasserstein & Lazar), and a 2019 editorial in the same journal (Wasserstein, Schirm & Lazar) went further and advised against declaring results "significant" on the basis of a threshold alone. Course exam answers still use α-based decisions, but good practice is to report the p-value itself, an effect size and an interval.

Key takeaways

  • Assume H₀, measure surprise with the p-value, reject when p < α; never "accept" H₀.
  • Tests use p₀ in the SD, intervals use p̂ in the SE; the success/failure check follows the same split.
  • Always add effect size and context to the verdict.
Question
Tap or press space to reveal
Answer
Did you know it?

Multiple choice

Ch 04 · Question 1

The p-value is…

Why: That is its definition.
Ch 04 · Question 2

A test gives p = 0.03. At α = 0.05 you…

Why: p < α → reject.
Ch 04 · Question 3

In a one-proportion z-test the standard error uses…

Why: Under H₀ the proportion is p₀.
Ch 04 · Question 4

z = 2.5 in a two-sided test gives p ≈ …

Why: 2 × 0.0062 ≈ 0.012.
Ch 04 · Question 5

Which wording is correct when p > α?

Why: Absence of evidence is not proof.
Ch 04 · Question 6

A very large sample showing a trivial effect with p < 0.001 is…

Why: Large n makes tiny effects detectable.
Ch 04 · Question 7

Which is the correct alternative if you only care about increases?

Why: Right-tailed.
Ch 04 · Question 8

Which approach prevents p-hacking?

Why: Pre-specification.

Exam-style questions

Exam-style · Ch 04

A manager claims 40% of invoices are paid late. In a random sample of 250, 112 were late. Test at the 5% level whether the share has risen above 40%.

Show outline of a full answer
  1. Hypotheses: H₀ p = 0.40, H_A p > 0.40.
  2. Conditions with p₀: 250·0.4 = 100 and 150 ≥ 10; random; 10%.
  3. p̂ = 0.448, SE₀ = √(0.4·0.6/250) ≈ 0.031, z ≈ 1.55, p ≈ 0.06.
  4. p > 0.05 → fail to reject; evidence is suggestive but not conclusive.

One-proportion z-testInteractive

Enter x, n and p₀ for the test statistic, p-value, decision and the matching interval.

Tail areas and p-valuesInteractive

Shade the area beyond any z to see where a p-value comes from.