Hypothesis Testing
A confidence interval reports a range of plausible values. A hypothesis test answers a different question: the data are consistent with a specific claim, or they are not.
Definition. A statistical test is a test between two contradictory claims, based on a statistical analysis of observed data. The null hypothesis is the claim initially assumed true. The alternative hypothesis is a contradictory claim.
The null represents a default state: the status quo, no effect, zero difference. The alternative is usually the theory you would accept if the null is rejected.
The logic is a jury’s: innocent until proven guilty. The null is presumed and only abandoned if the evidence is strong enough. A test can conclude that there is enough evidence to reject , or that there is not. It never concludes that is true. Failing to convict is not a finding of innocence, and the standard phrasing is “fail to reject.”
An example. For evaluation scores in a ward, testing whether the mean exceeds 80:
1. The test statistic
Definition. A test statistic is any sample statistic whose numerical value is used to decide whether to reject .
The realized value assesses how likely the data are if the null were true. The standard statistic for a mean is
where is the value the null asserts. Under the numerator has expectation zero, so : the statistic is built so that the null predicts a value near zero, and a large value is evidence against.
Comparing two wards on the same test: Ward 11 gives and Ward 13 gives . Both are positive, and 13.09 is far out in the tail of anything the null permits.
2. The p-value
Definition. The p-value is the probability of obtaining a result equal to or more extreme than what was observed, under the null hypothesis.
For a right-tailed alternative , the p-value is . The smaller the p-value, the stronger the evidence against , because a small p-value means data like these are rare under the null.
The tail used is determined by the alternative:
- gives the right tail, .
- gives the left tail, .
- gives both tails, .
The first two are one-tailed, the third is two-tailed. Picking the wrong one changes the answer by roughly a factor of two.
Worked example. observations, testing against with known, sample mean . The statistic is
Two-tailed, so the p-value is . Data like these are entirely ordinary under the null, so there is no evidence against it.
The p-value is not the probability that the null is true. It is a probability computed assuming the null, about data. The null is a fixed claim and has no probability attached, for the same reason a realized confidence interval has none.
3. Significance level and the critical region
A p-value is a continuous measure of evidence. Turning it into a decision requires a threshold, fixed in advance.
Definition. The significance level is the largest acceptable probability of rejecting the null hypothesis when the null hypothesis is true, with .
Reject when the observed p-value is smaller than .
The same decision can be described in terms of the statistic rather than the p-value.
Definition. The critical region is the set of values of for which is rejected in favour of . Values on the boundary are critical values.
Worked example. Testing against at , with known. The critical values are , so
The observed is not in , so do not reject. This agrees with the p-value of 0.650, which exceeds 0.1, as it must: the two routes are the same comparison read from different ends.
With unknown the critical values come from the distribution: at , slightly wider than the normal values.
4. Choosing the test statistic
Which statistic and which reference distribution depends on two questions: is the underlying distribution normal, and is known.
| Underlying distribution normal | Underlying distribution unknown | |
|---|---|---|
| known | , large | |
| unknown | , large |
All four distributions hold under the assumption that the null hypothesis is true, which is what makes the p-value computable.
The pattern matches the confidence interval constructions exactly, because they are the same machinery. Exact results in the normal column, central limit theorem approximations in the unknown column, and the distribution appearing precisely when the variance is estimated from normal data.
5. Tests and confidence intervals are equivalent
A test using the p-value at significance level and a test using the confidence interval at level give the same decision.
Both reject when is implausible, and “implausible” means the same thing in both.
The test rejects when
The interval rejects when
These are the same condition rearranged. Take the interval’s lower bound exceeding :
which is exactly the right half of the critical region, and the upper bound gives the left half the same way.
The practical consequence is that a confidence interval answers hypothesis tests for free. Given a 90% interval of for a ward’s mean score, the value 80 lies inside, so is not rejected at . Any inside the interval fails to be rejected, and any outside is rejected.
6. Type I and Type II errors
Two ways to be wrong, and they are not symmetric.
| true | false | |
|---|---|---|
| Reject | Type I error | Correct |
| Fail to reject | Correct | Type II error |
A Type I error is rejecting a true null: a false positive. Its probability is , by construction, since that is what the significance level was defined to control.
A Type II error is failing to reject a false null: a false negative. Its probability is , and it is not chosen directly. It depends on how far the truth is from , on , and on .
The connection to confidence intervals is direct. A interval misses the true parameter with probability , so when the null is true it excludes with probability , and excluding means rejecting.
The two errors trade against each other. Lowering makes rejection harder, cutting Type I errors and raising Type II. The only way to reduce both is more data.
7. Cautions on p-values
A small p-value does not indicate an important departure. Statistical significance and practical importance are different. A sample mean of 80.5 with rejects at the 5% level; a sample mean of 90 with does not. The second is a far larger departure from , and only the first clears the threshold, because the p-value confounds effect size with sample size.
A p-value gives evidence against and no indication of direction or magnitude. It does not tell you how wrong the null is, only how surprising the data would be if it were right.
Binary thinking hides detail. Reject against fail-to-reject collapses a continuous measure into one bit. Reporting the p-value itself, and the estimate, and an interval, carries more than the verdict.
A rough reading of the strength of evidence:
| p-value | Interpretation |
|---|---|
| No evidence against | |
| Weak evidence against | |
| Moderate evidence against | |
| Strong evidence against | |
| Very strong evidence against |
8. Worked example, end to end
Ward 13 private housing, testing whether mean evaluation score exceeds 80 at .
Hypotheses. against , one-tailed because the question asks whether quality is good rather than whether it differs.
Test statistic. Sample mean 91.36, sample standard deviation 7.56, so with unknown
p-value. Right tail only, , which is 0 to reported precision.
Decision. , so reject . There is very strong evidence that the mean score exceeds 80.
The same data give a 90% confidence interval that lies entirely above 80, which is the equivalence again.
Ward 11, by contrast, gives and . At this does not reject, and its confidence interval contains 80. The correct statement is that the data provide weak evidence against and do not establish either claim, not that the mean equals 80.
Vocabulary to deploy
- Null hypothesis , alternative hypothesis ; reject or fail to reject, never accept.
- Test statistic ; p-value, the probability of a result as or more extreme under .
- One-tailed and two-tailed p-values.
- Significance level ; critical region ; critical values.
- Type I error (reject a true null, probability ); Type II error (fail to reject a false null, probability ).
- Equivalence: reject at level exactly when the confidence interval excludes .
- Statistical significance against practical importance.