Skip to content

p-values

A p-value says how surprising the data would be if nothing were going on; it is not the chance that nothing is going on.

Helps to know first
This topic

First, the picture

Twenty teams test a pill that does nothing at all. Guess how many find it “significant”, then watch their results land.

Significant by chance

Studies of a pill that does nothing, 30 people per group, each tested at 0.05 (seed 8282).

Twenty studies of a pill that does nothing. Each compares 30 people on the pill with 30 on a placebo, all drawn from the same bell.

studies
0
below 0.05
0
below 0.05/m
–

Predict first. Of 20 studies of a pill that does nothing, how many will come out "significant", below 0.05?

0.00 / 10.55 s
Describe this picture

Three panels that stay apart. The first, “the population of studies”, shows the setting: one bell for pill and placebo alike, because the pill has no effect. The second, “one study”, shows the two groups of 30 people of one study as rows of dots, pill and placebo, with a line at each group’s mean, and the study’s p-value from a two-sided z-test. The third, “the p-values”, is a line from 0 to 1 with the stretch below 0.05 shaded. Before the clip a question asks how many of 20 studies will come out below 0.05: none, about one, or about five. A tap picks one and starts the clip. In the clip the 20 studies run (seed 8282) and their p-values drop onto the line one by one, stacking where they land; those below 0.05 are drawn in a second colour. One lands there, study 4. At the end a dashed line appears at 0.05/20 = 0.0025, Bonferroni’s stricter cut. Readouts count the studies, those below 0.05 and those below 0.05 divided by the number of studies. After the clip a slider sets the number of studies from 20 to 200 in steps of 10, and the dashed line moves to 0.05 divided by that number.

A pill that does nothing

Before the clip you guessed. The pill does nothing, yet about one study in twenty comes out “significant” at 0.05. In the clip’s run, 1 of the 20 did. That is not a fault in the studies. It is what the 5 % false-alarm level of Significance tests promises: when nothing is going on, 5 % of tests still cross the line.

Look at where the p-values land: spread evenly along the line from 0 to 1, with no pile anywhere. That is also no accident, as the section on even spreads below shows.

The p-value

A test with a fixed threshold says only “above” or “below”. A p-value says how far into the tail the result fell:

pval=Pr⁡{a statistic at least as extreme as the one observed∣H0}.p_\text{val}=\Pr\{\text{a statistic at least as extreme as the one observed}\mid H_0\}.

It is a chance computed as if H0H_0 were true. I write it pvalp_\text{val}, because a bare pp is a chance of success on this site. A small pvalp_\text{val} means: if nothing were going on, data this extreme would be rare. Rejecting H0H_0 whenever pval<0.05p_\text{val}<0.05 is the same as the 5 % test of the last page.

A coin. A coin said to be fair lands heads 61 times in 100 flips. If it is fair, the count is Bin(100,12)\mathrm{Bin}(100,\tfrac12), and the chance of 61 or more heads is

Pr⁡{X≥61}=0.0176.\Pr\{X\ge61\}=0.0176.

That is the one-sided pvalp_\text{val}. If a result as far below 50 would have been just as surprising, count both tails: 2×0.0176=0.03522\times0.0176=0.0352.

The bell gives nearly the same. With the half-bar step of The central limit theorem, zobs=(60.5−50)/5=2.1z_\text{obs}=(60.5-50)/5=2.1, so the one-sided tail is 1−Φ(2.1)=0.01791-\Phi(2.1)=0.0179 and the two-sided 0.03570.0357.

Shuffling: a p-value you can count

Two page layouts were timed on four people each. The old layout took 10, 11, 12 and 16 seconds, mean 12.25; the new one took 14, 15, 17 and 19 seconds, mean 16.25. The new layout looks 4.0 seconds slower. Could that be chance?

If the layout makes no difference, the labels “old” and “new” are arbitrary: any four of the eight times could have been the “new” ones. So deal the eight times into two groups of four in every possible way, and see how often the difference is as large as 4.0.

Every way to shuffle the groups

Eight task times split into two groups of four in all 70 ways, by difference of group means.

Old layout 10, 11, 12, 16 s; new layout 14, 15, 17, 19 s. The new group is slower by 4.0 s on average.

splits
0
at least 4.0
–
p-value
–
0.00 / 10.60 s
Describe this picture

All 70 ways to split the eight task times into two groups of four, drawn as dots stacked on an axis of “difference of group means, new − old”, from −5 to 5 s. The observed split, old against new, is marked at 4.0 by a dashed line. The clip builds the stack split by split; then the dots at least that large are shaded: 3 of the 70, p-value 3/70 = 0.0429. Readouts count the splits shown, those at 4.0 or more, and the p-value. There is no control.

There are (84)=70\binom84=70 ways to choose which four times are “new”. Only 3 of them give a difference of 4.0 or more. So

pval=370=0.0429p_\text{val}=\frac{3}{70}=0.0429

one-sided, and 6/70=0.08576/70=0.0857 counting a difference of 4.0 in either direction. This is a shuffle test, or permutation test: the p-value is a fraction of shuffles you can count. With 4 values per group the smallest p-value it can ever give is 1/701/70.

What a p-value is not

Watch out

Three readings of a p-value are common and wrong. Surveys find them widespread, even among people who teach statistics.

  • ”pval=0.03p_\text{val}=0.03 means a 3 % chance that H0H_0 is true.” The p-value is computed by assuming H0H_0 is true; it cannot also be the chance that it is. How likely H0H_0 is depends on how plausible it was beforehand, as the base-rate section below shows.
  • ”pval=0.03p_\text{val}=0.03 means a 97 % chance the result will replicate.” A repeat study has its own random result; with a modest effect it misses the line often.
  • “A small pvalp_\text{val} means a large or important effect.” With enough data a tiny effect gives a tiny p-value. The size of an effect is read from an estimate and its interval, not from the p-value.

