MATH 1401 · Section 9.1 · Basic Principles of Hypothesis Testing

Basic Principles of Hypothesis Testing

Section 9.1
Case Study

The Continue Button

In the mid 2000s, a major e-commerce retailer required customers to create an account before completing a purchase.

This created a problem:

40% of repeat customers couldn't remember their password
75% of customers who reset their password abandoned their purchase

The company was losing sales because customers couldn't get past the login screen.

An older man at a kitchen table holds up a payment card and frowns at his laptop.
Case Study

The Continue Button

They 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 Study

The Continue Button

A $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?

Key Question

How large does an observed difference need to be before we can conclude it's not due to chance?

Hypothesis testing answers this question.

Null and Alternate Hypotheses

Every hypothesis test begins with two competing statements about a population parameter.

The null hypothesis, denoted H0, states that a parameter is equal to a specific value. It represents "no effect" or "no difference."

The alternate hypothesis, denoted H1, states that the parameter differs from the value specified in the null hypothesis.

Three Kinds of Alternate 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.

Example

Formulating Hypotheses

A manufacturer claims their smartphone battery lasts 8 hours of continuous use. Consumer advocates suspect it's actually less.

Six identical smartphones lie face up in a row on a test bench, each plugged into its own charging cable.
Solution
H0:μ=8H1:μ<8

This is a left-tailed test.

Example

Formulating Hypotheses

A restaurant lists a salad as containing 450 calories. A nutrition researcher suspects that the actual average calorie count is higher.

Solution
H0:μ=450H1:μ>450

This is a right-tailed test.

A plated garden salad of lettuce, cucumber, cherry tomatoes, shredded carrot and radish on a restaurant table.
Example

Formulating Hypotheses

An airline reports that flights depart an average of 12 minutes late. After an overhaul, the operations team wants to determine whether it has changed.

Solution
H0:μ=12H1:μ≠12

This is a two-tailed test.

Four travelers wait in a row of seats at an airport gate, one reading a book, while a plane sits outside the window.
Check your understanding

State the Hypotheses

For 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.

H0:μ=16H1:μ<16Left-tailed

