Section 11.23

p-value

Definition

The p-value is a probability computed in a hypothesis test §11.22. Assuming the null hypothesis, a stated model of the data without the effect of interest, is true, the p-value is the probability of obtaining a test statistic at least as extreme as the one observed. A test statistic is one number that summarizes the data; “extreme” means far in the direction the test looks for. A small p-value says the data would be unusual if the null hypothesis held; it is not the probability that the null hypothesis is true.

The idea

A coin is tossed ten times and lands heads every time. To judge how surprising that is for a fair coin, assume the coin is fair and compute how often ten fair tosses give a result this lopsided: (1/2)10=1/1024(1/2)^{10} = 1/1024, about once in a thousand tries. That number is a p-value. It measures, on a probability scale, how poorly the data fit the assumed model.

The calculation assumes the null hypothesis and asks about the data. The question people usually want answered runs the other way: given the data, how likely is the null hypothesis? The two are different conditional probabilities §15.43, and they can be far apart. Almost every professional basketball player is tall, yet almost no tall person is a professional basketball player. In the same way, data can be unlikely under the null hypothesis while the null hypothesis stays likely, for example in a field where real effects are rare. A p-value alone cannot tell which is the case.

How it works

  1. Before seeing the data, fix the null hypothesis H0H_0, the test statistic TT, and which values of TT count as more extreme: large values (a right-tailed test), small values (a left-tailed test), or both directions (a two-sided test).

  2. Compute the observed value tobst_{\mathrm{obs}} of TT from the data.

  3. Find the null distribution, the distribution TT would have if H0H_0 were true. It comes from exact counting, from the random assignment §11.8 carried out in the experiment, from a mathematical approximation such as the normal distribution, or from simulating the null model many times.

  4. Add up the null probabilities of all outcomes at least as extreme as tobst_{\mathrm{obs}}. The sum is the p-value.

A test at significance level α\alpha, the false-rejection probability it allows, rejects H0H_0 exactly when the p-value is at most α\alpha. The p-value therefore gives the decision at every level at once: p=0.01p = 0.01 rejects at α=0.05\alpha = 0.05 and at α=0.01\alpha = 0.01, but not at α=0.001\alpha = 0.001.

For a two-sided test with a discrete or lopsided null distribution, several conventions exist, such as doubling the smaller one-sided p-value, or adding the probabilities of all outcomes no more probable than the observed one. They can give different values, so a report states which rule it used.

Worked example

Ten tosses of a coin give ten heads. The null hypothesis is that the coin is fair and the tosses are independent; TT is the number of heads. For a one-sided test looking for too many heads, the only outcome at least as extreme as 10 heads is 10 heads itself. Each of the 10 independent tosses lands heads with probability 1/21/2, and 210=10242^{10} = 1024, so p=(1/2)10=1/1024≈0.000977p = (1/2)^{10} = 1/1024 \approx 0.000977.

If the declared rule is two-sided, ten tails counts as just as extreme as ten heads. The two outcomes cannot both happen, so their probabilities add: p=1/1024+1/1024=2/1024≈0.00195p = 1/1024 + 1/1024 = 2/1024 \approx 0.00195.

Had the tosses shown 9 heads, the one-sided p-value would include every outcome with at least 9 heads. Exactly 9 heads can happen in (109)=10\binom{10}{9} = 10 ways, one for each position of the single tail, and 10 heads in 1 way, so p=(10+1)/1024=11/1024≈0.0107p = (10 + 1)/1024 = 11/1024 \approx 0.0107.

An invented population of studies shows why p≤0.05p \le 0.05 does not mean a 5% chance that H0H_0 is true. Suppose 1000 hypotheses are tested, each at α=0.05\alpha = 0.05. For 900 of them the null hypothesis is true and the test rejects with probability exactly 0.05. For the other 100 a real effect exists, and the test detects it with probability 0.8, its statistical power §11.25. Expected false rejections: 900×0.05=45900 \times 0.05 = 45. Expected true rejections: 100×0.8=80100 \times 0.8 = 80. For a study chosen uniformly from this population, the chance of a true null given a rejection is therefore 45/(45+80)=0.3645/(45 + 80) = 0.36, or 36%. The actual counts in any one set of 1000 tests can vary. The split 900 and 100 is exactly the information that a p-value does not contain.

Stated precisely

