Hypothesis Testing Calculator

Hypothesis Testing Calculator

Test a claim about a mean or a proportion and get the full write-up: hypotheses, test statistic, p-value, decision and a plain-English conclusion.

Reject H₀ when p < α

Alternative hypothesis
Choose what you're testing and fill in the sample figures

What is Hypothesis Testing?

Hypothesis testing is a way of deciding whether data give real evidence against a claim, or whether the gap could easily be chance. You assume the claim (the null hypothesis, H₀) is true and ask how surprising your sample would be.

If the result would be very surprising, with a p-value below your chosen significance level α, you reject the claim in favour of the alternative, H₁. If not, you don't reject it. That's not the same as proving it true: it may just mean the sample was too small to tell.

The logic resembles a criminal trial. H₀ is "innocent", the data are the evidence, and α is the standard of proof. A not-guilty verdict means the evidence wasn't strong enough, not that innocence was proven.

Hypothesis Testing Steps and Formulas

The five-step procedure as taught in OpenStax Introductory Statistics, chapter 9. See Sources.

1. State the hypotheses and α

H₀: μ = μ₀ · H₁: μ ≠, > or < μ₀ · α = 0.05 (or your choice)

2. Calculate the test statistic

Mean, σ unknown: t = (x̄ − μ₀) ÷ (s ÷ √n), df = n − 1
Mean, σ known: z = (x̄ − μ₀) ÷ (σ ÷ √n)
Proportion: z = (p̂ − p₀) ÷ √(p₀(1 − p₀) ÷ n)

3. Find p, decide and conclude

p < α → reject H₀ · p ≥ α → do not reject H₀

Always finish with a sentence about the real question, not just the symbols.

Worked Example: Are Cereal Boxes Underfilled?

Given:
Boxes claim 500 g. A sample of 40 averages 497.8 g with SD 6.2 g. Is the average fill below 500 g?
Step 1:
Hypotheses:
H₀: μ = 500 · H₁: μ < 500 · α = 0.05
Step 2:
Test statistic:
t = (497.8 − 500) ÷ (6.2 ÷ √40) = −2.2 ÷ 0.980 = −2.244, df 39
Step 3:
p-value and decision:
left-tailed p = 0.0153 < 0.05 → reject H₀
Result:
Reject H₀ at the 5% level

There's evidence the average box holds less than 500 g. The shortfall is small, about 2 g, which is a separate question from whether it's real.

Type I and Type II Errors

Every decision can be wrong in one of two ways.

The four possible outcomes of a hypothesis test
DecisionH₀ actually trueH₀ actually false
Reject H₀Type I error (false alarm), chance αCorrect, chance = power
Don't reject H₀Correct, chance 1 − αType II error (missed effect), chance β

Common Hypothesis Testing Mistakes

  • Saying "accept H₀". Failing to reject isn't proof. A small sample can miss a real effect.
  • Choosing the alternative after seeing the data. Decide on ≠, > or < before you look, or the p-value is wrong.
  • Putting the claim you hope for in H₀. H₀ is the default or status quo; the claim you want evidence for goes in H₁.
  • Stopping at the verdict. Report the size of the effect and its uncertainty too. A significant 2 g shortfall and a significant 50 g one are very different findings.

Hypothesis Testing FAQs

What is the null hypothesis?

The default claim being tested, usually “no difference” or “the stated value is right”. It always contains the equals sign.

How do I choose α?

0.05 is the common default. Use a smaller α, such as 0.01, when a false alarm would be costly.

Which test does this calculator use?

A one-sample t-test for a mean with unknown σ, a z-test for a mean with known σ, and a one-proportion z-test for proportions.

What if I have two groups to compare?

Use the t-test calculator for two means, or the A/B test calculator for two proportions.

What is power?

The chance a test detects a real effect of a given size. It rises with sample size and effect size; the power analysis calculator works it out.

Is “not significant” the same as “no effect”?

No. It means the data are compatible with no effect, which can happen when the effect is real but the sample is too small to show it.

Can I test at α = 0.10?

Yes, enter it. Some exploratory studies use 0.10, but the chance of a false alarm doubles compared with 0.05.

Why does the conclusion sentence matter?

Because a reader wants to know about cereal boxes, not μ. Translating the decision back into the real question is the point of the test.

Sources

Related Tools