P-value calculator: z, t, chi-square and F
This p-value calculator turns a test statistic into a p-value: enter a z score, a t score with its degrees of freedom, a chi-square statistic or an F statistic, choose a two-tailed, left-tailed or right-tailed test, and it shows the p-value, the shaded tail area, the working and the matching TI-84 and R commands. It opens with the paired t test on Student's sleep data, worked through below. Everything runs in your browser.
Result
p = 0.0028
- p = 2 × P(T ≥ 4.0621) for t(9)
- To 10 significant digits: 0.00283300784
- Under the null hypothesis the statistic follows the t(9) distribution.
- Area to the left of −4.0621: 0.0014. Area to the right: 0.9986.
- Two-tailed test: the distribution is symmetric, so the p-value is twice the area beyond |t| = 4.0621: 2 × 0.0014 = 0.0028.
Same calculation in R: 2 * pt(4.0621, 9, lower.tail = FALSE)
How to do this on a TI-84
Press 2nd VARS to open the DISTR menu and choose normalcdf(, tcdf(, χ²cdf( or Fcdf(. With your current inputs:
2*tcdf(4.0621,1E99,9) - The arguments are lower bound, upper bound, then the degrees of freedom (normalcdf( takes μ = 0 and σ = 1).
- There is no infinity key: 1E99 stands for +∞ and −1E99 for −∞. Type the minus sign with the negation key (−).
- For a two-tailed test, multiply one tail by 2, as shown.
Source: Texas Instruments (2004), TI-84 Plus guidebook, chapter 13 (distribution functions).
What a p-value is, and what it is not
A p-value measures how surprising your data would be if the null hypothesis were true. The American Statistical Association's statement on p-values (Wasserstein and Lazar, 2016) puts it this way: "Informally, a p-value is the probability under a specified statistical model that a statistical summary of the data (e.g., the sample mean difference between two compared groups) would be equal to or more extreme than its observed value." Here the statistical summary is your test statistic (z, t, χ² or F), the specified model is the null hypothesis together with the test's assumptions, and "more extreme" is the tail you choose.
The same statement warns against two common misreadings. Its second principle: "P-values do not measure the probability that the studied hypothesis is true, or the probability that the data were produced by random chance alone." Its fifth: "A p-value, or statistical significance, does not measure the size of an effect or the importance of a result." So p = 0.003 does not mean a 0.3% chance that the null hypothesis is true.
From test statistic to p-value
When the null hypothesis and the test's assumptions hold, each statistic follows a known distribution. The p-value is the area under that distribution's curve beyond the observed value: the blue region in the plot above.
z score to p-value
A z statistic follows the standard normal distribution. It comes from a z test of a mean when the population standard deviation is known and, more often, from a test of a single proportion, for which Illowsky and Dean (2023) require np and nq both to be greater than five so that the normal approximation holds. With Φ the standard normal cumulative distribution function (the area to the left of a value),
For example, z = 1.96 gives a two-tailed p-value of 0.0500.
p-value from t
A t statistic follows Student's t distribution with ν (nu) degrees of freedom. It comes from the one-sample t test (ν = n − 1), the paired t test, which is a one-sample test on the n differences (ν = n − 1; Illowsky and Dean, 2023), Welch's two-sample test, whose degrees of freedom are usually fractional, and the test of a correlation coefficient (ν = n − 2). With Tν a t-distributed variable,
As ν grows the t distribution approaches the standard normal; type inf as the degrees of freedom to
get that limit. For a test about a mean, go from t score to p-value, not z, whenever the population standard deviation is
unknown and you used the sample standard deviation s in its place (Illowsky and Dean, 2023).
Chi-square p-value
A χ² statistic comes from a goodness-of-fit test, with k = (number of categories − 1) degrees of freedom, or a test of independence in a contingency table, with k = (rows − 1)(columns − 1) (Illowsky and Dean, 2023). It adds up (O − E)²/E over the cells, where O and E are the observed and expected counts, so a disagreement in either direction makes it larger. That is why, in Illowsky and Dean's words, "The test of independence is always right-tailed because of the calculation of the test statistic." For an observed value x²,
F statistic p-value
An F statistic is a ratio of two variance estimates. In a one-way analysis of variance (ANOVA) with k groups and n observations in all, F = MSbetween / MSwithin on d1 = k − 1 and d2 = n − k degrees of freedom (Illowsky and Dean, 2023); the overall F test of a regression model works the same way. Large values count against the null hypothesis, so for an observed f
R's PlantGrowth data give the dried weights of 30 plants, 10 under a control and 10 under
each of two treatments (R Core Team, 2024). The between-groups sum of squares is 3.766 on 2 degrees of
freedom and the within-groups sum is 10.49 on 27, so F = 1.883 / 0.3886 = 4.846. Choose F, type
4.846 with df1 = 2 and df2 = 27, and the right-tailed p-value is 0.01591, matching the 0.0159
that summary(aov(weight ~ group, data = PlantGrowth)) prints in R.
Choosing the tail
The alternative hypothesis decides the tail. A two-tailed test (the alternative "not equal") counts extreme values in both directions; the NIST/SEMATECH e-Handbook calls such an alternative two-sided "because it guards against alternatives in opposite directions". A left- or right-tailed test counts one direction only, and for z and t its p-value is half the two-tailed one when the statistic falls on the predicted side. Decide the tail from the research question before you see the data. Picking the side after seeing which way the result went halves the p-value and, in effect, doubles the error rate you claim to control.
Choosing χ² or F switches the calculator to right-tailed, the right choice for goodness of fit, independence, ANOVA and regression. The two-tailed option for χ² and F is for tests where a value that is too small also counts against the null hypothesis, such as a test of one variance (χ²) or of the ratio of two variances (F). Their distributions are not symmetric, so there is no mirror-image value; instead the calculator doubles the smaller tail (which is never more than 0.5, so p never exceeds 1):
This matches the two-sided F test for equal variances in the NIST/SEMATECH e-Handbook, which rejects when F
falls below the lower α/2 point or above the upper one, and R's var.test(), which computes its
two-sided p-value the same way.
Worked example: a t score to p-value
Worked example: Student's sleep data, paired t test
R's sleep data record the change in hours of sleep, compared with no drug, for 10 patients
given each of two drugs; R's documentation cites Cushny and Peebles (1905) and Student (1908) as the source (R Core Team, 2024).
Every patient took both drugs, so the test is paired. The differences, drug 1 minus drug 2, are −1.2, −2.4, −1.3, −1.3, 0, −1, −1.8, −0.8, −4.6, −1.4
hours.
Here d̄ = −1.58 is the mean difference, sd = 1.230 their standard deviation and n = 10, so the standard error is 1.230 / √10 = 0.3890 and t = −4.0621 (from unrounded values) on n − 1 = 9 degrees of freedom.
Two-tailed: p = 2 × P(T9 ≥ 4.0621) = 2 × 0.0014164 = 0.002833. R's
t.test(extra ~ group, data = sleep, paired = TRUE) prints t = −4.0621, df = 9,
p-value = 0.002833. Had the hypothesis been fixed in advance as "drug 2 gives more sleep" (negative
differences), the left-tailed p-value would be 0.001416; the right-tailed one is 0.9986.
These are the calculator's default inputs: t = −4.0621 on 9 degrees of freedom, two-tailed. Because the typed t is rounded to four decimals, its 10-digit result, 0.00283300784, agrees with R's 0.002833 to the four significant digits R prints (R's unrounded p, from the unrounded t, is 0.0028328902).
Very small p-values
P-values below 0.0001 are shown in scientific notation: z = 10, right-tailed, gives p = 7.6199 × 10⁻²⁴.
Computing 1 − Φ(10) by subtraction would give exactly 0, because Φ(10) is so close to 1
that a double-precision number rounds it to 1. The calculator computes the small tail directly, as R does with
lower.tail = FALSE, so tiny p-values keep their precision; our tests check them against R to 10
significant digits, down to about 10−300. Only values below about 5 × 10−324 show as 0.
In a report, we suggest giving the p-value to two or three decimal places (p = 0.003 here) and writing p < 0.001 for anything smaller. A value like 7.6199 × 10⁻²⁴ describes the model's far tail, which depends heavily on its assumptions, more than it describes the world.
Reading p against α
Fix the significance level α, often 0.05, before the test. The decision rule in Illowsky and Dean (2023) is "If α > p-value, reject H0"; otherwise you do not reject it. Not rejecting is not evidence for the null: the ASA statement adds that "a relatively large p-value does not imply evidence in favor of the null hypothesis". Its third principle is that "Scientific conclusions and business or policy decisions should not be based only on whether a p-value passes a specific threshold."
So report the size of the effect and its uncertainty alongside p. In the sleep data the mean difference is −1.58 hours, with a 95% confidence interval from −2.46 to −0.70 hours, and the standardised mean difference d̄ / sd is −1.28. Our guide to effect size and the effect size calculator cover the second; how to interpret confidence intervals and the confidence interval calculator cover the first.
Tables or the calculator
A printed table lists critical values only for selected tail areas, so it can only bracket a p-value. In the t table row for 9 degrees of freedom, 4.0621 lies between 3.250 (one-tail area 0.005) and 4.297 (0.001), so the two-tailed p-value is between 0.002 and 0.01. The calculator gives the exact value, 0.002833. A z table works the other way round: it gives Φ to four decimals for z from −3.49 to 3.49 in steps of 0.01, so you round z and read an approximate p; beyond ±3.49 it can only tell you the tail is below 0.0003. The chi-square table, like the t table, lists critical values for ten tail areas per row, so it can only bracket p.
How to report it
Patients gained on average 1.58 hours less extra sleep with drug 1 than with drug 2 (paired t test, t(9) = −4.06, p = 0.003, two-tailed; 95% CI −2.46 to −0.70 hours).
Give the test, the statistic with its degrees of freedom, the p-value and whether it is one- or two-tailed, and
the effect with its interval. The TI-84 box and the R line under the plot give the same
number as the calculator: for the default input, 2*tcdf(4.0621,1E99,9) on the calculator and
2 * pt(4.0621, 9, lower.tail = FALSE) in R. On a TI-84, tcdf( accepts fractional degrees of freedom, but the TI-84
Plus guidebook asks for whole numbers in χ²cdf( and Fcdf( (Texas Instruments, 2004).
For areas under any normal curve, use our normal CDF calculator; for the t test of a correlation, the correlation coefficient calculator. More tools are on the statistics hub.
References
- Illowsky, B. & Dean, S. (2023). Introductory Statistics 2e, sections 9.3, 9.4, 10.4, 11.2, 11.3 and 13.2. OpenStax.
- NIST/SEMATECH (2012). e-Handbook of Statistical Methods, sections 7.1.3, What are statistical tests? and 1.3.5.9, F-test for equality of two variances. itl.nist.gov
- R Core Team (2024). R: A language and environment for statistical computing, documentation for pnorm(), pt(), pchisq(), pf(), var.test(), sleep and PlantGrowth. R Foundation for Statistical Computing. Results checked against R 4.3.3.
- Texas Instruments (2004). TI-84 Plus / TI-84 Plus Silver Edition Guidebook, chapter 13, Inferential statistics and distributions. Copy at Oregon State University.
- Wasserstein, R. L. & Lazar, N. A. (2016). The ASA's statement on p-values: context, process, and purpose. The American Statistician, 70(2), 129–133. doi.org/10.1080/00031305.2016.1154108