A hypothesis test is a piece of arithmetic wrapped around two sentences, and the arithmetic is entirely obedient to the sentences. Get them wrong and everything downstream — the standard error, the shaded region, the p‑value, the conclusion in the final paragraph — is computed flawlessly about the wrong question. So this section is not about a formula. It is about three decisions: which population parameter the claim is about, what number the null hypothesis names, and which direction the alternative points. Below, six real claims are waiting. Write the hypotheses for each one, and watch the null distribution slide, the shaded tail flip sides, and the p‑value recompute the instant you change your mind. Then, at the bottom, see what it costs when someone looks at the data first and decides the direction afterward.
If your null hypothesis were true
The solid curve is the sampling distribution of your statistic in the world H0 describes — it is centred on the number H0 names, and nowhere else. The shaded region is exactly the region Ha tells you to count. Move the null slider and the curve slides with it; change the direction and the shading jumps tails.
if H0 were truewhere the data actually comes fromyour observed statisticthe region Ha counts — the p‑value5% cutoff
One sample, three possible alternatives
The data below is identical in all three panels — same sample, same mean, same standard error. Only the sentence changes. Three different p‑values come out, which is the whole reason Ha must be written down before the data is collected rather than after. Tap a panel to adopt that alternative.
What it costs to decide the direction after you look
Every study below is run in a world where H0 is exactly true, so every single rejection is a false alarm. Three researchers see the same studies. Two of them wrote their alternative down in advance. The third waits to see which way the sample leaned and then writes the one‑sided alternative that points that way — which feels harmless, and doubles his false‑alarm rate forever. All three use the usual 5% cutoff.
Six claimspick one and write its hypotheses
The claim on the table
Write the two sentences
H0—the null — always the equality, always the boring world
Ha—the alternative — the thing that needs evidence
1 · What are the hypotheses about?
2 · What number does H0 name?
—
3 · Which way does Ha point?
Your sample
The sample is genuinely drawn, one observation at a time, from the world set by the purple slider. That slider is the truth — visible here only because this is a simulation, and never the source of the number in H0.
—
—
Your statistic—
Std. error under H0—
Test statistic z—
p‑value from Ha—
How to write them every time
Ask three questions in this order and the sentences write themselves. (1) What population number is the claim about? A mean μ, a proportion p, a difference between two of them — always a parameter, always a fact about a population you cannot see. Never x̄, never p̂. (2) What would be true if nothing interesting were going on? That is H0: the machine is on target, the drug does nothing, the rate still matches the contract. It always carries the equality, because it has to name one specific number for the arithmetic to stand on. (3) What would you need evidence in order to believe? That is Ha. Notice that the burden of proof sits on Ha, exactly as it sits on the prosecution: H0 is presumed until the data makes it look ridiculous, and a verdict of “not guilty” is never a finding of innocence.
Five ways to state hypotheses wrongly.(1) Writing them about the statistic. H0: x̄ = 72 is not a hypothesis — you already know x̄, you computed it, there is nothing left to be uncertain about. Everything you are testing lives in the population, which is precisely why you had to take a sample in the first place. (2) Taking the null value from your own data. The number in H0 comes from the claim, the contract, the historical record, or the target setting — from outside the sample. Slide the null value onto your own statistic above and watch z fall to 0 and the p‑value climb to the largest value it can take — exactly 1 for a two‑sided alternative, exactly 0.5 for a one‑sided one. You have asked whether your data disagrees with itself, and it never does. (3) Choosing the direction after looking. The bottom chart is what that costs. A one‑sided alternative aimed at whichever tail your sample happened to land in is not a one‑sided test at all; it is a two‑sided test reported at half its true error rate. (4) Putting what you hope to show into H0. The test can only ever accumulate evidence against H0, so parking your own claim there means the best possible outcome is failing to reject it — which proves nothing. Whatever you want to demonstrate goes in Ha. (5) Expecting a p‑value to be a probability about the hypotheses. It is not the probability that H0 is true, and 1 − p is not the probability that Ha is true. It is the probability of data at least this extreme given that H0 holds — a statement about data in a hypothetical world, not about which world you are in.
One small notational point that trips people up: for a one‑sided test some books write H0: μ ≥ 72 and others write H0: μ = 72. Both are fine and both mean the same thing in practice, because the arithmetic only ever uses the boundary value — 72 is the hardest case for Ha to beat, so if the data can overcome 72 it can overcome anything above it. What is never fine is an H0 with no equality in it at all, since then there is no single number to centre the curve on.