p-values when H0H_0 is true

Why did the twenty p-values spread evenly? For a continuous statistic, when H0H_0 is true,

Pr⁡{pval≤u}=ufor every u from 0 to 1.\Pr\{p_\text{val}\le u\}=u\qquad\text{for every }u\text{ from 0 to 1}.

A p-value below 0.05 happens 5 % of the time, below 0.5 half the time, below 0.01 one time in a hundred. The threshold on the p-value is a threshold on the statistic in other units, so the chance of falling below it is exactly its level.

With a real effect, p-values pile up near 0. For the bells 3 apart of Significance tests, a one-sided p-value falls below 0.05 with chance 0.91230.9123, below 0.01 with chance 0.74970.7497, and below 0.001 with chance 0.4640.464.

Many tests

Run 20 independent tests of things that do nothing, each at 0.05. The chance that at least one crosses the line is

1−0.9520=0.6415.1-0.95^{20}=0.6415.

More likely than not, something looks significant. With mm independent tests it is 1−0.95m1-0.95^m.

The simplest fix, the Bonferroni correction, tests each of the mm at 0.05/m0.05/m. For 20 tests that is 0.00250.0025 each, and, for independent tests, the chance of any false alarm falls to 1−0.997520=0.04881-0.9975^{20}=0.0488, just under 5 %. After the clip, drag the number of studies and watch the lower line: it is the Bonferroni threshold.

How many discoveries are false

A small p-value does not say how likely an effect is to be real. That depends on how many of the ideas tested were real to begin with, the base rate of Bayes’ theorem.

Picture 1000 pills tested, of which 10 % really work. With power 0.8, the tests find 80 of the 100 that work. Of the 900 that do nothing, 5 %, or 45, also pass. So 125 pills come out “significant”, and 45 of them, 36 %, do nothing.

In general, if a fraction qq of the ideas tested are real, the share of “discoveries” that are false is

(1−q) α(1−q) α+q (1−β).\frac{(1-q)\,\alpha}{(1-q)\,\alpha+q\,(1-\beta)}.

Here qq is a local letter for that share.

Worked example

1. The coin. For 61 heads in 100 flips: one-sided pval=0.0176p_\text{val}=0.0176, two-sided 0.03520.0352. The test says that a fair coin would rarely do this. It does not say the coin is fair with chance 0.035.

2. The layouts. The shuffle test gives 3/70=0.04293/70=0.0429 one-sided and 6/70=0.08576/70=0.0857 two-sided. Whether the new layout counts as slower at the 5 % level depends on which question was fixed before the data: “slower” or “different”.

3. Twenty studies. Expected significant results: 1. Chance of at least one: 0.64150.6415. With Bonferroni at 0.00250.0025 each: 0.04880.0488.

4. The pills. With 10 % real effects, power 0.8 and α=0.05\alpha=0.05: 36 % of the significant results are false.

Try it yourself. In 5 tests of nothing at 0.05, the chance of at least one false alarm is 1−0.955=0.22621-0.95^5=0.2262. A coin that lands heads 7 times in 7 flips has one-sided pval=1/128=0.0078p_\text{val}=1/128=0.0078. Under H0H_0, the chance that pval<0.5p_\text{val}<0.5 is 0.5. In 100 tests of useless pills, expect 5 significant.

Where you’ll meet this

Reporting experiments. Papers in medicine, psychology and biology report p-values for their main results. Many journals now ask for effect sizes and intervals beside them, because a p-value alone says so little.

A/B tests. Checking a running test every day and stopping at the first pval<0.05p_\text{val}<0.05 is many tests in disguise, and it collects false wins.

Genetics. A genome scan tests hundreds of thousands of positions at once, so it uses thresholds far below 0.05, the Bonferroni idea at scale.

Headlines. “A study found a link” often means one test of many crossed 0.05. The base rate of real links among those tested decides how much it means.

In signal processing · many tests in a detector

A radar tests every range bin for a target, thousands per sweep. A threshold with a 5 % false-alarm rate per bin would fill the screen with false targets, so detectors set rates far smaller: the many-tests problem. Radar signal processing in the signal processing course sets such thresholds.

Reference card

QuantityFormulaNotes
p-valuePr⁡{at least as extreme∣H0}\Pr\{\text{at least as extreme}\mid H_0\}computed assuming H0H_0
Two-sidedboth tailsdouble a symmetric one-sided value
Shuffle testshare of shuffles at least as extremeexact for small groups
Under H0H_0Pr⁡{pval≤u}=u\Pr\{p_\text{val}\le u\}=uspread evenly on 0 to 1
Many independent testsPr⁡{any<0.05}=1−0.95m\Pr\{\text{any}<0.05\}=1-0.95^m0.6415 for 20
Bonferronitest each at 0.05/m0.05/m
False discoveries(1−q)α/((1−q)α+q(1−β))(1-q)\alpha/\big((1-q)\alpha+q(1-\beta)\big)qq the share of real effects
Notthe chance H0H_0 is true, the chance of replication, the size of the effect

Keep reading with a free account.

By creating an account you accept the terms of use.

Sign in

Already have an account? Use the service you signed up with.

Or keep reading: get new lessons by email

Are you 13 or over?

Accounts and email updates are for people aged 13 or over. We keep only your answer, never your date of birth.

End of the lesson

Where to go next.

Phasorium

Account

Sign inKeep your place on any device

Subjects

Site

Look