MathsStatistics & Probability

P-Value
calculator.

A p-value says how surprising your test statistic is if nothing real is going on.

How it's worked out

A p-value is the chance, assuming the null hypothesis is true, of a test statistic at least as extreme as yours. That hypothesis, written H₀, is the claim your test tries to knock down. You give the statistic your test produced, the curve it follows and which tail counts. The answer is an area under that curve.

right-tailed: p\displaystyle \text{right-tailed: } p=P(T≥t)\displaystyle {}= P(T \ge t)
left-tailed: p\displaystyle \text{left-tailed: } p=P(T≤t)\displaystyle {}= P(T \le t)
two-tailed: p\displaystyle \text{two-tailed: } p=2P(T≥|t|)\displaystyle {}= 2\,P(T \ge |t|)

Here T is a value drawn from the curve and t is your statistic. For the symmetric z and t curves, the two-tailed form doubles the area beyond the size of the statistic. Chi-square and F statistics cannot be negative and their curves lean to one side, so a two-tailed result doubles the smaller of the two areas instead.

p\displaystyle p=2min⁡(P(X≤x), P(X≥x))\displaystyle {}= 2 \min\bigl(P(X \le x),\ P(X \ge x)\bigr)

The right-hand area is worked out directly, not as 1 minus the left-hand area, so a very small p-value keeps its digits. A critical value runs the same sum backward: pick a significance level, called α, and it finds the point with that much area beyond it. NIST sets out the rejection regions for one and two tails, and notes that 0.05 is the most common choice of α.

Worked examples

Order values after a checkout redesign

A shop compares average order value before and after a redesign and gets z = 2.1. A rise or a fall would both matter, so the test is two-tailed. The area beyond 2.1 is 0.0179, and doubling it gives p = 0.0357, which is below 0.05.

Had the shop fixed on "only a rise counts" before seeing any data, the right-tailed p-value would be 0.0179. It may not make that switch after looking, because that halves p with no new evidence.

Open this example in the tool

Two teaching methods, t = 2.5 on 30 degrees of freedom

A two-group study gives t = 2.5 with 30 degrees of freedom. The two-tailed p-value is 0.0181. The cut-off at α = 0.05 is ±2.042, and 2.5 is past it, so the result is significant at 5%. At 1% the cut-off moves to ±2.75, and 2.5 falls short.

The same 2.5 read as a z statistic gives 0.0124, which is smaller. The t curve has heavier tails than z, so a small study needs a larger statistic to reach the same p.

Open this example in the tool

Is a gauge steadier than claimed?

A test of one variance on 25 readings gives a chi-square statistic of 9.2 on 24 degrees of freedom. The value is in the left tail, so the two-tailed p-value is twice the left area: 0.0057. The two cut-offs at α = 0.05 are 12.401 and 39.364. The statistic is below the lower one, which points to less variation than claimed.

Open this example in the tool

Reading your result

Treat α as a line you drew in advance, not a cliff. Scientific and business decisions should not rest only on whether p passes a threshold, as the American Statistical Association puts it. A chi-square of 7.81 on 3 degrees of freedom gives 0.0501, and a z of 1.96 gives 0.0500. Both sit almost exactly on 0.05, and small changes in the data could tip either way.

Use the evidence words as a rough scale only. The tool says little or no evidence at 0.1 and above, weak from 0.05 to 0.1, moderate from 0.01 to 0.05, strong from 0.001 to 0.01 and very strong below that. These are common habits, not a standard, and the same statement warns that a p-value alone is not a good measure of evidence.

Check the conditions behind the curve. The area is only right if your statistic really follows that curve when the null hypothesis holds. That rests on the test that produced it, such as independent observations and enough data.

Two-tailed critical values of t, by degrees of freedom
dfα = 0.10α = 0.05α = 0.01
16.31412.70663.657
22.924.3039.925
52.0152.5714.032
101.8122.2283.169
201.7252.0862.845
301.6972.0422.75
601.67122.66
1201.6581.982.617
z1.6451.962.576

Common mistakes

  • Reading p as the chance that H₀ is true. The ASA statement says p-values do not measure that. A p of 0.0357 does not mean a 3.6% chance that nothing is going on.
  • Reading a small p as a big effect. A tiny difference in a huge sample can give a very small p. Report an effect size and an interval with it.
  • Going one-tailed after you see the data. UCLA's statistics group calls this inappropriate, even when the two-tailed result came close.
  • Testing many things and keeping the winners. Of the z statistics 1.2, 1.96, 2.1, 2.58, 3.3, 4 pass at 0.05 one by one. After Holm's adjustment, which holds the false alarm rate across the whole list, 2 pass.

Questions people ask

If the null hypothesis were true, data at least as extreme as yours would turn up less than 5% of the time. That is enough, by convention, to reject it at the 5% level. It does not say how likely the null hypothesis is, and it says nothing about how large the effect is.

Sources