Statistics Concepts
Null and Alternative Hypothesis: How to Write Them
The null hypothesis (H0) is the default claim of no effect or no difference, and it always contains an equality. The alternative hypothesis (H1 or Ha) is what you are trying to show, and it contains ≠, < or >. A test assumes H0 is true and asks how surprising the sample would be; if the p-value is below α you reject H0 in favour of H1, and otherwise you fail to reject it.
Templates for the common tests
| Situation | Null hypothesis H0 | Alternative hypothesis H1 (two-sided) |
|---|---|---|
| One mean against a value | μ = μ₀ | μ ≠ μ₀ |
| Two independent means | μ₁ = μ₂ (μ₁ − μ₂ = 0) | μ₁ ≠ μ₂ |
| Paired measurements | μ_d = 0, the mean difference is zero | μ_d ≠ 0 |
| One proportion | p = p₀ | p ≠ p₀ |
| Two proportions | p₁ = p₂ | p₁ ≠ p₂ |
| Correlation | ρ = 0 | ρ ≠ 0 |
| Two categorical variables | The variables are independent | The variables are associated |
| Three or more means (ANOVA) | μ₁ = μ₂ = … = μ_k | At least one mean differs |
For a directional question replace ≠ with > or <: the alternative μ > μ₀ gives a right-tailed test and μ < μ₀ a left-tailed one. Read one-tailed vs two-tailed tests before deciding.
Worked example 1: a mean
A test is designed so that scores have a mean of 100 and a known standard deviation of 15. A class of 36 students has a mean of 104. Is the class different from the design value?
H0: μ = 100 H1: μ ≠ 100 α = 0.05
z = (104 − 100) / (15 / √36) = 4 / 2.5 = 1.60
two-tailed p-value = 0.1096
Because 0.1096 is above 0.05, we fail to reject H0: the data do not give enough evidence that the class differs from 100. We have not shown that the class mean is 100; a mean of 104 from only 36 students is simply not extreme enough to rule out chance. Check it in the z-test calculator.
Worked example 2: a proportion
A poll of 200 voters finds 56% in favour of a proposal. Is support different from an even split?
H0: p = 0.5 H1: p ≠ 0.5 α = 0.05
z = (0.56 − 0.5) / √(0.5 × 0.5 / 200) = 1.697
two-tailed p-value = 0.0897
Again p is above 0.05, so we fail to reject H0. The sample proportion of 0.56 is what the poll observed, but the hypotheses are written about the true proportion p. The one-proportion z-test calculator gives the same result.
Decisions and errors
| H0 is true | H0 is false | |
|---|---|---|
| Reject H0 | Type I error (false positive), probability α | Correct decision, probability = power |
| Fail to reject H0 | Correct decision | Type II error (false negative), probability β |
More in type 1 and type 2 errors, statistical power and the full procedure in hypothesis testing.
Mistakes to avoid
- Putting the claim you want to prove in H0. The burden of proof falls on the alternative. If you hope to show a drug works, H0 is that it does not.
- Writing hypotheses with sample statistics. Use μ, p and ρ, not x̄ and p̂.
- Choosing the direction after seeing the data. This turns a 5% test into something closer to a 10% test.
- Concluding that H0 is true. Say instead that there is not enough evidence to reject it, and report a confidence interval; see the p-value explained.
Try the Z-Test Calculator
Test a mean against a value with a known standard deviation and see z and the p-value.
Try the One-Proportion Z-Test
Test a sample proportion against a hypothesised value, one- or two-sided.
Frequently Asked Questions
Why do we say fail to reject the null hypothesis instead of accept it?
Because a test can only show that the data are inconsistent with the null hypothesis, not that the null is true. A non-significant result may just mean the sample was too small to see an effect. The honest wording is that there is not enough evidence to reject H0, and a confidence interval shows which effect sizes remain plausible.
Which statement goes in the null hypothesis?
The one that represents no effect, no difference or the status quo, and that contains an equality (=, ≤ or ≥). The claim you hope to support goes in the alternative. A drug is tested against the null that it does nothing, not against the null that it works.
Do the hypotheses describe the sample or the population?
The population. Hypotheses are written with population parameters such as μ, p, σ or ρ, never with sample statistics such as x̄ or p̂. The sample statistic is the evidence, and the hypothesis is the claim about the parameter it is used to judge.
What is the difference between a research hypothesis and a statistical hypothesis?
A research hypothesis is a scientific claim in plain language, for example that a new teaching method improves scores. The statistical hypotheses turn it into precise statements about a parameter: H0: μ_new − μ_old = 0 and H1: μ_new − μ_old > 0. The test evaluates the statistical pair, not the research idea directly.
Can the alternative hypothesis be tested with a one-sided test?
Yes, when the alternative names a direction (greater than or less than) and the direction was chosen before the data were seen. A non-directional alternative (not equal to) needs a two-tailed test. The choice changes the p-value, as the one-tailed vs two-tailed guide shows.
What p-value leads to rejecting the null hypothesis?
Reject H0 when the p-value is smaller than the significance level α you chose in advance, most often 0.05. The p-value 0.1096 in the first worked example is above 0.05 and does not lead to rejection, while a p-value of 0.03 would. Fixing α beforehand keeps the decision rule honest.