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
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.
This browser did not allow copying. The sentence is in the box below, already selected: copy it with your keyboard or the menu.
How to use this calculator
Fill in the fields in this order; each step takes you to its field.
- Number of successes (x): enter 0 or more.
- Sample size (n): enter 1 or more.
- Null hypothesis proportion p₀ (0 to 1): enter a number from 0 to 1.
- Alternative hypothesis: choose Left-tailed (p < p₀), Right-tailed (p > p₀) or Two-tailed (p ≠ p₀).
- Significance level α: enter a number from 0 to 1.
- 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
| Symbol | Meaning |
|---|---|
| Number of successes | |
| Sample size | |
| Null hypothesis proportion p₀ (0 to 1) | |
| Alternative hypothesis (1: Left-tailed (p < p₀); 2: Right-tailed (p > p₀); 3: Two-tailed (p ≠ p₀)) | |
| Sample proportion p̂ = x ÷ n | |
| z statistic | |
| p-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 hypothesis | Two-tailed (p ≠ p₀) |
| Significance level α | 0.05 |
| Sample proportion p̂ = x ÷ n | 0.58 |
|---|---|
| z statistic | 1.6 |
| Decision at α | Do not reject the null hypothesis (p-value at or above α) |
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.