Understanding the p-value calculator — concept and principle
This calculator converts a test statistic (z, t, chi-square or F) into a p-value for a left-, right- or two-tailed test, and tells you whether the result is significant at α = 0.05 and α = 0.01. Use it when software gave you only the statistic, when checking a textbook problem, or when you computed a statistic by hand.
How it is calculated
- Left-tailed: p = P(T ≤ t)
- Right-tailed: p = P(T ≥ t)
- Two-tailed: p = 2 × min(left area, right area), capped at 1
The areas come from the cumulative distribution function of the chosen distribution: the standard normal; Student's t with df degrees of freedom; chi-square with df; or F with numerator and denominator df. These are computed with the regularized incomplete beta and gamma functions. Chi-square and F statistics cannot be negative.
The principle
A hypothesis test starts by assuming the null hypothesis H₀ is true. Under H₀ the test statistic follows a known distribution. The p-value asks: if H₀ were true, how often would chance alone produce a statistic at least this extreme? A small p-value means the observed data would be unusual under H₀, which counts as evidence against it. The tail depends on the alternative hypothesis: a two-tailed test counts extremes in both directions, so the one-tail area is doubled.
Worked example
Default inputs: standard normal (z), statistic 2.1, two-tailed.
- Area to the left of z = 2.1: Φ(2.1) ≈ 0.9821.
- Area to the right: 1 − 0.9821 ≈ 0.01786.
- Two-tailed p = 2 × 0.01786 = 0.03573.
- 0.03573 < 0.05, so reject H₀ at α = 0.05; 0.03573 > 0.01, so do not reject at α = 0.01.
(The degrees of freedom are ignored for a z statistic.)
| Test statistic value | p-value |
|---|---|
| 0.525 | 0.5996 |
| 1.05 | 0.2937 |
| 1.57 | 0.1153 |
| 2.1 | 0.03573 |
| 2.62 | 0.008665 |
| 3.15 | 0.001633 |
| 4.2 | 0.00002669 |
How to read the result
Compare p with the significance level α you chose before the test. p < α: the result is statistically significant and you reject H₀. p ≥ α: you do not reject H₀, which is not the same as proving it true. A p-value is not the probability that H₀ is true, and it says nothing about how large or important the effect is. Report the effect size and a confidence interval alongside it.
Common mistakes
- Using a two-tailed p-value for a one-sided hypothesis, or the reverse.
- Choosing α after seeing the p-value.
- Reading p = 0.04 as "a 4% chance the null is true".
- Using a left tail for chi-square or F tests, which are normally right-tailed.
- Entering the wrong degrees of freedom for t, chi-square or F.
Frequently asked questions
What does p = 0.05 mean?
If H₀ were true, a result at least this extreme would occur about 5% of the time by chance.
Is a smaller p-value a bigger effect?
Not necessarily. With a large sample, a tiny effect can have a very small p-value.
When should I use t instead of z?
Use t when the population standard deviation is unknown and estimated from the sample, which is the usual case.
Can a p-value be exactly 0?
Not in theory, but it can be smaller than the displayed precision; report it as, for example, p < 0.0001.
Sources: OpenStax, Introductory Statistics 2e, §9.3–9.4 · NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.6.7