Skip to content
Monte

Hypothesis tests

  1. Read it, not yet
  2. Practice it, not yet
  3. Master it, not yet

A hypothesis test asks: would this data be surprising if nothing were going on? Assume nothing is (H₀). A small p-value means the data would be rare, so reject H₀.

Why it matters

A test asks: if nothing were going on, how weird would this data be?

It guards against seeing patterns in noise, the most expensive mistake in data work.

  • A/B testsDid the new checkout really lift sales, or was it a lucky week?
  • OperationsIs the machine off target, or is that its normal wobble?
  • MedicineDrug trials rest on tests like this one.

Everyday example

A coffee machine should pour 250 ml. 36 cups average 247.5 ml, σ = 6. z = (247.5 − 250) / (6 / √36) = −2.5. The two-sided p-value is 0.012, under 0.05: reject H₀. It pours short.

Drag the sample mean: when does it get surprising?

H₀ says a machine pours μ = 250 ml, with σ = 6. Move the sample average and the sample size, and watch the p-value.

247248249250251252253x̄ = 248.5

z = (248.5 − 250) / (6 / √36) = -1.5. p-value = 0.134. Fail to reject H₀ at α = 0.05: samples like this are common when the machine is fine. Red is the rejection region, beyond z = ±1.96.

Check yourself

  1. H₀ and H₁ for “the machine pours 250 ml on average”?

  2. Test statistic for a mean, σ known?

  3. z = −2.5, two-sided. p-value?

The trap

The mistake people make most on this one.

A p-value is not the chance H₀ is true. It is the chance of data at least this extreme under H₀. For a proportion, the SE uses p₀, not p hat.

Formulas

7 formulas and a way to remember them.
Five steps
State H₀ and H₁, pick α, compute the test statistic, find the p-value, then decide and say it in words
Mean, σ known
z = (x bar − μ₀) / (σ / √n)
Mean, σ unknown
t = (x bar − μ₀) / (s / √n), with n − 1 df
Proportion
z = (p hat − p₀) / √[p₀(1 − p₀) / n]
Decision
Reject H₀ when p-value < α, or when the statistic is past the critical value
Errors
Type I: reject a true H₀ (chance α). Type II: keep a false H₀ (chance β). Power = 1 − β
Excel
Two-sided p for z: 2*(1 − NORM.S.DIST(ABS(z), TRUE)). For t: T.DIST.2T(ABS(t), df)
Remember it
Innocent until proven guilty. H₀ is the defendant; the p-value is how unlikely the evidence would be if innocent.

Watch and go deeper

3 free videos and pages.