Understanding the hypothesis testing calculator — concept and principle
This calculator runs the three most common one-sample tests: a z test for a mean with known σ, a t test for a mean with unknown σ, and a z test for one proportion. It gives the test statistic, the p-value, the critical value, the standard error, the degrees of freedom and the decision at your significance level. Use it for statistics homework and quick checks of survey or experiment results.
How it is calculated
Mean, σ known: z = (x̄ − μ₀) ÷ (σ/√n)
Mean, σ unknown: t = (x̄ − μ₀) ÷ (s/√n), with n − 1 degrees of freedom
One proportion: z = (p̂ − p₀) ÷ √(p₀(1 − p₀)/n), with p̂ = successes ÷ n
Reject H₀ when p < α (equivalently, when the statistic falls beyond the critical value).
- The proportion test needs np₀ and n(1 − p₀) both above 5.
- The alternative can be two-sided (≠), less than or greater than.
The principle
A test starts from the assumption that nothing unusual is going on (H₀) and asks how surprising the data would be under it. The test statistic counts how many standard errors the sample result is from the hypothesised value. The p-value is the probability of a result at least that far out if H₀ were true. If that probability is below α, the data are judged inconsistent with H₀. The t distribution replaces z when σ is estimated from the sample, adding a little extra uncertainty.
Worked example
Default inputs: t test, x̄ = 52.3, μ₀ = 50, s = 6, n = 36, α = 0.05, two-sided.
- Standard error = 6 ÷ √36 = 1.
- t = (52.3 − 50) ÷ 1 = 2.3, with 35 degrees of freedom.
- Two-sided critical value at α = 0.05: ±2.03.
- p-value = 2 × P(t₃₅ > 2.3) = 0.02753.
- Decision: Reject H₀ — significant at this α.
| Sample size n | p-value |
|---|---|
| 9 | 0.2834 |
| 18 | 0.1223 |
| 27 | 0.05699 |
| 36 | 0.02753 |
| 45 | 0.01358 |
| 54 | 0.006797 |
| 72 | 0.001751 |
How to read the result
The sample mean is 2.3 standard errors above 50, and a difference that large would happen only about 2.8 % of the time if the true mean were 50. That is evidence the mean differs from 50, but it does not say the difference is large or important: 2.3 units may or may not matter in practice. Report the estimate with a confidence interval as well.
Common mistakes
- Using z with a sample standard deviation and a small n.
- Choosing a one-sided test after seeing the data.
- Reading p as the probability that H₀ is true.
- Saying "accept H₀" when the result is not significant; the correct phrase is "fail to reject".
Frequently asked questions
What does a p-value of 0.0275 mean?
If H₀ were true, a result at least this extreme would occur about 2.75 % of the time.
When do I use a t test instead of a z test?
When the population standard deviation is unknown and estimated from the sample.
What is the significance level α?
The false-alarm risk you accept, commonly 0.05.
Sources: NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.2 Confidence Limits for the Mean · OpenStax, Introductory Statistics 2e (2023), Chapter 9 Hypothesis Testing with One Sample