For a right-tailed test, p=PrH0(T≥tobs),p = \Pr_{H_0}(T \ge t_{\mathrm{obs}}), where TT is the test statistic of a fresh experiment with the same design, treated as a random quantity, tobst_{\mathrm{obs}} is the value actually observed, and PrH0\Pr_{H_0} means probability computed as if H0H_0 generated the data. A left-tailed test uses T≤tobsT \le t_{\mathrm{obs}}. For a composite null hypothesis, which contains several distributions, pp is the largest of these probabilities over the distributions in H0H_0 (strictly, their least upper bound §19.2.6). The subscript H0H_0 names the assumption of the calculation, not a conclusion that the assumption holds.

The property that makes the p-value useful is PrH0(p≤α)≤αfor every α between 0 and 1,\Pr_{H_0}(p \le \alpha) \le \alpha \quad \text{for every } \alpha \text{ between 0 and 1}, with equality for the exact tail probability of a continuous test statistic under a fully specified null distribution. That p-value is uniform between 0 and 1. With a composite null, taking the largest tail probability can be conservative even for continuous data. For example, let TT be uniform from 0 to aa, where the null allows any 0<a≤10<a\le1, and test for unusually large values. The largest tail probability is p=1−Tp=1-T, attained at a=1a=1. If the true aa is 0.5, then T≤0.5T\le0.5, so every p-value is at least 0.5. In words: if H0H_0 is true, a p-value of 0.05 or less occurs at most 5% of the time. This is why “reject when p≤αp \le \alpha” is a test at level α\alpha. The property needs three assumptions: the null model, including independence and the sampling or assignment design, describes how the data were generated; TT and the direction of extremeness were fixed before the data were seen; and data collection stopped by the rule the calculation assumes.

Write Pr(A∣B)\Pr(A \mid B) for the probability of AA given that BB holds. The p-value is of the form Pr(data at least this extreme∣H0)\Pr(\text{data at least this extreme} \mid H_0); the probability that the null hypothesis is true is Pr(H0∣data)\Pr(H_0 \mid \text{data}). Bayes’ theorem connects the two only through two further quantities: the probability of H0H_0 before the data were seen, called its prior probability, and the probability of the data under the alternatives [474]. The p-value supplies neither. The American Statistical Association’s 2016 statement on p-values gives the same definition and states that a p-value measures neither the probability that the studied hypothesis is true nor the size of an effect.

Limits and common mistakes

A p-value is not the probability that H0H_0 is true, and not the probability that the data arose by chance alone.

A p-value is not an effect size §11.24. A tiny difference measured on many units gives a tiny p-value; a large difference measured on few units can give a large one. Report the effect and its confidence interval §11.18.

A p-value above 0.05 does not show that there is no effect. The test may have had low statistical power.

A p-value is not the probability that a repeat of the experiment would again give a small p-value.

Selection breaks the calculation. Running many analyses and reporting the smallest p-value, or adding data until pp drops below 0.05, makes small p-values far more frequent than the formula says; the Multiple comparisons §11.26 entry treats this.

A correct tail probability under the wrong model is the wrong p-value. For example, treating many positively correlated readings from one device as independent can understate the uncertainty of their mean and give p-values that are too small.

The threshold 0.05 is a convention. Values of p=0.049p = 0.049 and p=0.051p = 0.051 carry nearly the same evidence.

Questions answered

Is it the probability that the null hypothesis is true?

No. A p-value is the probability, computed on the assumption that the null hypothesis is true, of obtaining a test statistic at least as extreme as the one observed. It assumes the null hypothesis and asks about the data; the probability that the null hypothesis is true would take the data as given and ask about the hypothesis. These are different conditional probabilities. Turning one into the other needs information the p-value does not contain: how plausible the null hypothesis was before the data, and how probable the data are under the alternatives.

For example, if 900 of 1000 tested null hypotheses are true, the false-rejection probability is 0.05, and the detection probability is 0.8 for the other 100, the expected counts are 900×0.05=45900 \times 0.05 = 45 false and 100×0.8=80100 \times 0.8 = 80 true rejections. A randomly chosen study, given a rejection, has a 45/125=36%45/125 = 36\% chance of having a true null hypothesis. A p-value is also not the probability that the result is due to chance, and not a measure of how large the effect is.

Related entries: Hypothesis test (§11.22), Effect size (§11.24), Multiple comparisons (§11.26), Statistical power (§11.25), Conditional probability (§15.43). Further reading: [171, 474].