STAT 200 · Statistics for Economics
The Logic of Hypothesis Testing
Hypothesis testing asks whether a result is too surprising to blame on luck alone, and this lesson shows the steps.
Key takeaways
- A hypothesis test starts by assuming nothing special is going on, then checks whether the data make that assumption hard to believe.
- The null hypothesis is the "nothing changed" claim. The alternative hypothesis is the claim you suspect might be true.
- A test statistic turns your result into a standard unit, so you can ask how many standard errors it sits from the null value.
- You either reject the null or fail to reject it. Failing to reject is not the same as proving the null true.
- The significance level, often 5%, is the amount of false alarm risk you accept before you look at the data.
Picture Priya, who runs a bakery called Rise and Shine. For years she has sold about 200 muffins a day. Last month she hung a bright new sign over the door. Over the next 36 days she sold an average of 210 muffins. Ten more muffins a day! Was it the sign?
Maybe. But some days are busy and some are slow, even with no sign at all. Maybe those 36 days just happened to be good ones. Priya has a real puzzle: how do you tell a true change from plain luck?
Hypothesis testing is the standard answer. It is a way of asking, "If nothing had really changed, how strange would my result be?" If the answer is "very strange," you start to doubt that nothing changed. This lesson builds that logic from scratch. Later lessons use it with real tools, like t tests.
Start with a doubter
Think about a courtroom. The rule is "innocent until proven guilty." The jury does not start by asking whether the defendant did it. It starts by assuming the defendant did not, then asks whether the evidence is strong enough to overturn that assumption.
Hypothesis testing works the same way. You give the boring explanation the first turn. In Priya's case the boring explanation is "the sign did nothing, and the average is still 200." You then look at your evidence, the 36 days, and ask whether the boring explanation can survive it.
Why start this way? Because "luck" is something we can measure. If we assume the true average is exactly 200, we can use what we know about sample averages to say how far a typical 36-day average strays from 200. We cannot do that math for a vague claim like "the sign helped somewhat."
The two share one logic: assume the boring story, then test it against evidence.
Notice the verdict wording. A jury says "not guilty," not "innocent." That is on purpose. Lack of proof of guilt is not proof of innocence. We will see the same gap in statistics.
The two hypotheses
Every test names two competing claims.
The null hypothesis, written H₀, is the boring claim: no effect, no difference, no change. For Priya, H₀ says the true average daily sales are still 200.
The alternative hypothesis, written H₁, is the claim you are looking for evidence of. For Priya, H₁ says the true average is not 200.
Here we used "not 200," which lets the average be higher or lower. That is a two-sided test. If Priya had good reason to care only about increases, she could write "greater than 200," a one-sided test. Pick the form before you see the data. Choosing it afterward, to make the result look better, is a quiet way of cheating.
One more rule: the null always contains the equals sign. It names one exact value (200), because we need a single number to build the "what luck looks like" picture around.
Measuring surprise
Priya's sample average was 210, which is 10 above 200. Is 10 a lot? It depends on how much sample averages normally bounce around.
Suppose, from years of records, that daily muffin sales have a standard deviation of 30. (Real owners rarely know this exactly. We pretend they do for now, and the next lesson fixes it.) Then the standard error of an average of 36 days is:
standard error = standard deviation ÷ √n
= 30 ÷ √36
= 30 ÷ 6
= 5 muffins The standard error is the typical distance between a sample average and the true average. So Priya's 10-muffin gap is two standard errors. We write that as a test statistic, here called z:
z = (sample average − null value) ÷ standard error
= (210 − 200) ÷ 5
= 2 A z of 2 means "two standard errors above what the null predicted." This is the same idea as the z-scores you met earlier, only now we apply it to a sample average instead of a single day.
Nearly every test statistic has this shape: a gap, divided by the amount of noise.
How surprising is z = 2?
If the null is true, sample averages follow a bell curve centered on 200, and z measures where Priya's average falls on that curve. Most of the curve sits within 2 standard errors of the center. About 95% of it, in fact. So a z of 2 is out in the thin edges, but not impossibly far.
The picture below shows the bell curve of z when the null is true. The shaded tail is the part at z = 2 and beyond.
The axis is relabeled so the center, 5, stands for z = 0. A mark at 7 stands for z = +2.
Drawing the line: the significance level
How far into the tail is "too far"? Before collecting data, you pick a cutoff called the significance level, written α (the Greek letter alpha). The usual choice is 5%, or 0.05.
Here is what α means. Suppose the null is actually true and you run the test over and over. An α of 5% means you accept being fooled, and wrongly shouting "something changed!", in about 5 of every 100 tests. It is the false alarm rate you tolerate.
For a two-sided test at α = 5%, the cutoffs are z = −1.96 and z = +1.96. Those are the points that leave 2.5% in each tail. If your z falls beyond either one, you reject the null. If not, you fail to reject it.
Worked example: Priya decides
Walk through all the steps for the bakery.
- State the hypotheses. H₀: the true average is 200. H₁: the true average is not 200.
- Choose α. Use 0.05, decided before looking at the 36 days.
- Compute the test statistic. From above, z = (210 − 200) ÷ 5 = 2.
- Compare to the cutoff. The two-sided cutoff is 1.96. Since 2 is bigger than 1.96, z lands in the rejection zone.
- Conclude. Reject H₀. The data are too surprising to blame on luck alone at the 5% level.
Notice how close the call was: 2 versus 1.96. Had Priya's average been 209.5, then z = 1.9, and she would have failed to reject. Half a muffin changed the verdict. That is a reminder that the 5% line is a convention, not a law of nature.
Steps one and two happen before you look at the data.
Why not just pick a tougher α?
You might ask: if false alarms are bad, why not use α = 1% and be safer? You can. The cutoff for a two-sided test at 1% is about 2.58 instead of 1.96. Priya's z of 2 would then fall short, and she would fail to reject.
But a tougher cutoff has a price. The harder you make it to cry "change!", the more real changes you will miss. It is like turning down a smoke alarm so it never goes off while you toast bread. No more false alarms, but also a weaker warning if there is a real fire. Statisticians balance the two risks, and the lesson on errors and power spells out the trade.
Different fields use different lines. A medical trial may demand 1% or less, since a false alarm could put a useless drug on the market. A quick marketing check might accept 10%, because a wrong guess costs little. Economists often report results at 1%, 5% and 10% so readers can judge for themselves.
A common mistake: "fail to reject" means "the null is true"
Suppose Priya's average had been 204 instead. Then z = (204 − 200) ÷ 5 = 0.8, well inside the cutoffs. She would fail to reject H₀. A tempting headline: "The sign did nothing!"
That does not follow. A small sample can miss a real but modest effect, just as a jury can miss a guilty person because the evidence was thin. The correct statement is: "These 36 days did not give strong enough evidence of a change." The sign might still help a little. We would need more data to know. Later, the lesson on power shows how sample size controls your ability to detect real effects.
A second slip is to treat rejection as proof. Rejecting H₀ at 5% does not mean the sign surely worked. About 1 time in 20, a true null gets rejected by pure bad luck. Also, the test says the average moved. It does not say why. Maybe a street fair started the same week. Statistics can flag a surprise. Explaining it takes more thinking.
Words to know
Null hypothesis (H₀) the boring claim of no effect or no change, which the test assumes true until the data object.
Alternative hypothesis (H₁) the claim you hope to find evidence for, such as "the average is different from the null value."
Test statistic a number, like z, that says how far your sample result is from the null value in standard units.
Significance level (α) the false alarm rate you accept, often 5%, chosen before seeing the data.
Reject the null to conclude the data are too surprising to blame on chance if the null were true.
Fail to reject to conclude the data are not surprising enough to doubt the null, which is not proof the null is true.
Two-sided test a test where the alternative allows a difference in either direction.
Check yourself
- In your own words, why does a test begin by assuming the null hypothesis is true?
- A shop's average daily sales have been 80 with a standard deviation of 12. A sample of 36 days after a price cut averages 84. Find the standard error and z.
- At α = 5% with a two-sided test, would the shop in question 2 reject the null? Use the cutoff 1.96.
- What does α = 5% mean in plain words?
- A test fails to reject H₀. Why is it wrong to say "the null is proven true"?
- Explain why you should choose between a one-sided and two-sided test before looking at the data.
Show the answers
- The null gives one exact value, so we can calculate how much luck alone would make results wobble; a vague claim cannot be calculated, and the "innocent until proven guilty" habit keeps the burden of proof on the new claim.
- The standard error is 12 ÷ √36 = 12 ÷ 6 = 2, and z = (84 − 80) ÷ 2 = 2.
- Yes: z = 2 is larger than 1.96, so it falls in the rejection zone and the null is rejected, though only barely.
- If the null were really true, you would raise a false alarm in about 5 of every 100 tests; it is the false alarm risk you agree to accept.
- The sample may be too small or too noisy to catch a real effect, so the honest conclusion is only "not enough evidence," the same as a "not guilty" verdict.
- Choosing afterward lets you pick whichever form gives the more impressive result, which inflates false alarms and makes the stated 5% level untrue.