A test sets a threshold on one number before the data arrive. Slide it, and watch two kinds of mistake trade places.
False alarms versus misses
The test statistic with no effect (A) and with an effect (B), and the threshold between "no" and "yes".
Bell A is the statistic when there is no effect; bell B, when there is one. Above the threshold c we say "effect".
Predict first. Move the threshold to the right: the false-alarm area falls. What will the miss area do?
Describe this picture
One axis, “test statistic Z”, with two bell curves of the same width: bell A, “A: no effect”, centred on 0, drawn solid, and bell B, “B: effect”, centred on 3, drawn dashed in a second colour. A vertical line, the threshold , cuts the axis. The area of bell A to the right of the line is shaded as “false alarms”, and the area of bell B to the left of it as “misses”; readouts give and both areas to four decimals. Before the clip a question asks: when the threshold moves right, the false-alarm area falls; will the miss area fall, stay the same, or rise? A tap picks an answer and starts the clip. In the clip the threshold slides from 0 to 4 over 8 seconds, easing in and out, and the two readouts trace one area falling while the other rises; they are equal, 0.0668, at 1.5. Then the threshold returns to 1.645: false alarms 0.0500, misses 0.0877. After the clip a slider, “Threshold c”, moves it from 0 to 4 in steps of 0.005.
Two hypotheses and a threshold
A test starts from a question with two possible answers. The null hypothesis, , says nothing is going on: the pill does nothing, the machine is set right, there is no tone in the noise. The alternative, , says there is an effect.
From the data I compute one number, the test statistic. Here it is , and it behaves differently under the two answers. If is true, follows bell A, the standard bell . If is true, it follows bell B, the same bell shifted to 3. I call that shift ; here .
Before looking at the data I fix a threshold . If lands above it I reject , deciding there is an effect; otherwise I do not. The values above are the rejection region. This test is one-sided: only large values of count against .
Two mistakes are possible:
| Truth | Decision: reject | Decision: do not reject |
|---|---|---|
| No effect | false alarm, chance | correct |
| Effect | correct | miss, chance |
The two shaded areas in the picture are those chances:
with the distribution function of the standard bell, as in The normal distribution. The false-alarm chance is the test’s significance level. Here and are this page’s two error chances; signal processing pages use the same letters for other things.
Moving the threshold
Before the clip you guessed. As the threshold moves right, false alarms fall and misses rise. The two areas trade places: any threshold that cuts one makes the other larger.
| Threshold | False alarms | Misses |
|---|---|---|
| 1 | 0.1587 | 0.0228 |
| 1.5 | 0.0668 | 0.0668 |
| 1.645 | 0.0500 | 0.0877 |
| 2 | 0.0228 | 0.1587 |
| 2.326 | 0.0100 | 0.2502 |
| 3 | 0.00135 | 0.5000 |
Halfway between the bells, at 1.5, the two errors are equal. The usual choice is to fix the false alarms first, at 5 %, with the threshold : the point of the standard bell with 0.95 of the area below it. With the bells 3 apart, that leaves misses at .
Power, and what raises it
The chance of catching a real effect, , is the test’s power. At the 5 % threshold with it is .
Moving the threshold cannot raise power without raising false alarms. Only pulling the bells further apart helps both. How far apart they sit depends on the data.
Say I test whether a mean exceeds a value , with known spread and draws. The statistic is the sample mean in units of its standard error, from Confidence intervals:
If the true mean is , bell B sits at . A bigger effect pulls it out; so does more data, but only as .
More data pulls the bells apart
An effect of half a standard deviation, tested at 5 % false alarms with n draws.
n = 4: bell B sits at 1, and the power is 0.2595. An effect of half a standard deviation is easy to miss with four draws.
Describe this picture
The same two bells, with the threshold fixed at 1.645 (5 % false alarms), for an effect of half a standard deviation: bell B sits at . Readouts give , the separation, the power and the misses. In the clip steps through 4, 16, 25, 36 and 64, holding at each; bell B moves out from 1 to 4 and the miss area shrinks: the power goes 0.2595, 0.6388, 0.8038, 0.9123, 0.9907. After the clip a slider, “Draws n”, sets to one of those five values.
Four times the data doubles the separation. For an effect of half a standard deviation at the 5 % level:
| Draws | Separation | Power |
|---|---|---|
| 4 | 1 | 0.2595 |
| 16 | 2 | 0.6388 |
| 25 | 2.5 | 0.8038 |
| 36 | 3 | 0.9123 |
| 64 | 4 | 0.9907 |
To reach a chosen power, solve for . With and the matching points of the standard bell,
For power 0.80 at 5 %, and . An effect of half a standard deviation needs , so 25 draws; an effect of 0.2 standard deviations needs 154.6, so 155.
Watch out
“Not rejected” does not mean “shown true”. If the bells overlap heavily, a real effect is missed most of the time, and not rejecting shows only that this test could not tell. And is not the chance that is true: it is the chance of a false alarm when is true.
Worked example
1. A bottling line. The label says 500 g. The filling machine’s spread is known, g. Each hour, 16 bottles are weighed, so the standard error is g. The machine is flagged if the mean is too low, with 5 % false alarms: when g.
If the machine has drifted to 498 g, two standard errors low, the flag fires with chance . At 499 g it fires with chance . To catch 498 g with power 0.80 takes 25 bottles: the standard error falls to 0.8 and the power to .
An hour’s 16 bottles average 497.6 g. That is below the line, so the machine is flagged.
2. Finding a tone. A sine of amplitude 0.5 that completes whole cycles in 72 samples is buried in noise of variance 1. Its energy is . A matched filter that knows the tone’s frequency and phase turns the record into a statistic that follows bell A with noise alone and bell B, shifted by , with the tone: the bells of the picture.
A threshold of 1.645 raises a false alarm on 5 % of noise-only records and finds the tone 91.2 % of the time. A threshold of 3 cuts false alarms to 1 record in 741 and finds the tone only half the time. With an unknown phase the bells change shape; the matched-filter page deals with that case.
Try it yourself. With the bells 3 apart, the false-alarm chance at threshold 2 is . Doubling moves bell B to , and the power at 5 % rises to . Raising the threshold lowers the power.
Where you’ll meet this
Clinical trials. A trial is sized before it starts: the false-alarm level is fixed, usually at 5 %, and the number of patients is chosen for a power of 80 or 90 % to detect the smallest effect that would matter.
Quality control. Production lines are checked by samples against limits, as with the bottles. The limits are set for a tolerable rate of false stops.
Detectors. Radar, sonar and smoke alarms decide “target” or “no target” by a threshold set for a false-alarm rate, then live with the misses that follow.
Experiments online. A/B tests compare two versions of a page; running one without enough visitors gives a test with little power, whose “no difference” means very little.
In signal processing · detection is a test
A radar decides whether a target is present by comparing a matched-filter output with a threshold set for the false-alarm rate: this page’s test, with noise as bell A. Matched filters and detection and Radar signal processing in the signal processing course work it through.
The next page, p-values, reports how far into bell A’s tail the observed statistic fell, instead of only “above or below the line”.
Reference card
| Quantity | Formula | Notes |
|---|---|---|
| Hypotheses | no effect; an effect | chosen before the data |
| False alarm | the significance level | |
| Miss | ||
| Power | chance of catching the effect | |
| 5 % one-sided threshold | ||
| Statistic for a mean | shift | |
| Sample size | 25 for half a SD, power 0.8 | |
| Not rejected | not shown true | the test may lack power |