P-value calculator (from z, t, or chi-square)

By Jude Wallis · Published

A p-value is the probability, if the null is true, of a test statistic at least as extreme as the one observed, in the alternative's direction. Enter a z or t (one- or two-tailed), or a chi-square with its degrees of freedom, and the tool returns it. Example: z = 2.4 two-tailed gives p = 0.0164.

p-value

0.0164

At alpha = 0.05 this p-value is below the significance level, so you would reject the null hypothesis. What a p-value actually means: the probability, assuming the null hypothesis is true, of a result at least this extreme.

Steps

  1. 1.area beyond z = 2.4 in one tail: 0.0082
  2. 2.two-sided: double it → 0.0164

AP Statistics: Unit 3 (topics 3.6 p-Values, 3.14 Setting Up a Chi-Square Test for Homogeneity or Independence, 3.15 Carrying Out a Chi-Square Test for Homogeneity or Independence, 4.5 Carrying Out a Test for a Population Mean or Population Mean Difference). p-Values are introduced in Unit 3, Topic 3.6 for a population proportion using a z statistic, while t-based p-values belong to Unit 4 and right-tailed chi-square p-values to the homogeneity and independence tests of Topics 3.14 and 3.15.

What this p-value calculator does

This p-value calculator converts a test statistic into a p-value, the number you compare against a significance level to decide a hypothesis test. Pick the distribution that matches your test: the standard normal curve for a z statistic (a z-score, the standardized distance from the null value), a t distribution for a t statistic, or the chi-square distribution for the chi-square statistic (χ2\chi^2).

For a z or t statistic you also choose a one-tailed or two-tailed p-value, which follows from your alternative hypothesis. For a t or chi-square statistic you enter the degrees of freedom (df), which set the shape of the curve. The chi-square option reports a right-tail area only.

What a p-value is

A p-value is the probability, computed assuming the null hypothesis is true, of getting a test statistic as extreme or more extreme than the one you observed, in the direction of the alternative hypothesis. A small p-value means your result would be unusual if the null were true, so it gives evidence for the alternative. A p-value that is not small does not prove the null; it just fails to give convincing evidence against it.

For the longer version with interpretation wording, see what a p-value means.

How to find a p-value from a test statistic

Finding a p-value from a test statistic comes down to measuring one area under the null distribution. Which area you measure depends on the alternative hypothesis.

  • Alternative is >: use the upper tail, P(Zz)P(Z \ge z) or P(Tt)P(T \ge t).
  • Alternative is <: use the lower tail, P(Zz)P(Z \le z) or P(Tt)P(T \le t).
  • Alternative is not equal: use both tails, which for the symmetric z and t curves equals 2P(Zz)2 \cdot P(Z \ge |z|).
  • Chi-square: use the right tail P(χ2x)P(\chi^2 \ge x) only.

To use the tool, pick z, t, or chi-square, type the test statistic, add the df for a t or chi-square value, choose the tail for a z or t, then read off the p-value it returns.

Degrees of freedom for t and chi-square

The t and chi-square curves change shape with their degrees of freedom, so the calculator needs that number. For a one-sample t test, df=n1df = n - 1, where n is the sample size. For a chi-square test of homogeneity or independence, df=(rows1)(columns1)df = (\text{rows} - 1)(\text{columns} - 1) from the two-way table.

The wrong df shifts the tail area, so it changes the p-value. A z statistic uses the standard normal curve and needs no df.

One-tailed or two-tailed

The tail choice matches your alternative hypothesis, not your data. A one-sided alternative (> or <) uses a single tail. A two-sided alternative (not equal) splits the probability across both tails, so for z and t the two-tailed p-value is double the one-tailed area.

Chi-square tests for homogeneity and independence are right-tailed, because the statistic adds up squared differences and can only get large when observed counts sit far from expected. See null vs alternative hypotheses if you are unsure which one you have.

z = 2.4, two-tailed

A two-sided z test gives a standardized test statistic of z = 2.4. Find the two-tailed p-value.

  1. The null distribution is the standard normal curve, so work with the upper tail of z=2.4|z| = 2.4.

  2. From a z-table (or the calculator), the area to the left of 2.4 is Φ(2.40)=0.9918\Phi(2.40) = 0.9918.

  3. Upper-tail area: P(Z2.4)=10.9918=0.0082P(Z \ge 2.4) = 1 - 0.9918 = 0.0082.

  4. Two-tailed p-value: double it, 2×0.0082=0.01642 \times 0.0082 = 0.0164.

p = 0.0164.

t = 1.885, df = 24, two-tailed

A two-sided t test with sample size n = 25 has a t statistic of t = 1.885 and df = n - 1 = 24. Find the two-tailed p-value.

  1. Use the t distribution with 24 degrees of freedom.

  2. The one-tailed upper area is P(T1.885)0.0358P(T \ge 1.885) \approx 0.0358.

  3. As a check, 1.885 sits between the df = 24 critical values 1.711 (upper area 0.05) and 2.064 (upper area 0.025), so the one-tailed area is between 0.025 and 0.05.

  4. Two-tailed p-value: 2×0.0358=0.07162 \times 0.0358 = 0.0716.

p is about 0.0716.

chi-square = 3.84, df = 1

A chi-square test gives χ2=3.84\chi^2 = 3.84 with df = 1. Find the p-value.

  1. Chi-square p-values use the right tail only: P(χ23.84)P(\chi^2 \ge 3.84).

  2. With df = 1, the chi-square statistic equals a squared z-score, so P(χ23.84)=P(Z3.84)P(\chi^2 \ge 3.84) = P(|Z| \ge \sqrt{3.84}).

  3. 3.841.96\sqrt{3.84} \approx 1.96, and P(Z1.96)=0.0250P(Z \ge 1.96) = 0.0250.

  4. Right-tail area: 2×0.0250=0.052 \times 0.0250 = 0.05.

p is about 0.05 (the value 3.841 is the exact 0.05 cutoff for df = 1).

Frequently asked questions

What p-value counts as statistically significant?

There is no universal cutoff. You compare the p-value to a significance level chosen before the test, commonly 0.05 or 0.01, and a p-value below that level is treated as evidence for the alternative hypothesis. The smaller the p-value, the more convincing that evidence.

Why does a chi-square test only use the right tail?

The chi-square statistic adds up squared, standardized differences between observed and expected counts, so it can never be negative. Small values mean the observed data are close to what the null predicts, which is not surprising. Only large values, far out in the right tail, count as evidence against the null.

Do you always double a p-value for a two-tailed test?

For the symmetric z and t distributions, a two-tailed p-value equals twice the one-tailed tail area. Chi-square tests for homogeneity and independence are already right-tailed, so you do not double them. Match the tail to the alternative hypothesis rather than doubling out of habit.