HomeStatistics & Probability › P-Value Calculator

P-Value Calculator

Converts a test statistic into a p-value for the standard normal (z), Student t or chi-square distribution, with the chosen tails, the cumulative probability and the critical value at a given significance level.

When to use

You already have a z, t or chi-square statistic (and its degrees of freedom) from a test or a paper and need the p-value or the critical value.

Do not use when: You have the raw data and still need the statistic (use t-test, chi-square-test or proportion-z-test), or the statistic follows another distribution such as F.

Formula

two-tailed (z, t): p = 2 × (1 − F(|statistic|)); right: p = 1 − F(statistic); left: p = F(statistic); chi_square: p = 1 − F(statistic) where F is the CDF of the reference distribution

The normal CDF uses the Abramowitz & Stegun erf approximation (error < 1.5·10⁻⁷); the t CDF uses the regularized incomplete beta function and the chi-square CDF the regularized incomplete gamma function (Numerical Recipes continued fractions). Critical values are found by bisection.

Inputs

ParameterTypeUnitRequiredDescription
statisticnumberyesObserved value of the statistic (z, t or χ²).
distributionenum: z | t | chi_squaredefault zReference distribution of the statistic under the null hypothesis.
degrees_of_freedomnumbernoRequired for t and chi_square; ignored for z. May be fractional (Welch t-test). Range: > 0, ≤ 10000000
tailsenum: two | right | leftdefault twoWhich tail(s) count as at least as extreme. For chi_square the p-value is always the upper tail.
alphanumberdefault 0.05Significance level as a probability (0.05 = 5 %), not a percentage. Confidence intervals and critical values use level 1 − alpha. Range: > 0

Outputs

OutputTypeUnitDescription
p_valuenumberProbability, under H0, of a statistic at least as extreme as the observed one in the chosen tail(s).
cumulative_probabilitynumberP(X ≤ statistic) under the reference distribution.
critical_valuenumberStatistic value at which p would equal alpha (two-tailed: the positive bound ±value; left-tailed: negative).
distribution_usedstringReference distribution and degrees of freedom.
significantbooleantrue when p_value < alpha.
decisionstringPlain-language conclusion.

Example

t = 2.0 with 10 df, two-tailed: {"statistic":2,"distribution":"t","degrees_of_freedom":10,"tails":"two"}{"p_value":0.073388,"cumulative_probability":0.963306,"critical_value":2.2281,"significant":false}

Chi-square = 3.84 with 1 df: {"statistic":3.84,"distribution":"chi_square","degrees_of_freedom":1}{"p_value":0.050044,"cumulative_probability":0.949956,"critical_value":3.8415,"significant":false}

GET https://tttkmbb.com/api/v1/calculate/p-value?statistic=2&distribution=t&degrees_of_freedom=10&tails=two

Machine access

Sources

FAQ

One-tailed or two-tailed?

Two-tailed unless the direction of the effect was specified before looking at the data. A two-tailed p is twice the one-tailed p in the observed direction.

Why is the chi-square p-value always upper-tailed?

The chi-square statistic measures total discrepancy, so only large values contradict H0; goodness-of-fit and independence tests use the upper tail.

What does p < 0.05 mean?

If H0 were true, a statistic at least this extreme would occur in fewer than 5 % of repetitions. It is not the probability that H0 is true.

Related calculators