Hypothesis Testing
A hypothesis test is a formal decision procedure for choosing between two competing statements about a data-generating distribution:
- Null hypothesis (): a description of the chance process that generates the data, typically asserting that nothing unusual is happening (e.g., a parameter equals a specific value, or two variables are independent).
- Alternative hypothesis ( or ): the assertion that a mechanism other than generated the data.
A test constructs a test statistic from the data and defines a rejection region such that is rejected whenever . The test is subject to two types of error:
- Type I error (false positive): rejecting when it is in fact true. The probability of a Type I error is the significance level,
- Type II error (false negative): failing to reject when is true. Its probability is denoted , and is the power of the test—the probability of correctly detecting a true effect.
The p-value is the probability, under , of observing a test statistic as extreme as or more extreme than the one actually observed:
A small p-value indicates that the observed data would be unusual under . The null is rejected when .Interpretation of the P-Value not the probability that is true. It is the probability of the observed (or more extreme) data assuming is true. A p-value of means that if were true, data this extreme would occur only of the time—not that there is a chance holds.
The p-value is
Intuition
Hypothesis testing formalizes the everyday reasoning of “is this result surprising enough to rule out coincidence?” The null hypothesis represents the skeptic’s position—nothing interesting is happening, any apparent effect is due to chance. The test asks: if the skeptic is right, how likely are we to see data this extreme?
The significance level controls the false alarm rate: how often we incorrectly declare an effect. The power controls the detection rate: how often we correctly identify a real effect. These two errors trade off—lowering (being more conservative) increases (missing real effects), and vice versa. The art of experimental design lies in choosing , the sample size, and the test statistic to balance these risks.
Properties
(Neyman-Pearson Framework) The classical approach fixes in advance and seeks the test with maximum power. The Neyman-Pearson lemma shows that the likelihood ratio test is the most powerful test at any given significance level for simple (fully specified) hypotheses.
(Rejection Region) For a given , the rejection region is the set of test statistic values for which is rejected. Equivalently, .
(One-Sided vs. Two-Sided) A one-sided test has (or ), concentrating the rejection region in one tail. A two-sided test has , splitting across both tails.
(Connection to Confidence Intervals) Rejecting at level is equivalent to falling outside a confidence interval for . This duality links hypothesis testing and interval estimation.
Examples
Coin Bias Test
A coin is flipped times, yielding heads. Test against at significance level .
Solution , with and . The test statistic is The p-value is . Since , we reject and conclude there is significant evidence of bias toward heads.
Under
Two-Sample Permutation Test
Two groups of patients receive treatments A and B. Group A () has mean recovery time days; Group B () has days. Test : the treatment has no effect (recovery times are independent of group assignment).
Approach , the group labels are exchangeable. The observed test statistic is . By randomly permuting the group labels many times and recomputing each time, we build the null distribution of . The p-value is the proportion of permuted statistics . If this proportion falls below , we reject .
Under