(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.

H0:μ=28H1:μ≠28Two-tailed

(c)A tire maker says its tires last 60,000 miles on average. Its engineers believe a new tread design lasts longer.

H0:μ=60,000H1:μ>60,000Right-tailed

The Logic of Hypothesis Testing

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 H0 were true, how likely would we be to observe data like this?"

A gavel rests on its block on a polished courtroom bench, with the scales of justice beside it.

The Logic of Hypothesis Testing

1

Assume H0 is true

2

Collect data

Gather evidence from a sample

3

Assess the evidence

How unusual is our result?

4

Make a decision

Reject H0 or fail to reject H0

Example

Is the Sample Mean Plausible?

Suppose 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.

How Unusual Is Unusual?

The farther the sample statistic is from the value specified by H0, the less likely the difference is due to chance.

Key Question

How big should the difference be before we reject H0?

Distance from the claimed value in H0
Size of the sample
Amount of spread in the distribution

The method of hypothesis testing accounts for all three.

Distance from the Claimed Value

Curve: where sample means would fall if μ=80Shaded: more than 2 standard errors from 80 (unusual)

What we'll do: drag x¯ from 78 down to 60.

What to look for: when x¯ moves into the shaded region, the verdict changes to unusual.

Try it

Drag x¯ down to 60.

The farther x¯ is from the claimed value, the harder it is to believe H0.

  • At 60, x¯ is ten standard errors from 80: unusual.

Size of the Sample

Curve: where sample means would fall if μ=80Shaded: more than 2 standard errors from 80 (unusual)

What we'll do: keep x¯ at 78 and raise the sample size, n, from 25 to 200.

What to look for: how the curve and the verdict change.

Try it

Drag n up to 200.

A larger sample makes the same distance more unusual.

  • With n=200, 78 is almost three standard errors from 80: unusual.

Amount of Spread

Curve: where sample means would fall if μ=80Shaded: more than 2 standard errors from 80 (unusual)

What we'll do: keep x¯ at 78 and n at 200, and raise σ from 10 to 20.

What to look for: how the curve and the verdict change.

Try it

Drag σ up to 20.

More spread makes the same distance less unusual.

  • With σ=20, 78 is less than one and a half standard errors from 80: plausible again.

Distance, sample size, and spread: all three matter.

Stating Conclusions

There are only two possible outcomes of a hypothesis test:

If we reject H0:

We conclude that there is enough evidence to support H1.

If we do not reject H0:

We conclude that there is not enough evidence to support H1. This does not mean H0 is true, only that we could not rule it out. That is, H0 might be true.

An Important Distinction

We never "accept" the null hypothesis. We either reject it or fail to reject it.

Failing to reject H0 means the evidence was not strong enough to conclude H1. It doesn't prove that H0 is true.

Similarly, in a trial, a jury delivers "guilty" or "not guilty," never "guilty" or "innocent."

A wooden gavel resting on its sound block.
Example

Stating Conclusions

A manufacturer claims their smartphone battery lasts 8 hours of continuous use. Consumer advocates suspect it's actually less.

H0:μ=8H1:μ<8

If we reject H0: There is sufficient evidence to believe the mean battery life is less than 8 hours.

If we do not reject H0: There is not sufficient evidence to believe the mean battery life is less than 8 hours.

Check your understanding

State the Conclusion

A 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 H0:μ=10 versus H1:μ>10.

(a)Suppose H0 is rejected. State the conclusion in words.

There is sufficient evidence to believe the mean wait time is greater than 10 minutes.

(b)Suppose H0 is not rejected. State the conclusion in words.

There is not sufficient evidence to believe the mean wait time is greater than 10 minutes.

Type I and Type II Errors

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 H0 when H0 is actually true.

We conclude something has changed when it really has not.

Type II Error

False Negative

We fail to reject H0 when H0 is actually false.

We miss detecting a change when it has really happened.

One wall panel with two labeled symbols: an exclamation mark in a magnifying glass labeled False alarm, and a crosshair labeled Missed detection.

Type I and Type II Errors

H0 is TrueH0 is False
Reject H0
Type I Error
Correct Decision
Do Not Reject H0
Correct Decision
Type II Error
Example

Types of Errors

A business school dean wants to determine whether the mean starting salary of graduates is greater than $50,000. She tests:

H0:μ=$50,000H1:μ>$50,000

For each case, decide: Type I error, Type II error, or correct decision.

A smiling graduate in cap and gown shakes hands across a desk with a woman in a blazer, in an office lined with books.
Example

Types of Errors

Case 1: The true mean is μ=$50,000, and the dean rejects H0.

H0 is true but rejected: Type I error

Case 2: The true mean is μ=$55,000, and the dean rejects H0.

H0 is false and rejected: Correct decision

Case 3: The true mean is μ=$55,000, and the dean does not reject H0.

H0 is false but not rejected: Type II error

Recall

H0:μ=$50,000

H1:μ>$50,000

Example

Types of Errors

An email spam filter calculates a spam score for each incoming email:

H0:S=0 (the email is legitimate)

H1:S>0 (the email is spam)

A hand rests on a laptop's touchpad; the screen shows an inbox list with a few of the messages flagged.
Email Is LegitimateEmail Is Spam
Mark as spam
Type I Error
Correct Decision
Deliver to inbox
Correct Decision
Type II Error

Significance Level of a Test

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: α=0.05 or α=0.01

A smaller α makes it harder to reject H0, reducing Type I errors but increasing the risk of Type II errors.

A smoke detector on a ceiling, with a thin wisp of smoke drifting below it.

A less sensitive smoke detector: fewer false alarms, more missed fires.

You Are Ready For:

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 H0, then ask how unusual the data would be

State a conclusion in words, whether or not H0 is rejected

Tell a Type I error from a Type II error, and say what the significance level controls

1 / 29 → ← advance · Z zoom · B blank · H hides this bar