A hypothesis test decides between two competing claims about a parameter using data, quantifying how surprising the data would be if the default claim were true. It is the dual of the confidence interval built in Maximum Likelihood Estimation.
Null and Alternative
- Null hypothesis : the default or “no effect” claim, e.g. .
- Alternative : what we suspect, e.g. (two-sided) or (one-sided).
- We either reject or fail to reject it; we never “accept” , since absence of evidence is not evidence of absence.
Test Statistic and p-value
A test statistic measures the distance between the data and . For a normal mean with known :
- The p-value is .
- Reject when the p-value falls below the significance level (commonly ).
- Equivalently, reject when ; the rejection region and the CI in Maximum Likelihood Estimation are duals.
Worked Example: One-Sample z-test
A process targets with known . A sample of gives . Then
The two-sided p-value is . Since (and ), reject : the mean has shifted.
What a p-value is not
The p-value is not and not the probability the result is due to chance. It is the tail probability of the data assuming is true. A large p-value does not prove , and a small p-value does not measure effect size or practical importance.
Type I and Type II Errors
| true | false | |
|---|---|---|
| Reject | Type I error () | correct (power) |
| Fail to reject | correct | Type II error () |
- is the false-positive rate, chosen by the analyst.
- ; power rises with , effect size, and .
- For fixed , lowering raises : there is a tradeoff. Increasing lowers both.
Common Tests
| Test | Use case | Statistic | Reference dist. |
|---|---|---|---|
| -test | mean, known | standard normal | |
| -test | mean, unknown | ||
| Two-sample | compare two means | difference / pooled SE | |
| Paired | matched pairs | on differences | |
| Chi-square | variance, goodness of fit, independence | ||
| ANOVA (-test) | compare means | between/within variance |
- The -test replaces with the sample standard deviation and uses degrees of freedom; its heavier tails account for estimating .
- Chi-square goodness-of-fit compares observed counts with expected counts across categories, with degrees of freedom equal to categories minus estimated parameters minus one.
Multiple comparisons and p-hacking
Running many tests inflates the family-wise error rate: at , about 1 in 20 true nulls is rejected by chance. Correct with Bonferroni () or false-discovery-rate control, and pre-register hypotheses to avoid selecting tests after seeing the data.