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: , 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
Before seeing the data, fix the null hypothesis , the test statistic , and which values of count as more extreme: large values (a right-tailed test), small values (a left-tailed test), or both directions (a two-sided test).
Compute the observed value of from the data.
Find the null distribution, the distribution would have if 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.
Add up the null probabilities of all outcomes at least as extreme as . The sum is the p-value.
A test at significance level , the false-rejection probability it allows, rejects exactly when the p-value is at most . The p-value therefore gives the decision at every level at once: rejects at and at , but not at .
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; 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 , and , so .
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: .
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 ways, one for each position of the single tail, and 10 heads in 1 way, so .
An invented population of studies shows why does not mean a 5% chance that is true. Suppose 1000 hypotheses are tested, each at . 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: . Expected true rejections: . For a study chosen uniformly from this population, the chance of a true null given a rejection is therefore , 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, where is the test statistic of a fresh experiment with the same design, treated as a random quantity, is the value actually observed, and means probability computed as if generated the data. A left-tailed test uses . For a composite null hypothesis, which contains several distributions, is the largest of these probabilities over the distributions in (strictly, their least upper bound §19.2.6). The subscript names the assumption of the calculation, not a conclusion that the assumption holds.
The property that makes the p-value useful is 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 be uniform from 0 to , where the null allows any , and test for unusually large values. The largest tail probability is , attained at . If the true is 0.5, then , so every p-value is at least 0.5. In words: if is true, a p-value of 0.05 or less occurs at most 5% of the time. This is why “reject when ” is a test at level . The property needs three assumptions: the null model, including independence and the sampling or assignment design, describes how the data were generated; and the direction of extremeness were fixed before the data were seen; and data collection stopped by the rule the calculation assumes.
Write for the probability of given that holds. The p-value is of the form ; the probability that the null hypothesis is true is . Bayes’ theorem connects the two only through two further quantities: the probability of 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 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 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 and 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 false and true rejections. A randomly chosen study, given a rejection, has a 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].