Home › Statistics & 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
| Parameter | Type | Unit | Required | Description |
|---|---|---|---|---|
statistic | number | yes | Observed value of the statistic (z, t or χ²). | |
distribution | enum: z | t | chi_square | default z | Reference distribution of the statistic under the null hypothesis. | |
degrees_of_freedom | number | no | Required for t and chi_square; ignored for z. May be fractional (Welch t-test). Range: > 0, ≤ 10000000 | |
tails | enum: two | right | left | default two | Which tail(s) count as at least as extreme. For chi_square the p-value is always the upper tail. | |
alpha | number | default 0.05 | Significance level as a probability (0.05 = 5 %), not a percentage. Confidence intervals and critical values use level 1 − alpha. Range: > 0 |
Outputs
| Output | Type | Unit | Description |
|---|---|---|---|
p_value | number | Probability, under H0, of a statistic at least as extreme as the observed one in the chosen tail(s). | |
cumulative_probability | number | P(X ≤ statistic) under the reference distribution. | |
critical_value | number | Statistic value at which p would equal alpha (two-tailed: the positive bound ±value; left-tailed: negative). | |
distribution_used | string | Reference distribution and degrees of freedom. | |
significant | boolean | true when p_value < alpha. | |
decision | string | Plain-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°rees_of_freedom=10&tails=two
Machine access
- API:
GET https://tttkmbb.com/api/v1/calculate/p-value(query parameters) orPOSTwith a JSON body{"inputs": {...}} - Schema: https://tttkmbb.com/api/v1/calculators/p-value · Markdown: https://tttkmbb.com/statistics/p-value.md · JSON definition: https://tttkmbb.com/statistics/p-value.json
- MCP: server
https://tttkmbb.com/mcp, toolrun_calculator with calculator_id="p-value" - OpenAPI operationId:
calculate_p_value - Freshness:
static. Authentication: none. Rate limit: fair use (see rate limits).
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
- T-Test Calculator — Compute t and its p-value from data.
- Chi-Square Test Calculator — Chi-square statistic from observed counts.
- Z-Score Calculator — Standardise a value to obtain a z statistic.