Case StudyIn the mid 2000s, a major e-commerce retailer required customers to create an account before completing a purchase.
This created a problem:
The company was losing sales because customers couldn't get past the login screen.

Case StudyThey made a simple change: replacing the "Register" button with a message:
You do not need to create an account to make purchases on our site. Simply click Continue to proceed to checkout.
In the week after the change, sales increased dramatically:
$6M
Case StudyA $6 million increase sounds like a lot, but some weeks are better than others, even when nothing changes. How do we know if a $6 million increase reflects a real improvement, or just a good week?
How large does an observed difference need to be before we can conclude it's not due to chance?
Hypothesis testing answers this question.
Every hypothesis test begins with two competing statements about a population parameter.
The null hypothesis, denoted , states that a parameter is equal to a specific value. It represents "no effect" or "no difference."
The alternate hypothesis, denoted , states that the parameter differs from the value specified in the null hypothesis.
Left-tailed: The parameter is less than the null hypothesis value.
Right-tailed: The parameter is greater than the null hypothesis value.
Two-tailed: The parameter is not equal to the null hypothesis value.
ExampleA manufacturer claims their smartphone battery lasts 8 hours of continuous use. Consumer advocates suspect it's actually less.

This is a left-tailed test.
ExampleA restaurant lists a salad as containing 450 calories. A nutrition researcher suspects that the actual average calorie count is higher.
This is a right-tailed test.

ExampleAn airline reports that flights depart an average of 12 minutes late. After an overhaul, the operations team wants to determine whether it has changed.
This is a two-tailed test.

Check your understandingFor each situation, state the null and alternate hypotheses, and say whether the test is left-tailed, right-tailed, or two-tailed.
(a)A coffee shop claims its medium latte contains 16 ounces on average. A customer suspects it's less.
(b)Last year, the mean commute for a company's employees was 28 minutes. After a new flexible schedule, the HR director wants to know whether it has changed.
(c)A tire maker says its tires last 60,000 miles on average. Its engineers believe a new tread design lasts longer.
The reasoning behind hypothesis testing is similar to a criminal trial.
In a trial, the defendant is assumed innocent until proven guilty. The prosecution must present evidence strong enough to overcome this presumption.
In hypothesis testing, we assume the null hypothesis is true until the evidence suggests otherwise.
We ask: "If were true, how likely would we be to observe data like this?"

Assume is true
Collect data
Gather evidence from a sample
Assess the evidence
How unusual is our result?
Make a decision
Reject or fail to reject
ExampleSuppose an instructor claims the mean score on an exam is 80.
If a sample of students has a mean of 78, this is close to 80. It's plausible that the population mean really is 80.
If a sample of students has a mean of 50, this is far from 80. It's hard to believe the population mean is actually 80 when the sample mean is that far away.
The farther the sample statistic is from the value specified by , the less likely the difference is due to chance.
How big should the difference be before we reject ?
The method of hypothesis testing accounts for all three.
What we'll do: drag from 78 down to 60.
What to look for: when moves into the shaded region, the verdict changes to unusual.
Drag down to 60.
The farther is from the claimed value, the harder it is to believe .
What we'll do: keep at 78 and raise the sample size, , from 25 to 200.
What to look for: how the curve and the verdict change.
Drag up to 200.
A larger sample makes the same distance more unusual.
What we'll do: keep at 78 and at 200, and raise from 10 to 20.
What to look for: how the curve and the verdict change.
Drag up to 20.
More spread makes the same distance less unusual.
Distance, sample size, and spread: all three matter.
There are only two possible outcomes of a hypothesis test:
If we reject :
We conclude that there is enough evidence to support .
If we do not reject :
We conclude that there is not enough evidence to support . This does not mean is true, only that we could not rule it out. That is, might be true.
We never "accept" the null hypothesis. We either reject it or fail to reject it.
Failing to reject means the evidence was not strong enough to conclude . It doesn't prove that is true.
Similarly, in a trial, a jury delivers "guilty" or "not guilty," never "guilty" or "innocent."

ExampleA manufacturer claims their smartphone battery lasts 8 hours of continuous use. Consumer advocates suspect it's actually less.
If we reject : There is sufficient evidence to believe the mean battery life is less than 8 hours.
If we do not reject : There is not sufficient evidence to believe the mean battery life is less than 8 hours.
Check your understandingA transit agency claims that the mean wait for a bus on a certain route is 10 minutes. Regular riders suspect the mean is longer, and test versus .
(a)Suppose is rejected. State the conclusion in words.
(b)Suppose is not rejected. State the conclusion in words.
When we conduct a hypothesis test, we might make the wrong decision. There are two ways this can happen.
Type I Error
False Positive
We reject when is actually true.
We conclude something has changed when it really has not.
Type II Error
False Negative
We fail to reject when is actually false.
We miss detecting a change when it has really happened.

| is True | is False | |
|---|---|---|
| Reject | Type I Error | Correct Decision |
| Do Not Reject | Correct Decision | Type II Error |
ExampleA business school dean wants to determine whether the mean starting salary of graduates is greater than $50,000. She tests:
For each case, decide: Type I error, Type II error, or correct decision.

ExampleCase 1: The true mean is , and the dean rejects .
is true but rejected: Type I error
Case 2: The true mean is , and the dean rejects .
is false and rejected: Correct decision
Case 3: The true mean is , and the dean does not reject .
is false but not rejected: Type II error
ExampleAn email spam filter calculates a spam score for each incoming email:
(the email is legitimate)
(the email is spam)

| Email Is Legitimate | Email Is Spam | |
|---|---|---|
| Mark as spam | Type I Error | Correct Decision |
| Deliver to inbox | Correct Decision | Type II Error |
Type I errors are generally considered more serious because we are making a false claim.
Hypothesis tests are designed so that the maximum probability of a Type I error is small.
This value is called the significance level, denoted .
Common choices: or
A smaller makes it harder to reject , reducing Type I errors but increasing the risk of Type II errors.

A less sensitive smoke detector: fewer false alarms, more missed fires.
9.1: Basic Principles of Hypothesis Testing
State the null and alternate hypotheses, and tell a left-tailed, right-tailed, or two-tailed test apart
Describe the reasoning: assume , then ask how unusual the data would be
State a conclusion in words, whether or not is rejected
Tell a Type I error from a Type II error, and say what the significance level controls