Skip to content
FiftyCalc Free calculators for all 50 states

Hypothesis Testing Calculator

Test cases replayed : 3 of 3 match · Methodology · No outside source listed

Enter the number of successes, the sample size and the proportion claimed by the null hypothesis to test it.

Result

Sample figures

p-value—

Sample proportion p̂ = x ÷ n —

  • z statistic—
  • Decision at α—

Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.

Hypothesis Testing Calculator

Number of successes (x): enter 0 or more. Prefilled example: 58.

Sample size (n): enter 1 or more. Prefilled example: 100.

Null hypothesis proportion p₀ (0 to 1): enter a number from 0 to 1. Prefilled example: 0.5.

Alternative hypothesis

Alternative hypothesis: choose Left-tailed (p < p₀), Right-tailed (p > p₀) or Two-tailed (p ≠ p₀). Prefilled example: Two-tailed (p ≠ p₀).

Significance level α: enter a number from 0 to 1. Prefilled example: 0.05.

How to use this calculator

Fill in the fields in this order; each step takes you to its field.

  1. Number of successes (x): enter 0 or more.
  2. Sample size (n): enter 1 or more.
  3. Null hypothesis proportion p₀ (0 to 1): enter a number from 0 to 1.
  4. Alternative hypothesis: choose Left-tailed (p < p₀), Right-tailed (p > p₀) or Two-tailed (p ≠ p₀).
  5. Significance level α: enter a number from 0 to 1.
  6. Read the result: p-value; the panel also shows Sample proportion p̂ = x ÷ n, z statistic and Decision at α.

How this calculator works

Steps of a hypothesis test: state H₀ (p = p₀) and the alternative, compute the test statistic, find the p-value, and reject H₀ if the p-value is below α.

For a proportion: z = (p̂ − p₀) ÷ √(p₀ (1 − p₀) ÷ n). The normal approximation is reliable when n p₀ and n (1 − p₀) are both at least 10.

The formula

  1. P=xn
  2. Z=P−p0p0×(1−p0)n
  3. P2={normcdf⁡(Z)if t=11−normcdf⁡(Z)if t=22×(1−normcdf⁡(|Z|))otherwise
Symbols used in the formula
SymbolMeaning
xNumber of successes
nSample size
p0Null hypothesis proportion p₀ (0 to 1)
tAlternative hypothesis (1: Left-tailed (p < p₀); 2: Right-tailed (p > p₀); 3: Two-tailed (p ≠ p₀))
PSample proportion p̂ = x ÷ n
Zz statistic
P2p-value
normcdf(x, m, s)the probability that a Gaussian variable with mean m and standard deviation s is at most x (mean zero and standard deviation one without m and s).

Worked example

Number of successes (x)58
Sample size (n)100
Null hypothesis proportion p₀ (0 to 1)0.5
Alternative hypothesisTwo-tailed (p ≠ p₀)
Significance level α0.05
Sample proportion p̂ = x ÷ n0.58
z statistic1.6
Decision at αDo not reject the null hypothesis (p-value at or above α)
  1. P=58100=0.58
  2. Z=0.58−0.50.5×(1−0.5)100=1.6
  3. P2=2×(1−normcdf⁡(|1.6|))=0.109599

p-value 0.1096

Each step uses the unrounded value of the step before it; figures on this page are rounded for display.

Frequently asked questions

Is 58 heads in 100 flips evidence of a biased coin?

z = 1.6 and the two-tailed p-value is 0.1096, so the data do not reject a fair coin at α = 0.05.

What is the difference between a type I and a type II error?

A type I error rejects a true null hypothesis (its probability is α); a type II error fails to reject a false one.

Questions answered

Related calculators