You are on page 1of 743

7.

Hypothesis Testing

Dave Goldsman
H. Milton Stewart School of Industrial and Systems Engineering
Georgia Institute of Technology

3/2/20

ISYE 6739 — Goldsman 3/2/20 1 / 115


Outline
1 Introduction to Hypothesis Testing
2 The Errors of Our Ways
3 Normal Mean Test with Known Variance
4 Normal Mean Test with Known Variance: Design
5 Two-Sample Normal Means Test with Known Variances
6 Normal Mean Test with Unknown Variance
7 Two-Sample Normal Means Tests with Unknown Variances
8 Two-Sample Normal Means Test with Paired Observations
9 Normal Variance Test
10 Two-Sample Normal Variances Test
11 Bernoulli Proportion Test
12 Two-Sample Bernoulli Proportions Test
13 Goodness-of-Fit Tests: Introduction
14 Goodness-of-Fit Tests: Examples
15 Goodness-of-Fit Tests: Honors Example
ISYE 6739 — Goldsman 3/2/20 2 / 115
Introduction to Hypothesis Testing

Lesson 7.1 — Introduction to Hypothesis Testing

ISYE 6739 — Goldsman 3/2/20 3 / 115


Introduction to Hypothesis Testing

Lesson 7.1 — Introduction to Hypothesis Testing

Goal: In this module, we’ll study a population by collecting data and making
sound, statistically valid conclusions about that population based on data that
we collect.

ISYE 6739 — Goldsman 3/2/20 3 / 115


Introduction to Hypothesis Testing

Lesson 7.1 — Introduction to Hypothesis Testing

Goal: In this module, we’ll study a population by collecting data and making
sound, statistically valid conclusions about that population based on data that
we collect.

General Approach

ISYE 6739 — Goldsman 3/2/20 3 / 115


Introduction to Hypothesis Testing

Lesson 7.1 — Introduction to Hypothesis Testing

Goal: In this module, we’ll study a population by collecting data and making
sound, statistically valid conclusions about that population based on data that
we collect.

General Approach

1. State a hypothesis.

ISYE 6739 — Goldsman 3/2/20 3 / 115


Introduction to Hypothesis Testing

Lesson 7.1 — Introduction to Hypothesis Testing

Goal: In this module, we’ll study a population by collecting data and making
sound, statistically valid conclusions about that population based on data that
we collect.

General Approach

1. State a hypothesis.

2. Select a test statistic (to test whether or not the hypothesis is true).

ISYE 6739 — Goldsman 3/2/20 3 / 115


Introduction to Hypothesis Testing

Lesson 7.1 — Introduction to Hypothesis Testing

Goal: In this module, we’ll study a population by collecting data and making
sound, statistically valid conclusions about that population based on data that
we collect.

General Approach

1. State a hypothesis.

2. Select a test statistic (to test whether or not the hypothesis is true).

3. Evaluate (calculate) the test statistic based on observations that we take.

ISYE 6739 — Goldsman 3/2/20 3 / 115


Introduction to Hypothesis Testing

Lesson 7.1 — Introduction to Hypothesis Testing

Goal: In this module, we’ll study a population by collecting data and making
sound, statistically valid conclusions about that population based on data that
we collect.

General Approach

1. State a hypothesis.

2. Select a test statistic (to test whether or not the hypothesis is true).

3. Evaluate (calculate) the test statistic based on observations that we take.

4. Interpret results — does the test statistic suggest that you reject or fail to
reject your hypothesis?

ISYE 6739 — Goldsman 3/2/20 3 / 115


Introduction to Hypothesis Testing

Lesson 7.1 — Introduction to Hypothesis Testing

Goal: In this module, we’ll study a population by collecting data and making
sound, statistically valid conclusions about that population based on data that
we collect.

General Approach

1. State a hypothesis.

2. Select a test statistic (to test whether or not the hypothesis is true).

3. Evaluate (calculate) the test statistic based on observations that we take.

4. Interpret results — does the test statistic suggest that you reject or fail to
reject your hypothesis?

Details follow. . . .
ISYE 6739 — Goldsman 3/2/20 3 / 115
Introduction to Hypothesis Testing

1. Hypotheses are simply statements or claims about parameter values.

ISYE 6739 — Goldsman 3/2/20 4 / 115


Introduction to Hypothesis Testing

1. Hypotheses are simply statements or claims about parameter values.

You perform a hypothesis test to prove or disprove the claim.

ISYE 6739 — Goldsman 3/2/20 4 / 115


Introduction to Hypothesis Testing

1. Hypotheses are simply statements or claims about parameter values.

You perform a hypothesis test to prove or disprove the claim.

Set up a null hypothesis (H0 )

ISYE 6739 — Goldsman 3/2/20 4 / 115


Introduction to Hypothesis Testing

1. Hypotheses are simply statements or claims about parameter values.

You perform a hypothesis test to prove or disprove the claim.

Set up a null hypothesis (H0 ) and an alternative hypothesis (H1 ) to


cover the entire parameter space.

ISYE 6739 — Goldsman 3/2/20 4 / 115


Introduction to Hypothesis Testing

1. Hypotheses are simply statements or claims about parameter values.

You perform a hypothesis test to prove or disprove the claim.

Set up a null hypothesis (H0 ) and an alternative hypothesis (H1 ) to


cover the entire parameter space. The null hypothesis sort of represents the
“status quo.”

ISYE 6739 — Goldsman 3/2/20 4 / 115


Introduction to Hypothesis Testing

1. Hypotheses are simply statements or claims about parameter values.

You perform a hypothesis test to prove or disprove the claim.

Set up a null hypothesis (H0 ) and an alternative hypothesis (H1 ) to


cover the entire parameter space. The null hypothesis sort of represents the
“status quo.” It’s not necessarily true, but we will grudgingly stick with it
until proven otherwise.

ISYE 6739 — Goldsman 3/2/20 4 / 115


Introduction to Hypothesis Testing

1. Hypotheses are simply statements or claims about parameter values.

You perform a hypothesis test to prove or disprove the claim.

Set up a null hypothesis (H0 ) and an alternative hypothesis (H1 ) to


cover the entire parameter space. The null hypothesis sort of represents the
“status quo.” It’s not necessarily true, but we will grudgingly stick with it
until proven otherwise.

Example: We currently believe that the mean weight of a filled package of


chicken is µ0 ounces. (We specify µ0 .) But we have our suspicions.

ISYE 6739 — Goldsman 3/2/20 4 / 115


Introduction to Hypothesis Testing

1. Hypotheses are simply statements or claims about parameter values.

You perform a hypothesis test to prove or disprove the claim.

Set up a null hypothesis (H0 ) and an alternative hypothesis (H1 ) to


cover the entire parameter space. The null hypothesis sort of represents the
“status quo.” It’s not necessarily true, but we will grudgingly stick with it
until proven otherwise.

Example: We currently believe that the mean weight of a filled package of


chicken is µ0 ounces. (We specify µ0 .) But we have our suspicions.

H0 : µ = µ0

ISYE 6739 — Goldsman 3/2/20 4 / 115


Introduction to Hypothesis Testing

1. Hypotheses are simply statements or claims about parameter values.

You perform a hypothesis test to prove or disprove the claim.

Set up a null hypothesis (H0 ) and an alternative hypothesis (H1 ) to


cover the entire parameter space. The null hypothesis sort of represents the
“status quo.” It’s not necessarily true, but we will grudgingly stick with it
until proven otherwise.

Example: We currently believe that the mean weight of a filled package of


chicken is µ0 ounces. (We specify µ0 .) But we have our suspicions.

H0 : µ = µ0
H1 : µ 6= µ0

ISYE 6739 — Goldsman 3/2/20 4 / 115


Introduction to Hypothesis Testing

1. Hypotheses are simply statements or claims about parameter values.

You perform a hypothesis test to prove or disprove the claim.

Set up a null hypothesis (H0 ) and an alternative hypothesis (H1 ) to


cover the entire parameter space. The null hypothesis sort of represents the
“status quo.” It’s not necessarily true, but we will grudgingly stick with it
until proven otherwise.

Example: We currently believe that the mean weight of a filled package of


chicken is µ0 ounces. (We specify µ0 .) But we have our suspicions.

H0 : µ = µ0
H1 : µ 6= µ0

This is a two-sided test.

ISYE 6739 — Goldsman 3/2/20 4 / 115


Introduction to Hypothesis Testing

1. Hypotheses are simply statements or claims about parameter values.

You perform a hypothesis test to prove or disprove the claim.

Set up a null hypothesis (H0 ) and an alternative hypothesis (H1 ) to


cover the entire parameter space. The null hypothesis sort of represents the
“status quo.” It’s not necessarily true, but we will grudgingly stick with it
until proven otherwise.

Example: We currently believe that the mean weight of a filled package of


chicken is µ0 ounces. (We specify µ0 .) But we have our suspicions.

H0 : µ = µ0
H1 : µ 6= µ0

This is a two-sided test. We will reject the belief of the null hypothesis H0
if µ̂ (an estimator of µ) is “too high” or “too small.”

ISYE 6739 — Goldsman 3/2/20 4 / 115


Introduction to Hypothesis Testing

Example: We hope that a new brand of tires will last for a mean of more
than µ0 miles. (We specify µ0 .)

ISYE 6739 — Goldsman 3/2/20 5 / 115


Introduction to Hypothesis Testing

Example: We hope that a new brand of tires will last for a mean of more
than µ0 miles. (We specify µ0 .) But we really need evidence before we can
state that claim with reasonable certainty.

ISYE 6739 — Goldsman 3/2/20 5 / 115


Introduction to Hypothesis Testing

Example: We hope that a new brand of tires will last for a mean of more
than µ0 miles. (We specify µ0 .) But we really need evidence before we can
state that claim with reasonable certainty. Else, we’ll stay with the old brand.

ISYE 6739 — Goldsman 3/2/20 5 / 115


Introduction to Hypothesis Testing

Example: We hope that a new brand of tires will last for a mean of more
than µ0 miles. (We specify µ0 .) But we really need evidence before we can
state that claim with reasonable certainty. Else, we’ll stay with the old brand.

H0 : µ ≤ µ0

ISYE 6739 — Goldsman 3/2/20 5 / 115


Introduction to Hypothesis Testing

Example: We hope that a new brand of tires will last for a mean of more
than µ0 miles. (We specify µ0 .) But we really need evidence before we can
state that claim with reasonable certainty. Else, we’ll stay with the old brand.

H0 : µ ≤ µ0
H1 : µ > µ0

ISYE 6739 — Goldsman 3/2/20 5 / 115


Introduction to Hypothesis Testing

Example: We hope that a new brand of tires will last for a mean of more
than µ0 miles. (We specify µ0 .) But we really need evidence before we can
state that claim with reasonable certainty. Else, we’ll stay with the old brand.

H0 : µ ≤ µ0
H1 : µ > µ0

This is a one-sided test. We’ll reject H0 only if µ̂ is “too large.”

ISYE 6739 — Goldsman 3/2/20 5 / 115


Introduction to Hypothesis Testing

Example: We hope that a new brand of tires will last for a mean of more
than µ0 miles. (We specify µ0 .) But we really need evidence before we can
state that claim with reasonable certainty. Else, we’ll stay with the old brand.

H0 : µ ≤ µ0
H1 : µ > µ0

This is a one-sided test. We’ll reject H0 only if µ̂ is “too large.”

Example: We test to see if emissions from a certain type of car are less than
a mean of µ0 ppm.

ISYE 6739 — Goldsman 3/2/20 5 / 115


Introduction to Hypothesis Testing

Example: We hope that a new brand of tires will last for a mean of more
than µ0 miles. (We specify µ0 .) But we really need evidence before we can
state that claim with reasonable certainty. Else, we’ll stay with the old brand.

H0 : µ ≤ µ0
H1 : µ > µ0

This is a one-sided test. We’ll reject H0 only if µ̂ is “too large.”

Example: We test to see if emissions from a certain type of car are less than
a mean of µ0 ppm. But we need evidence.

ISYE 6739 — Goldsman 3/2/20 5 / 115


Introduction to Hypothesis Testing

Example: We hope that a new brand of tires will last for a mean of more
than µ0 miles. (We specify µ0 .) But we really need evidence before we can
state that claim with reasonable certainty. Else, we’ll stay with the old brand.

H0 : µ ≤ µ0
H1 : µ > µ0

This is a one-sided test. We’ll reject H0 only if µ̂ is “too large.”

Example: We test to see if emissions from a certain type of car are less than
a mean of µ0 ppm. But we need evidence.

H0 : µ ≥ µ0

ISYE 6739 — Goldsman 3/2/20 5 / 115


Introduction to Hypothesis Testing

Example: We hope that a new brand of tires will last for a mean of more
than µ0 miles. (We specify µ0 .) But we really need evidence before we can
state that claim with reasonable certainty. Else, we’ll stay with the old brand.

H0 : µ ≤ µ0
H1 : µ > µ0

This is a one-sided test. We’ll reject H0 only if µ̂ is “too large.”

Example: We test to see if emissions from a certain type of car are less than
a mean of µ0 ppm. But we need evidence.

H0 : µ ≥ µ0
H1 : µ < µ0

ISYE 6739 — Goldsman 3/2/20 5 / 115


Introduction to Hypothesis Testing

Example: We hope that a new brand of tires will last for a mean of more
than µ0 miles. (We specify µ0 .) But we really need evidence before we can
state that claim with reasonable certainty. Else, we’ll stay with the old brand.

H0 : µ ≤ µ0
H1 : µ > µ0

This is a one-sided test. We’ll reject H0 only if µ̂ is “too large.”

Example: We test to see if emissions from a certain type of car are less than
a mean of µ0 ppm. But we need evidence.

H0 : µ ≥ µ0
H1 : µ < µ0

This is a one-sided test.

ISYE 6739 — Goldsman 3/2/20 5 / 115


Introduction to Hypothesis Testing

Example: We hope that a new brand of tires will last for a mean of more
than µ0 miles. (We specify µ0 .) But we really need evidence before we can
state that claim with reasonable certainty. Else, we’ll stay with the old brand.

H0 : µ ≤ µ0
H1 : µ > µ0

This is a one-sided test. We’ll reject H0 only if µ̂ is “too large.”

Example: We test to see if emissions from a certain type of car are less than
a mean of µ0 ppm. But we need evidence.

H0 : µ ≥ µ0
H1 : µ < µ0

This is a one-sided test. We’ll reject the null hypothesis if µ̂ is “too small,”
and only then will make the claim that the emissions are low.

ISYE 6739 — Goldsman 3/2/20 5 / 115


Introduction to Hypothesis Testing

Idea: H0 is the old, conservative “status quo.”

ISYE 6739 — Goldsman 3/2/20 6 / 115


Introduction to Hypothesis Testing

Idea: H0 is the old, conservative “status quo.” H1 is the new, radical


hypothesis.

ISYE 6739 — Goldsman 3/2/20 6 / 115


Introduction to Hypothesis Testing

Idea: H0 is the old, conservative “status quo.” H1 is the new, radical


hypothesis. Although you may not be tooooo sure about the truth of H0 , you
won’t reject it in favor of H1 unless you see substantial evidence in support of
H1 .

ISYE 6739 — Goldsman 3/2/20 6 / 115


Introduction to Hypothesis Testing

Idea: H0 is the old, conservative “status quo.” H1 is the new, radical


hypothesis. Although you may not be tooooo sure about the truth of H0 , you
won’t reject it in favor of H1 unless you see substantial evidence in support of
H1 .

Think of H0 as “Innocent until proven guilty.”

ISYE 6739 — Goldsman 3/2/20 6 / 115


Introduction to Hypothesis Testing

Idea: H0 is the old, conservative “status quo.” H1 is the new, radical


hypothesis. Although you may not be tooooo sure about the truth of H0 , you
won’t reject it in favor of H1 unless you see substantial evidence in support of
H1 .

Think of H0 as “Innocent until proven guilty.”

If you get substantial evidence supporting H1 , you’ll decide to reject H0 .

ISYE 6739 — Goldsman 3/2/20 6 / 115


Introduction to Hypothesis Testing

Idea: H0 is the old, conservative “status quo.” H1 is the new, radical


hypothesis. Although you may not be tooooo sure about the truth of H0 , you
won’t reject it in favor of H1 unless you see substantial evidence in support of
H1 .

Think of H0 as “Innocent until proven guilty.”

If you get substantial evidence supporting H1 , you’ll decide to reject H0 .


Otherwise, you “fail to reject” H0 .

ISYE 6739 — Goldsman 3/2/20 6 / 115


Introduction to Hypothesis Testing

Idea: H0 is the old, conservative “status quo.” H1 is the new, radical


hypothesis. Although you may not be tooooo sure about the truth of H0 , you
won’t reject it in favor of H1 unless you see substantial evidence in support of
H1 .

Think of H0 as “Innocent until proven guilty.”

If you get substantial evidence supporting H1 , you’ll decide to reject H0 .


Otherwise, you “fail to reject” H0 . (This roughly means that you grudgingly
accept H0 .)

ISYE 6739 — Goldsman 3/2/20 6 / 115


Introduction to Hypothesis Testing

2. Select a test statistic (a random variable that we’ll use to test if H0 is


true).

ISYE 6739 — Goldsman 3/2/20 7 / 115


Introduction to Hypothesis Testing

2. Select a test statistic (a random variable that we’ll use to test if H0 is


true).

For instance, we could compare an estimator µ̂ with µ0 .

ISYE 6739 — Goldsman 3/2/20 7 / 115


Introduction to Hypothesis Testing

2. Select a test statistic (a random variable that we’ll use to test if H0 is


true).

For instance, we could compare an estimator µ̂ with µ0 . The comparison is


accomplished using a known sampling distribution (aka “test statistic”),

ISYE 6739 — Goldsman 3/2/20 7 / 115


Introduction to Hypothesis Testing

2. Select a test statistic (a random variable that we’ll use to test if H0 is


true).

For instance, we could compare an estimator µ̂ with µ0 . The comparison is


accomplished using a known sampling distribution (aka “test statistic”), e.g.,

X̄ − µ0
zobs = √ (if σ 2 is known) or
σ/ n

ISYE 6739 — Goldsman 3/2/20 7 / 115


Introduction to Hypothesis Testing

2. Select a test statistic (a random variable that we’ll use to test if H0 is


true).

For instance, we could compare an estimator µ̂ with µ0 . The comparison is


accomplished using a known sampling distribution (aka “test statistic”), e.g.,

X̄ − µ0
zobs = √ (if σ 2 is known) or
σ/ n

X̄ − µ0
tobs = √ (if σ 2 is unknown).
S/ n

ISYE 6739 — Goldsman 3/2/20 7 / 115


Introduction to Hypothesis Testing

2. Select a test statistic (a random variable that we’ll use to test if H0 is


true).

For instance, we could compare an estimator µ̂ with µ0 . The comparison is


accomplished using a known sampling distribution (aka “test statistic”), e.g.,

X̄ − µ0
zobs = √ (if σ 2 is known) or
σ/ n

X̄ − µ0
tobs = √ (if σ 2 is unknown).
S/ n

Lots more details later.

ISYE 6739 — Goldsman 3/2/20 7 / 115


Introduction to Hypothesis Testing

3. Evaluate the test statistic. Here’s the logic of hypothesis testing:

ISYE 6739 — Goldsman 3/2/20 8 / 115


Introduction to Hypothesis Testing

3. Evaluate the test statistic. Here’s the logic of hypothesis testing:

(a) Collect sample data.

ISYE 6739 — Goldsman 3/2/20 8 / 115


Introduction to Hypothesis Testing

3. Evaluate the test statistic. Here’s the logic of hypothesis testing:

(a) Collect sample data.

(b) Calculate the value of the test statistic based on the data.

ISYE 6739 — Goldsman 3/2/20 8 / 115


Introduction to Hypothesis Testing

3. Evaluate the test statistic. Here’s the logic of hypothesis testing:

(a) Collect sample data.

(b) Calculate the value of the test statistic based on the data.

(c) Assume H0 (the “status quo”) is true.

ISYE 6739 — Goldsman 3/2/20 8 / 115


Introduction to Hypothesis Testing

3. Evaluate the test statistic. Here’s the logic of hypothesis testing:

(a) Collect sample data.

(b) Calculate the value of the test statistic based on the data.

(c) Assume H0 (the “status quo”) is true.

(d) Determine the probability of the sample result, assuming H0 is true.

ISYE 6739 — Goldsman 3/2/20 8 / 115


Introduction to Hypothesis Testing

3. Evaluate the test statistic. Here’s the logic of hypothesis testing:

(a) Collect sample data.

(b) Calculate the value of the test statistic based on the data.

(c) Assume H0 (the “status quo”) is true.

(d) Determine the probability of the sample result, assuming H0 is true.

(e) Decide from (d) if H0 is plausible:

ISYE 6739 — Goldsman 3/2/20 8 / 115


Introduction to Hypothesis Testing

3. Evaluate the test statistic. Here’s the logic of hypothesis testing:

(a) Collect sample data.

(b) Calculate the value of the test statistic based on the data.

(c) Assume H0 (the “status quo”) is true.

(d) Determine the probability of the sample result, assuming H0 is true.

(e) Decide from (d) if H0 is plausible:

– If the probability from (d) is low, reject H0 and select H1 .

ISYE 6739 — Goldsman 3/2/20 8 / 115


Introduction to Hypothesis Testing

3. Evaluate the test statistic. Here’s the logic of hypothesis testing:

(a) Collect sample data.

(b) Calculate the value of the test statistic based on the data.

(c) Assume H0 (the “status quo”) is true.

(d) Determine the probability of the sample result, assuming H0 is true.

(e) Decide from (d) if H0 is plausible:

– If the probability from (d) is low, reject H0 and select H1 .


– If the probability from (d) is high, fail to reject H0 .

ISYE 6739 — Goldsman 3/2/20 8 / 115


Introduction to Hypothesis Testing

Example: Time to metabolize a drug.

ISYE 6739 — Goldsman 3/2/20 9 / 115


Introduction to Hypothesis Testing

Example: Time to metabolize a drug. The current drug takes µ0 = 15 min.

ISYE 6739 — Goldsman 3/2/20 9 / 115


Introduction to Hypothesis Testing

Example: Time to metabolize a drug. The current drug takes µ0 = 15 min.


Is the new drug better?

ISYE 6739 — Goldsman 3/2/20 9 / 115


Introduction to Hypothesis Testing

Example: Time to metabolize a drug. The current drug takes µ0 = 15 min.


Is the new drug better?

Claim: Expected time for new drug is < 15 min.

ISYE 6739 — Goldsman 3/2/20 9 / 115


Introduction to Hypothesis Testing

Example: Time to metabolize a drug. The current drug takes µ0 = 15 min.


Is the new drug better?

Claim: Expected time for new drug is < 15 min.

H0 : µ ≥ 15

ISYE 6739 — Goldsman 3/2/20 9 / 115


Introduction to Hypothesis Testing

Example: Time to metabolize a drug. The current drug takes µ0 = 15 min.


Is the new drug better?

Claim: Expected time for new drug is < 15 min.

H0 : µ ≥ 15
H1 : µ < 15

ISYE 6739 — Goldsman 3/2/20 9 / 115


Introduction to Hypothesis Testing

Example: Time to metabolize a drug. The current drug takes µ0 = 15 min.


Is the new drug better?

Claim: Expected time for new drug is < 15 min.

H0 : µ ≥ 15
H1 : µ < 15

Data: n = 20, X̄ = 14.88, S = 0.333.

ISYE 6739 — Goldsman 3/2/20 9 / 115


Introduction to Hypothesis Testing

Example: Time to metabolize a drug. The current drug takes µ0 = 15 min.


Is the new drug better?

Claim: Expected time for new drug is < 15 min.

H0 : µ ≥ 15
H1 : µ < 15

Data: n = 20, X̄ = 14.88, S = 0.333.

The test statistic is


X̄ − µ0
tobs = √ = −1.61.
S/ n

ISYE 6739 — Goldsman 3/2/20 9 / 115


Introduction to Hypothesis Testing

Now, if H0 is actually the true state of things, then µ = µ0 ,

ISYE 6739 — Goldsman 3/2/20 10 / 115


Introduction to Hypothesis Testing

Now, if H0 is actually the true state of things, then µ = µ0 , and from our
discussion on CI’s, we have

X̄ − µ0
tobs = √ ∼ t(n − 1) ∼ t(19).
S/ n

ISYE 6739 — Goldsman 3/2/20 10 / 115


Introduction to Hypothesis Testing

Now, if H0 is actually the true state of things, then µ = µ0 , and from our
discussion on CI’s, we have

X̄ − µ0
tobs = √ ∼ t(n − 1) ∼ t(19).
S/ n

What would cause us to reject H0 ?

ISYE 6739 — Goldsman 3/2/20 10 / 115


Introduction to Hypothesis Testing

Now, if H0 is actually the true state of things, then µ = µ0 , and from our
discussion on CI’s, we have

X̄ − µ0
tobs = √ ∼ t(n − 1) ∼ t(19).
S/ n

What would cause us to reject H0 ?

If X̄  µ0 (= 15), this would indicate that H0 is probably wrong.

ISYE 6739 — Goldsman 3/2/20 10 / 115


Introduction to Hypothesis Testing

Now, if H0 is actually the true state of things, then µ = µ0 , and from our
discussion on CI’s, we have

X̄ − µ0
tobs = √ ∼ t(n − 1) ∼ t(19).
S/ n

What would cause us to reject H0 ?

If X̄  µ0 (= 15), this would indicate that H0 is probably wrong.

Equivalently, I’d reject H0 if tobs is “significantly”  0.

ISYE 6739 — Goldsman 3/2/20 10 / 115


Introduction to Hypothesis Testing

4. Interpret the Test Statistic.

ISYE 6739 — Goldsman 3/2/20 11 / 115


Introduction to Hypothesis Testing

4. Interpret the Test Statistic.

So if H0 is true, is it reasonable (or, at least, not outrageous) to have gotten


tobs = −1.61?

ISYE 6739 — Goldsman 3/2/20 11 / 115


Introduction to Hypothesis Testing

4. Interpret the Test Statistic.

So if H0 is true, is it reasonable (or, at least, not outrageous) to have gotten


tobs = −1.61?

If yes, then we we’ll fail to reject (“grudgingly accept”) H0 .

ISYE 6739 — Goldsman 3/2/20 11 / 115


Introduction to Hypothesis Testing

4. Interpret the Test Statistic.

So if H0 is true, is it reasonable (or, at least, not outrageous) to have gotten


tobs = −1.61?

If yes, then we we’ll fail to reject (“grudgingly accept”) H0 .

If no, then we’ll reject H0 in favor of H1 .

ISYE 6739 — Goldsman 3/2/20 11 / 115


Introduction to Hypothesis Testing

Let’s see. . . . From the t table, we have

ISYE 6739 — Goldsman 3/2/20 12 / 115


Introduction to Hypothesis Testing

Let’s see. . . . From the t table, we have

t0.95,19 = −t0.05,19 = −1.729

ISYE 6739 — Goldsman 3/2/20 12 / 115


Introduction to Hypothesis Testing

Let’s see. . . . From the t table, we have

t0.95,19 = −t0.05,19 = −1.729 and t0.90,19 = −t0.10,19 = −1.328,

ISYE 6739 — Goldsman 3/2/20 12 / 115


Introduction to Hypothesis Testing

Let’s see. . . . From the t table, we have

t0.95,19 = −t0.05,19 = −1.729 and t0.90,19 = −t0.10,19 = −1.328,

i.e.,
P (t(19) < −1.729) = 0.05 and

ISYE 6739 — Goldsman 3/2/20 12 / 115


Introduction to Hypothesis Testing

Let’s see. . . . From the t table, we have

t0.95,19 = −t0.05,19 = −1.729 and t0.90,19 = −t0.10,19 = −1.328,

i.e.,
P (t(19) < −1.729) = 0.05 and

P (t(19) < −1.328) = 0.10.

ISYE 6739 — Goldsman 3/2/20 12 / 115


Introduction to Hypothesis Testing

Let’s see. . . . From the t table, we have

t0.95,19 = −t0.05,19 = −1.729 and t0.90,19 = −t0.10,19 = −1.328,

i.e.,
P (t(19) < −1.729) = 0.05 and

P (t(19) < −1.328) = 0.10.

This means that

0.05 < p ≡ P (t(19) < −1.61


| {z }) < 0.10.
tobs

ISYE 6739 — Goldsman 3/2/20 12 / 115


Introduction to Hypothesis Testing

In English: If H0 were true, there’s a 100p% chance that we’d see a value of
tobs that’s ≤ −1.61.

ISYE 6739 — Goldsman 3/2/20 13 / 115


Introduction to Hypothesis Testing

In English: If H0 were true, there’s a 100p% chance that we’d see a value of
tobs that’s ≤ −1.61. That’s not a real high probability, but it’s not toooo small.

ISYE 6739 — Goldsman 3/2/20 13 / 115


Introduction to Hypothesis Testing

In English: If H0 were true, there’s a 100p% chance that we’d see a value of
tobs that’s ≤ −1.61. That’s not a real high probability, but it’s not toooo small.

Formally, we’d reject H0 at “level” 0.10,

ISYE 6739 — Goldsman 3/2/20 13 / 115


Introduction to Hypothesis Testing

In English: If H0 were true, there’s a 100p% chance that we’d see a value of
tobs that’s ≤ −1.61. That’s not a real high probability, but it’s not toooo small.

Formally, we’d reject H0 at “level” 0.10, since


tobs = −1.61 < −t0.10,19 = −1.328.

ISYE 6739 — Goldsman 3/2/20 13 / 115


Introduction to Hypothesis Testing

In English: If H0 were true, there’s a 100p% chance that we’d see a value of
tobs that’s ≤ −1.61. That’s not a real high probability, but it’s not toooo small.

Formally, we’d reject H0 at “level” 0.10, since


tobs = −1.61 < −t0.10,19 = −1.328.

But, we’d fail to reject H0 at level 0.05,

ISYE 6739 — Goldsman 3/2/20 13 / 115


Introduction to Hypothesis Testing

In English: If H0 were true, there’s a 100p% chance that we’d see a value of
tobs that’s ≤ −1.61. That’s not a real high probability, but it’s not toooo small.

Formally, we’d reject H0 at “level” 0.10, since


tobs = −1.61 < −t0.10,19 = −1.328.

But, we’d fail to reject H0 at level 0.05, since


tobs = −1.61 > −t0.05,19 = −1.729.

ISYE 6739 — Goldsman 3/2/20 13 / 115


Introduction to Hypothesis Testing

In English: If H0 were true, there’s a 100p% chance that we’d see a value of
tobs that’s ≤ −1.61. That’s not a real high probability, but it’s not toooo small.

Formally, we’d reject H0 at “level” 0.10, since


tobs = −1.61 < −t0.10,19 = −1.328.

But, we’d fail to reject H0 at level 0.05, since


tobs = −1.61 > −t0.05,19 = −1.729.

More on this pretty soon! 2

ISYE 6739 — Goldsman 3/2/20 13 / 115


The Errors of Our Ways

Outline
1 Introduction to Hypothesis Testing
2 The Errors of Our Ways
3 Normal Mean Test with Known Variance
4 Normal Mean Test with Known Variance: Design
5 Two-Sample Normal Means Test with Known Variances
6 Normal Mean Test with Unknown Variance
7 Two-Sample Normal Means Tests with Unknown Variances
8 Two-Sample Normal Means Test with Paired Observations
9 Normal Variance Test
10 Two-Sample Normal Variances Test
11 Bernoulli Proportion Test
12 Two-Sample Bernoulli Proportions Test
13 Goodness-of-Fit Tests: Introduction
14 Goodness-of-Fit Tests: Examples
15 Goodness-of-Fit Tests: Honors Example
ISYE 6739 — Goldsman 3/2/20 14 / 115
The Errors of Our Ways

Lesson 7.2 — The Errors of Our Ways

ISYE 6739 — Goldsman 3/2/20 15 / 115


The Errors of Our Ways

Lesson 7.2 — The Errors of Our Ways

Where Can We Go Wrong?

ISYE 6739 — Goldsman 3/2/20 15 / 115


The Errors of Our Ways

Lesson 7.2 — The Errors of Our Ways

Where Can We Go Wrong? Four things can happen:

ISYE 6739 — Goldsman 3/2/20 15 / 115


The Errors of Our Ways

Lesson 7.2 — The Errors of Our Ways

Where Can We Go Wrong? Four things can happen:

If H0 is actually true and we conclude that it’s true — good.

ISYE 6739 — Goldsman 3/2/20 15 / 115


The Errors of Our Ways

Lesson 7.2 — The Errors of Our Ways

Where Can We Go Wrong? Four things can happen:

If H0 is actually true and we conclude that it’s true — good.

If H0 is actually false and we conclude that it’s false — good.

ISYE 6739 — Goldsman 3/2/20 15 / 115


The Errors of Our Ways

Lesson 7.2 — The Errors of Our Ways

Where Can We Go Wrong? Four things can happen:

If H0 is actually true and we conclude that it’s true — good.

If H0 is actually false and we conclude that it’s false — good.

If H0 is actually true and we conclude that it’s false — bad.

ISYE 6739 — Goldsman 3/2/20 15 / 115


The Errors of Our Ways

Lesson 7.2 — The Errors of Our Ways

Where Can We Go Wrong? Four things can happen:

If H0 is actually true and we conclude that it’s true — good.

If H0 is actually false and we conclude that it’s false — good.

If H0 is actually true and we conclude that it’s false — bad.


This is called Type I error.

ISYE 6739 — Goldsman 3/2/20 15 / 115


The Errors of Our Ways

Lesson 7.2 — The Errors of Our Ways

Where Can We Go Wrong? Four things can happen:

If H0 is actually true and we conclude that it’s true — good.

If H0 is actually false and we conclude that it’s false — good.

If H0 is actually true and we conclude that it’s false — bad.


This is called Type I error.

If H0 is actually false and we conclude that it’s true — bad.

ISYE 6739 — Goldsman 3/2/20 15 / 115


The Errors of Our Ways

Lesson 7.2 — The Errors of Our Ways

Where Can We Go Wrong? Four things can happen:

If H0 is actually true and we conclude that it’s true — good.

If H0 is actually false and we conclude that it’s false — good.

If H0 is actually true and we conclude that it’s false — bad.


This is called Type I error.

If H0 is actually false and we conclude that it’s true — bad.


This is called Type II error.

ISYE 6739 — Goldsman 3/2/20 15 / 115


The Errors of Our Ways

Decision
State of nature Accept H0 Reject H0
H0 true Correct! Type I error
H0 false Type II error Correct!

ISYE 6739 — Goldsman 3/2/20 16 / 115


The Errors of Our Ways

Decision
State of nature Accept H0 Reject H0
H0 true Correct! Type I error
H0 false Type II error Correct!

Example: We incorrectly conclude that a new, inferior drug is better than the
drug currently on the market — Type I error.

ISYE 6739 — Goldsman 3/2/20 16 / 115


The Errors of Our Ways

Decision
State of nature Accept H0 Reject H0
H0 true Correct! Type I error
H0 false Type II error Correct!

Example: We incorrectly conclude that a new, inferior drug is better than the
drug currently on the market — Type I error.

Example: We incorrectly conclude that a new, superior drug is worse than


the drug currently on the market — Type II error.

ISYE 6739 — Goldsman 3/2/20 16 / 115


The Errors of Our Ways

We want to keep:

P (Type I error) = P (Reject H0 | H0 true) ≤ α.

ISYE 6739 — Goldsman 3/2/20 17 / 115


The Errors of Our Ways

We want to keep:

P (Type I error) = P (Reject H0 | H0 true) ≤ α.


P (Type II error) = P (Fail to Rej H0 | H0 false) ≤ β.

ISYE 6739 — Goldsman 3/2/20 17 / 115


The Errors of Our Ways

We want to keep:

P (Type I error) = P (Reject H0 | H0 true) ≤ α.


P (Type II error) = P (Fail to Rej H0 | H0 false) ≤ β.

We choose α and β. Of course, we need to have α + β < 1.

ISYE 6739 — Goldsman 3/2/20 17 / 115


The Errors of Our Ways

We want to keep:

P (Type I error) = P (Reject H0 | H0 true) ≤ α.


P (Type II error) = P (Fail to Rej H0 | H0 false) ≤ β.

We choose α and β. Of course, we need to have α + β < 1.

Usually, Type I error is considered to be “worse” than Type II.

ISYE 6739 — Goldsman 3/2/20 17 / 115


The Errors of Our Ways

We want to keep:

P (Type I error) = P (Reject H0 | H0 true) ≤ α.


P (Type II error) = P (Fail to Rej H0 | H0 false) ≤ β.

We choose α and β. Of course, we need to have α + β < 1.

Usually, Type I error is considered to be “worse” than Type II.

Definition: The probability of Type I error, α, is called the size or level of


significance of the test.

ISYE 6739 — Goldsman 3/2/20 17 / 115


The Errors of Our Ways

We want to keep:

P (Type I error) = P (Reject H0 | H0 true) ≤ α.


P (Type II error) = P (Fail to Rej H0 | H0 false) ≤ β.

We choose α and β. Of course, we need to have α + β < 1.

Usually, Type I error is considered to be “worse” than Type II.

Definition: The probability of Type I error, α, is called the size or level of


significance of the test.

Definition: The power of a hypothesis test is

ISYE 6739 — Goldsman 3/2/20 17 / 115


The Errors of Our Ways

We want to keep:

P (Type I error) = P (Reject H0 | H0 true) ≤ α.


P (Type II error) = P (Fail to Rej H0 | H0 false) ≤ β.

We choose α and β. Of course, we need to have α + β < 1.

Usually, Type I error is considered to be “worse” than Type II.

Definition: The probability of Type I error, α, is called the size or level of


significance of the test.

Definition: The power of a hypothesis test is

1 − β = P (Reject H0 | H0 false).

ISYE 6739 — Goldsman 3/2/20 17 / 115


The Errors of Our Ways

We want to keep:

P (Type I error) = P (Reject H0 | H0 true) ≤ α.


P (Type II error) = P (Fail to Rej H0 | H0 false) ≤ β.

We choose α and β. Of course, we need to have α + β < 1.

Usually, Type I error is considered to be “worse” than Type II.

Definition: The probability of Type I error, α, is called the size or level of


significance of the test.

Definition: The power of a hypothesis test is

1 − β = P (Reject H0 | H0 false).

It’s good to have high power.

ISYE 6739 — Goldsman 3/2/20 17 / 115


Normal Mean Test with Known Variance

1 Introduction to Hypothesis Testing


2 The Errors of Our Ways
3 Normal Mean Test with Known Variance
4 Normal Mean Test with Known Variance: Design
5 Two-Sample Normal Means Test with Known Variances
6 Normal Mean Test with Unknown Variance
7 Two-Sample Normal Means Tests with Unknown Variances
8 Two-Sample Normal Means Test with Paired Observations
9 Normal Variance Test
10 Two-Sample Normal Variances Test
11 Bernoulli Proportion Test
12 Two-Sample Bernoulli Proportions Test
13 Goodness-of-Fit Tests: Introduction
14 Goodness-of-Fit Tests: Examples
15 Goodness-of-Fit Tests: Honors Example
ISYE 6739 — Goldsman 3/2/20 18 / 115
Normal Mean Test with Known Variance

Lesson 7.3 — Normal Mean Test with Known Variance

ISYE 6739 — Goldsman 3/2/20 19 / 115


Normal Mean Test with Known Variance

Lesson 7.3 — Normal Mean Test with Known Variance

We’ll discuss hypothesis tests involving the mean(s) of normal distribution(s)


under various scenarios,

ISYE 6739 — Goldsman 3/2/20 19 / 115


Normal Mean Test with Known Variance

Lesson 7.3 — Normal Mean Test with Known Variance

We’ll discuss hypothesis tests involving the mean(s) of normal distribution(s)


under various scenarios, all of which involve known variance(s).

ISYE 6739 — Goldsman 3/2/20 19 / 115


Normal Mean Test with Known Variance

Lesson 7.3 — Normal Mean Test with Known Variance

We’ll discuss hypothesis tests involving the mean(s) of normal distribution(s)


under various scenarios, all of which involve known variance(s).
iid
Suppose that X1 , . . . , Xn ∼ Nor(µ, σ 2 ),

ISYE 6739 — Goldsman 3/2/20 19 / 115


Normal Mean Test with Known Variance

Lesson 7.3 — Normal Mean Test with Known Variance

We’ll discuss hypothesis tests involving the mean(s) of normal distribution(s)


under various scenarios, all of which involve known variance(s).
iid
Suppose that X1 , . . . , Xn ∼ Nor(µ, σ 2 ), where σ 2 is somehow known (which
is not very realistic).

ISYE 6739 — Goldsman 3/2/20 19 / 115


Normal Mean Test with Known Variance

Lesson 7.3 — Normal Mean Test with Known Variance

We’ll discuss hypothesis tests involving the mean(s) of normal distribution(s)


under various scenarios, all of which involve known variance(s).
iid
Suppose that X1 , . . . , Xn ∼ Nor(µ, σ 2 ), where σ 2 is somehow known (which
is not very realistic).

Two-sided test (also known as a simple test):

ISYE 6739 — Goldsman 3/2/20 19 / 115


Normal Mean Test with Known Variance

Lesson 7.3 — Normal Mean Test with Known Variance

We’ll discuss hypothesis tests involving the mean(s) of normal distribution(s)


under various scenarios, all of which involve known variance(s).
iid
Suppose that X1 , . . . , Xn ∼ Nor(µ, σ 2 ), where σ 2 is somehow known (which
is not very realistic).

Two-sided test (also known as a simple test):

H0 : µ = µ0 vs.

ISYE 6739 — Goldsman 3/2/20 19 / 115


Normal Mean Test with Known Variance

Lesson 7.3 — Normal Mean Test with Known Variance

We’ll discuss hypothesis tests involving the mean(s) of normal distribution(s)


under various scenarios, all of which involve known variance(s).
iid
Suppose that X1 , . . . , Xn ∼ Nor(µ, σ 2 ), where σ 2 is somehow known (which
is not very realistic).

Two-sided test (also known as a simple test):

H0 : µ = µ0 vs. H1 : µ 6= µ0 .

ISYE 6739 — Goldsman 3/2/20 19 / 115


Normal Mean Test with Known Variance

Lesson 7.3 — Normal Mean Test with Known Variance

We’ll discuss hypothesis tests involving the mean(s) of normal distribution(s)


under various scenarios, all of which involve known variance(s).
iid
Suppose that X1 , . . . , Xn ∼ Nor(µ, σ 2 ), where σ 2 is somehow known (which
is not very realistic).

Two-sided test (also known as a simple test):

H0 : µ = µ0 vs. H1 : µ 6= µ0 .

We’ll use X̄ to estimate µ.

ISYE 6739 — Goldsman 3/2/20 19 / 115


Normal Mean Test with Known Variance

Lesson 7.3 — Normal Mean Test with Known Variance

We’ll discuss hypothesis tests involving the mean(s) of normal distribution(s)


under various scenarios, all of which involve known variance(s).
iid
Suppose that X1 , . . . , Xn ∼ Nor(µ, σ 2 ), where σ 2 is somehow known (which
is not very realistic).

Two-sided test (also known as a simple test):

H0 : µ = µ0 vs. H1 : µ 6= µ0 .

We’ll use X̄ to estimate µ. If X̄ is “significantly different” than µ0 , then we’ll


reject H0 .

ISYE 6739 — Goldsman 3/2/20 19 / 115


Normal Mean Test with Known Variance

Lesson 7.3 — Normal Mean Test with Known Variance

We’ll discuss hypothesis tests involving the mean(s) of normal distribution(s)


under various scenarios, all of which involve known variance(s).
iid
Suppose that X1 , . . . , Xn ∼ Nor(µ, σ 2 ), where σ 2 is somehow known (which
is not very realistic).

Two-sided test (also known as a simple test):

H0 : µ = µ0 vs. H1 : µ 6= µ0 .

We’ll use X̄ to estimate µ. If X̄ is “significantly different” than µ0 , then we’ll


reject H0 . But how much is “significantly different”?

ISYE 6739 — Goldsman 3/2/20 19 / 115


Normal Mean Test with Known Variance

To determine what “significantly different” means, first define

ISYE 6739 — Goldsman 3/2/20 20 / 115


Normal Mean Test with Known Variance

To determine what “significantly different” means, first define

X̄ − µ0
Z0 ≡ √ .
σ/ n

ISYE 6739 — Goldsman 3/2/20 20 / 115


Normal Mean Test with Known Variance

To determine what “significantly different” means, first define

X̄ − µ0
Z0 ≡ √ .
σ/ n

If H0 is true, then E[X̄] = µ0 and Var(X̄) = σ 2 /n;

ISYE 6739 — Goldsman 3/2/20 20 / 115


Normal Mean Test with Known Variance

To determine what “significantly different” means, first define

X̄ − µ0
Z0 ≡ √ .
σ/ n

If H0 is true, then E[X̄] = µ0 and Var(X̄) = σ 2 /n; and so Z0 ∼ Nor(0, 1).

ISYE 6739 — Goldsman 3/2/20 20 / 115


Normal Mean Test with Known Variance

To determine what “significantly different” means, first define

X̄ − µ0
Z0 ≡ √ .
σ/ n

If H0 is true, then E[X̄] = µ0 and Var(X̄) = σ 2 /n; and so Z0 ∼ Nor(0, 1).

Then we have
P (−zα/2 ≤ Z0 ≤ zα/2 ) = 1 − α.

ISYE 6739 — Goldsman 3/2/20 20 / 115


Normal Mean Test with Known Variance

To determine what “significantly different” means, first define

X̄ − µ0
Z0 ≡ √ .
σ/ n

If H0 is true, then E[X̄] = µ0 and Var(X̄) = σ 2 /n; and so Z0 ∼ Nor(0, 1).

Then we have
P (−zα/2 ≤ Z0 ≤ zα/2 ) = 1 − α.

A value of Z0 outside the interval [−zα/2 , zα/2 ] is highly unlikely if H0 is


true.

ISYE 6739 — Goldsman 3/2/20 20 / 115


Normal Mean Test with Known Variance

Therefore,

Reject H0 iff |Z0 | > zα/2 .

ISYE 6739 — Goldsman 3/2/20 21 / 115


Normal Mean Test with Known Variance

Therefore,

Reject H0 iff |Z0 | > zα/2 .

This assures us that

P (Type I error) = P (Reject H0 | H0 true)

ISYE 6739 — Goldsman 3/2/20 21 / 115


Normal Mean Test with Known Variance

Therefore,

Reject H0 iff |Z0 | > zα/2 .

This assures us that

P (Type I error) = P (Reject H0 | H0 true)



= P |Z0 | > zα/2 | Z0 ∼ Nor(0, 1)

ISYE 6739 — Goldsman 3/2/20 21 / 115


Normal Mean Test with Known Variance

Therefore,

Reject H0 iff |Z0 | > zα/2 .

This assures us that

P (Type I error) = P (Reject H0 | H0 true)



= P |Z0 | > zα/2 | Z0 ∼ Nor(0, 1)
= α.

ISYE 6739 — Goldsman 3/2/20 21 / 115


Normal Mean Test with Known Variance

Therefore,

Reject H0 iff |Z0 | > zα/2 .

This assures us that

P (Type I error) = P (Reject H0 | H0 true)



= P |Z0 | > zα/2 | Z0 ∼ Nor(0, 1)
= α.

If |Z0 | > zα/2 , then we’re in the rejection region.

ISYE 6739 — Goldsman 3/2/20 21 / 115


Normal Mean Test with Known Variance

Therefore,

Reject H0 iff |Z0 | > zα/2 .

This assures us that

P (Type I error) = P (Reject H0 | H0 true)



= P |Z0 | > zα/2 | Z0 ∼ Nor(0, 1)
= α.

If |Z0 | > zα/2 , then we’re in the rejection region.


(This is also called the critical region.)

ISYE 6739 — Goldsman 3/2/20 21 / 115


Normal Mean Test with Known Variance

Therefore,

Reject H0 iff |Z0 | > zα/2 .

This assures us that

P (Type I error) = P (Reject H0 | H0 true)



= P |Z0 | > zα/2 | Z0 ∼ Nor(0, 1)
= α.

If |Z0 | > zα/2 , then we’re in the rejection region.


(This is also called the critical region.)

If |Z0 | ≤ zα/2 , then we’re in the acceptance region.

ISYE 6739 — Goldsman 3/2/20 21 / 115


Normal Mean Test with Known Variance

One-sided test:

ISYE 6739 — Goldsman 3/2/20 22 / 115


Normal Mean Test with Known Variance

One-sided test:

H0 : µ ≤ µ0

ISYE 6739 — Goldsman 3/2/20 22 / 115


Normal Mean Test with Known Variance

One-sided test:

H0 : µ ≤ µ0
H1 : µ > µ0

ISYE 6739 — Goldsman 3/2/20 22 / 115


Normal Mean Test with Known Variance

One-sided test:

H0 : µ ≤ µ0
H1 : µ > µ0

Again let
X̄ − µ0
Z0 = √ .
σ/ n

ISYE 6739 — Goldsman 3/2/20 22 / 115


Normal Mean Test with Known Variance

One-sided test:

H0 : µ ≤ µ0
H1 : µ > µ0

Again let
X̄ − µ0
Z0 = √ .
σ/ n
A value of Z0 outside the interval (−∞, zα ] is highly unlikely if H0 is true.

ISYE 6739 — Goldsman 3/2/20 22 / 115


Normal Mean Test with Known Variance

One-sided test:

H0 : µ ≤ µ0
H1 : µ > µ0

Again let
X̄ − µ0
Z0 = √ .
σ/ n
A value of Z0 outside the interval (−∞, zα ] is highly unlikely if H0 is true.
Therefore,

Reject H0 iff Z0 > zα .

ISYE 6739 — Goldsman 3/2/20 22 / 115


Normal Mean Test with Known Variance

One-sided test:

H0 : µ ≤ µ0
H1 : µ > µ0

Again let
X̄ − µ0
Z0 = √ .
σ/ n
A value of Z0 outside the interval (−∞, zα ] is highly unlikely if H0 is true.
Therefore,

Reject H0 iff Z0 > zα .

If Z0 > zα , this suggests µ > µ0 .

ISYE 6739 — Goldsman 3/2/20 22 / 115


Normal Mean Test with Known Variance

Similarly, the other one-sided test:

ISYE 6739 — Goldsman 3/2/20 23 / 115


Normal Mean Test with Known Variance

Similarly, the other one-sided test:

H0 : µ ≥ µ0

ISYE 6739 — Goldsman 3/2/20 23 / 115


Normal Mean Test with Known Variance

Similarly, the other one-sided test:

H0 : µ ≥ µ0
H1 : µ < µ0

ISYE 6739 — Goldsman 3/2/20 23 / 115


Normal Mean Test with Known Variance

Similarly, the other one-sided test:

H0 : µ ≥ µ0
H1 : µ < µ0

A value of Z0 outside the interval [−zα , ∞) is highly unlikely if H0 is true.

ISYE 6739 — Goldsman 3/2/20 23 / 115


Normal Mean Test with Known Variance

Similarly, the other one-sided test:

H0 : µ ≥ µ0
H1 : µ < µ0

A value of Z0 outside the interval [−zα , ∞) is highly unlikely if H0 is true.


Therefore,

Reject H0 iff Z0 < −zα .

ISYE 6739 — Goldsman 3/2/20 23 / 115


Normal Mean Test with Known Variance

Similarly, the other one-sided test:

H0 : µ ≥ µ0
H1 : µ < µ0

A value of Z0 outside the interval [−zα , ∞) is highly unlikely if H0 is true.


Therefore,

Reject H0 iff Z0 < −zα .

If Z0 < −zα , this suggests µ < µ0 .

ISYE 6739 — Goldsman 3/2/20 23 / 115


Normal Mean Test with Known Variance

Example: We examine the weights of 25 nine-year-old kids.

ISYE 6739 — Goldsman 3/2/20 24 / 115


Normal Mean Test with Known Variance

Example: We examine the weights of 25 nine-year-old kids.


Suppose we somehow know that the weights are normally distributed with
σ = 4.

ISYE 6739 — Goldsman 3/2/20 24 / 115


Normal Mean Test with Known Variance

Example: We examine the weights of 25 nine-year-old kids.


Suppose we somehow know that the weights are normally distributed with
σ = 4. The sample mean of the 25 weights is 62.

ISYE 6739 — Goldsman 3/2/20 24 / 115


Normal Mean Test with Known Variance

Example: We examine the weights of 25 nine-year-old kids.


Suppose we somehow know that the weights are normally distributed with
σ = 4. The sample mean of the 25 weights is 62.

Test the hypothesis that the mean weight is 60.

ISYE 6739 — Goldsman 3/2/20 24 / 115


Normal Mean Test with Known Variance

Example: We examine the weights of 25 nine-year-old kids.


Suppose we somehow know that the weights are normally distributed with
σ = 4. The sample mean of the 25 weights is 62.

Test the hypothesis that the mean weight is 60.


Keep the probability of Type I error = 0.05.

ISYE 6739 — Goldsman 3/2/20 24 / 115


Normal Mean Test with Known Variance

Example: We examine the weights of 25 nine-year-old kids.


Suppose we somehow know that the weights are normally distributed with
σ = 4. The sample mean of the 25 weights is 62.

Test the hypothesis that the mean weight is 60.


Keep the probability of Type I error = 0.05.

H0 : µ = µ0 vs.

ISYE 6739 — Goldsman 3/2/20 24 / 115


Normal Mean Test with Known Variance

Example: We examine the weights of 25 nine-year-old kids.


Suppose we somehow know that the weights are normally distributed with
σ = 4. The sample mean of the 25 weights is 62.

Test the hypothesis that the mean weight is 60.


Keep the probability of Type I error = 0.05.

H0 : µ = µ0 vs. H1 : µ 6= µ0 .

ISYE 6739 — Goldsman 3/2/20 24 / 115


Normal Mean Test with Known Variance

Example: We examine the weights of 25 nine-year-old kids.


Suppose we somehow know that the weights are normally distributed with
σ = 4. The sample mean of the 25 weights is 62.

Test the hypothesis that the mean weight is 60.


Keep the probability of Type I error = 0.05.

H0 : µ = µ0 vs. H1 : µ 6= µ0 .

Here we have
X̄ − µ0
Z0 = √
σ/ n

ISYE 6739 — Goldsman 3/2/20 24 / 115


Normal Mean Test with Known Variance

Example: We examine the weights of 25 nine-year-old kids.


Suppose we somehow know that the weights are normally distributed with
σ = 4. The sample mean of the 25 weights is 62.

Test the hypothesis that the mean weight is 60.


Keep the probability of Type I error = 0.05.

H0 : µ = µ0 vs. H1 : µ 6= µ0 .

Here we have
X̄ − µ0 62 − 60
Z0 = √ = √
σ/ n 4/ 25

ISYE 6739 — Goldsman 3/2/20 24 / 115


Normal Mean Test with Known Variance

Example: We examine the weights of 25 nine-year-old kids.


Suppose we somehow know that the weights are normally distributed with
σ = 4. The sample mean of the 25 weights is 62.

Test the hypothesis that the mean weight is 60.


Keep the probability of Type I error = 0.05.

H0 : µ = µ0 vs. H1 : µ 6= µ0 .

Here we have
X̄ − µ0 62 − 60
Z0 = √ = √ = 2.5.
σ/ n 4/ 25

ISYE 6739 — Goldsman 3/2/20 24 / 115


Normal Mean Test with Known Variance

Example: We examine the weights of 25 nine-year-old kids.


Suppose we somehow know that the weights are normally distributed with
σ = 4. The sample mean of the 25 weights is 62.

Test the hypothesis that the mean weight is 60.


Keep the probability of Type I error = 0.05.

H0 : µ = µ0 vs. H1 : µ 6= µ0 .

Here we have
X̄ − µ0 62 − 60
Z0 = √ = √ = 2.5.
σ/ n 4/ 25
Since |Z0 | = 2.5 > zα/2 = z0.025 = 1.96, we reject H0 .

ISYE 6739 — Goldsman 3/2/20 24 / 115


Normal Mean Test with Known Variance

Example: We examine the weights of 25 nine-year-old kids.


Suppose we somehow know that the weights are normally distributed with
σ = 4. The sample mean of the 25 weights is 62.

Test the hypothesis that the mean weight is 60.


Keep the probability of Type I error = 0.05.

H0 : µ = µ0 vs. H1 : µ 6= µ0 .

Here we have
X̄ − µ0 62 − 60
Z0 = √ = √ = 2.5.
σ/ n 4/ 25
Since |Z0 | = 2.5 > zα/2 = z0.025 = 1.96, we reject H0 .

Notice that a lower α results in a higher zα/2 .

ISYE 6739 — Goldsman 3/2/20 24 / 115


Normal Mean Test with Known Variance

Example: We examine the weights of 25 nine-year-old kids.


Suppose we somehow know that the weights are normally distributed with
σ = 4. The sample mean of the 25 weights is 62.

Test the hypothesis that the mean weight is 60.


Keep the probability of Type I error = 0.05.

H0 : µ = µ0 vs. H1 : µ 6= µ0 .

Here we have
X̄ − µ0 62 − 60
Z0 = √ = √ = 2.5.
σ/ n 4/ 25
Since |Z0 | = 2.5 > zα/2 = z0.025 = 1.96, we reject H0 .

Notice that a lower α results in a higher zα/2 . Then it’s “harder” to reject H0 .

ISYE 6739 — Goldsman 3/2/20 24 / 115


Normal Mean Test with Known Variance

Example: We examine the weights of 25 nine-year-old kids.


Suppose we somehow know that the weights are normally distributed with
σ = 4. The sample mean of the 25 weights is 62.

Test the hypothesis that the mean weight is 60.


Keep the probability of Type I error = 0.05.

H0 : µ = µ0 vs. H1 : µ 6= µ0 .

Here we have
X̄ − µ0 62 − 60
Z0 = √ = √ = 2.5.
σ/ n 4/ 25
Since |Z0 | = 2.5 > zα/2 = z0.025 = 1.96, we reject H0 .

Notice that a lower α results in a higher zα/2 . Then it’s “harder” to reject H0 .
For instance, if α = 0.01, then z0.005 = 2.58,

ISYE 6739 — Goldsman 3/2/20 24 / 115


Normal Mean Test with Known Variance

Example: We examine the weights of 25 nine-year-old kids.


Suppose we somehow know that the weights are normally distributed with
σ = 4. The sample mean of the 25 weights is 62.

Test the hypothesis that the mean weight is 60.


Keep the probability of Type I error = 0.05.

H0 : µ = µ0 vs. H1 : µ 6= µ0 .

Here we have
X̄ − µ0 62 − 60
Z0 = √ = √ = 2.5.
σ/ n 4/ 25
Since |Z0 | = 2.5 > zα/2 = z0.025 = 1.96, we reject H0 .

Notice that a lower α results in a higher zα/2 . Then it’s “harder” to reject H0 .
For instance, if α = 0.01, then z0.005 = 2.58, and we would fail to reject H0
in this example. 2

ISYE 6739 — Goldsman 3/2/20 24 / 115


Normal Mean Test with Known Variance

Definition: The p-value of a test

ISYE 6739 — Goldsman 3/2/20 25 / 115


Normal Mean Test with Known Variance

Definition: The p-value of a test is the smallest level of significance α that


would lead to rejection of H0 .

ISYE 6739 — Goldsman 3/2/20 25 / 115


Normal Mean Test with Known Variance

Definition: The p-value of a test is the smallest level of significance α that


would lead to rejection of H0 .

Remark: Researchers often report the p-values of any tests that they conduct.

ISYE 6739 — Goldsman 3/2/20 25 / 115


Normal Mean Test with Known Variance

Definition: The p-value of a test is the smallest level of significance α that


would lead to rejection of H0 .

Remark: Researchers often report the p-values of any tests that they conduct.

For the two-sided normal mean test with known variance, we reject H0 iff

ISYE 6739 — Goldsman 3/2/20 25 / 115


Normal Mean Test with Known Variance

Definition: The p-value of a test is the smallest level of significance α that


would lead to rejection of H0 .

Remark: Researchers often report the p-values of any tests that they conduct.

For the two-sided normal mean test with known variance, we reject H0 iff

|Z0 | > zα/2 = Φ−1 (1 − α/2)

ISYE 6739 — Goldsman 3/2/20 25 / 115


Normal Mean Test with Known Variance

Definition: The p-value of a test is the smallest level of significance α that


would lead to rejection of H0 .

Remark: Researchers often report the p-values of any tests that they conduct.

For the two-sided normal mean test with known variance, we reject H0 iff

|Z0 | > zα/2 = Φ−1 (1 − α/2)

iff Φ(|Z0 |) > 1 − α/2

ISYE 6739 — Goldsman 3/2/20 25 / 115


Normal Mean Test with Known Variance

Definition: The p-value of a test is the smallest level of significance α that


would lead to rejection of H0 .

Remark: Researchers often report the p-values of any tests that they conduct.

For the two-sided normal mean test with known variance, we reject H0 iff

|Z0 | > zα/2 = Φ−1 (1 − α/2)

iff Φ(|Z0 |) > 1 − α/2

iff α > 2(1 − Φ(|Z0 |)).

ISYE 6739 — Goldsman 3/2/20 25 / 115


Normal Mean Test with Known Variance

Definition: The p-value of a test is the smallest level of significance α that


would lead to rejection of H0 .

Remark: Researchers often report the p-values of any tests that they conduct.

For the two-sided normal mean test with known variance, we reject H0 iff

|Z0 | > zα/2 = Φ−1 (1 − α/2)

iff Φ(|Z0 |) > 1 − α/2

iff α > 2(1 − Φ(|Z0 |)).


Thus, for the two-sided test

ISYE 6739 — Goldsman 3/2/20 25 / 115


Normal Mean Test with Known Variance

Definition: The p-value of a test is the smallest level of significance α that


would lead to rejection of H0 .

Remark: Researchers often report the p-values of any tests that they conduct.

For the two-sided normal mean test with known variance, we reject H0 iff

|Z0 | > zα/2 = Φ−1 (1 − α/2)

iff Φ(|Z0 |) > 1 − α/2

iff α > 2(1 − Φ(|Z0 |)).


Thus, for the two-sided test

H0 : µ = µ0 vs. H1 : µ 6= µ0 ,

ISYE 6739 — Goldsman 3/2/20 25 / 115


Normal Mean Test with Known Variance

Definition: The p-value of a test is the smallest level of significance α that


would lead to rejection of H0 .

Remark: Researchers often report the p-values of any tests that they conduct.

For the two-sided normal mean test with known variance, we reject H0 iff

|Z0 | > zα/2 = Φ−1 (1 − α/2)

iff Φ(|Z0 |) > 1 − α/2

iff α > 2(1 − Φ(|Z0 |)).


Thus, for the two-sided test

H0 : µ = µ0 vs. H1 : µ 6= µ0 ,

the p-value is p = 2(1 − Φ(|Z0 |)). 2

ISYE 6739 — Goldsman 3/2/20 25 / 115


Normal Mean Test with Known Variance

Similarly, for the one-sided test

ISYE 6739 — Goldsman 3/2/20 26 / 115


Normal Mean Test with Known Variance

Similarly, for the one-sided test

H0 : µ ≤ µ0 vs. H1 : µ > µ0 ,

ISYE 6739 — Goldsman 3/2/20 26 / 115


Normal Mean Test with Known Variance

Similarly, for the one-sided test

H0 : µ ≤ µ0 vs. H1 : µ > µ0 ,

we have p = 1 − Φ(Z0 ).

ISYE 6739 — Goldsman 3/2/20 26 / 115


Normal Mean Test with Known Variance

Similarly, for the one-sided test

H0 : µ ≤ µ0 vs. H1 : µ > µ0 ,

we have p = 1 − Φ(Z0 ).

And for the other one-sided test

ISYE 6739 — Goldsman 3/2/20 26 / 115


Normal Mean Test with Known Variance

Similarly, for the one-sided test

H0 : µ ≤ µ0 vs. H1 : µ > µ0 ,

we have p = 1 − Φ(Z0 ).

And for the other one-sided test

H0 : µ ≥ µ0 vs. H1 : µ < µ0 ,

ISYE 6739 — Goldsman 3/2/20 26 / 115


Normal Mean Test with Known Variance

Similarly, for the one-sided test

H0 : µ ≤ µ0 vs. H1 : µ > µ0 ,

we have p = 1 − Φ(Z0 ).

And for the other one-sided test

H0 : µ ≥ µ0 vs. H1 : µ < µ0 ,

we have p = Φ(Z0 ).

ISYE 6739 — Goldsman 3/2/20 26 / 115


Normal Mean Test with Known Variance

Similarly, for the one-sided test

H0 : µ ≤ µ0 vs. H1 : µ > µ0 ,

we have p = 1 − Φ(Z0 ).

And for the other one-sided test

H0 : µ ≥ µ0 vs. H1 : µ < µ0 ,

we have p = Φ(Z0 ).

Example: For the previous example,

ISYE 6739 — Goldsman 3/2/20 26 / 115


Normal Mean Test with Known Variance

Similarly, for the one-sided test

H0 : µ ≤ µ0 vs. H1 : µ > µ0 ,

we have p = 1 − Φ(Z0 ).

And for the other one-sided test

H0 : µ ≥ µ0 vs. H1 : µ < µ0 ,

we have p = Φ(Z0 ).

Example: For the previous example,

p = 2(1 − Φ(|Z0 |)) = 2(1 − Φ(2.5)) = 0.0124. 2

ISYE 6739 — Goldsman 3/2/20 26 / 115


Normal Mean Test with Known Variance: Design

1 Introduction to Hypothesis Testing


2 The Errors of Our Ways
3 Normal Mean Test with Known Variance
4 Normal Mean Test with Known Variance: Design
5 Two-Sample Normal Means Test with Known Variances
6 Normal Mean Test with Unknown Variance
7 Two-Sample Normal Means Tests with Unknown Variances
8 Two-Sample Normal Means Test with Paired Observations
9 Normal Variance Test
10 Two-Sample Normal Variances Test
11 Bernoulli Proportion Test
12 Two-Sample Bernoulli Proportions Test
13 Goodness-of-Fit Tests: Introduction
14 Goodness-of-Fit Tests: Examples
15 Goodness-of-Fit Tests: Honors Example
ISYE 6739 — Goldsman 3/2/20 27 / 115
Normal Mean Test with Known Variance: Design

Lesson 7.4 — Normal Mean Test with Known Variance: Design

ISYE 6739 — Goldsman 3/2/20 28 / 115


Normal Mean Test with Known Variance: Design

Lesson 7.4 — Normal Mean Test with Known Variance: Design

Goal: Design a two-sided test with the following constraints on Type I and II
errors:

ISYE 6739 — Goldsman 3/2/20 28 / 115


Normal Mean Test with Known Variance: Design

Lesson 7.4 — Normal Mean Test with Known Variance: Design

Goal: Design a two-sided test with the following constraints on Type I and II
errors:

P (Type I error) ≤ α and

ISYE 6739 — Goldsman 3/2/20 28 / 115


Normal Mean Test with Known Variance: Design

Lesson 7.4 — Normal Mean Test with Known Variance: Design

Goal: Design a two-sided test with the following constraints on Type I and II
errors:

P (Type I error) ≤ α and P Type II error | µ = µ1 > µ0 ≤ β.

ISYE 6739 — Goldsman 3/2/20 28 / 115


Normal Mean Test with Known Variance: Design

Lesson 7.4 — Normal Mean Test with Known Variance: Design

Goal: Design a two-sided test with the following constraints on Type I and II
errors:

P (Type I error) ≤ α and P Type II error | µ = µ1 > µ0 ≤ β.

By “design,” we mean how many observations n do we need for the two-sided


test to satisfy a Type I error bound of α

ISYE 6739 — Goldsman 3/2/20 28 / 115


Normal Mean Test with Known Variance: Design

Lesson 7.4 — Normal Mean Test with Known Variance: Design

Goal: Design a two-sided test with the following constraints on Type I and II
errors:

P (Type I error) ≤ α and P Type II error | µ = µ1 > µ0 ≤ β.

By “design,” we mean how many observations n do we need for the two-sided


test to satisfy a Type I error bound of α and a Type II error bound of β?

ISYE 6739 — Goldsman 3/2/20 28 / 115


Normal Mean Test with Known Variance: Design

Lesson 7.4 — Normal Mean Test with Known Variance: Design

Goal: Design a two-sided test with the following constraints on Type I and II
errors:

P (Type I error) ≤ α and P Type II error | µ = µ1 > µ0 ≤ β.

By “design,” we mean how many observations n do we need for the two-sided


test to satisfy a Type I error bound of α and a Type II error bound of β?

Remark: The bound β is for the special case that the true mean µ happens to
equal a user-specified value µ = µ1 > µ0 .

ISYE 6739 — Goldsman 3/2/20 28 / 115


Normal Mean Test with Known Variance: Design

Lesson 7.4 — Normal Mean Test with Known Variance: Design

Goal: Design a two-sided test with the following constraints on Type I and II
errors:

P (Type I error) ≤ α and P Type II error | µ = µ1 > µ0 ≤ β.

By “design,” we mean how many observations n do we need for the two-sided


test to satisfy a Type I error bound of α and a Type II error bound of β?

Remark: The bound β is for the special case that the true mean µ happens to
equal a user-specified value µ = µ1 > µ0 . In other words, we’re trying to
“protect” ourselves against the possibility that µ actually happens to equal µ1 .

ISYE 6739 — Goldsman 3/2/20 28 / 115


Normal Mean Test with Known Variance: Design

Lesson 7.4 — Normal Mean Test with Known Variance: Design

Goal: Design a two-sided test with the following constraints on Type I and II
errors:

P (Type I error) ≤ α and P Type II error | µ = µ1 > µ0 ≤ β.

By “design,” we mean how many observations n do we need for the two-sided


test to satisfy a Type I error bound of α and a Type II error bound of β?

Remark: The bound β is for the special case that the true mean µ happens to
equal a user-specified value µ = µ1 > µ0 . In other words, we’re trying to
“protect” ourselves against the possibility that µ actually happens to equal µ1 .

If we change the “protected” µ1 , we’ll need to change n.

ISYE 6739 — Goldsman 3/2/20 28 / 115


Normal Mean Test with Known Variance: Design

Lesson 7.4 — Normal Mean Test with Known Variance: Design

Goal: Design a two-sided test with the following constraints on Type I and II
errors:

P (Type I error) ≤ α and P Type II error | µ = µ1 > µ0 ≤ β.

By “design,” we mean how many observations n do we need for the two-sided


test to satisfy a Type I error bound of α and a Type II error bound of β?

Remark: The bound β is for the special case that the true mean µ happens to
equal a user-specified value µ = µ1 > µ0 . In other words, we’re trying to
“protect” ourselves against the possibility that µ actually happens to equal µ1 .

If we change the “protected” µ1 , we’ll need to change n. Generally, the closer


µ1 is to µ0 , the more work we need to do (i.e., higher n)

ISYE 6739 — Goldsman 3/2/20 28 / 115


Normal Mean Test with Known Variance: Design

Lesson 7.4 — Normal Mean Test with Known Variance: Design

Goal: Design a two-sided test with the following constraints on Type I and II
errors:

P (Type I error) ≤ α and P Type II error | µ = µ1 > µ0 ≤ β.

By “design,” we mean how many observations n do we need for the two-sided


test to satisfy a Type I error bound of α and a Type II error bound of β?

Remark: The bound β is for the special case that the true mean µ happens to
equal a user-specified value µ = µ1 > µ0 . In other words, we’re trying to
“protect” ourselves against the possibility that µ actually happens to equal µ1 .

If we change the “protected” µ1 , we’ll need to change n. Generally, the closer


µ1 is to µ0 , the more work we need to do (i.e., higher n) — because it’s harder
to distinguish between two close cases.

ISYE 6739 — Goldsman 3/2/20 28 / 115


Normal Mean Test with Known Variance: Design

Theorem: Suppose the difference between the actual and hypothesized


means is

ISYE 6739 — Goldsman 3/2/20 29 / 115


Normal Mean Test with Known Variance: Design

Theorem: Suppose the difference between the actual and hypothesized


means is
δ ≡ µ − µ0 = µ1 − µ 0 .

ISYE 6739 — Goldsman 3/2/20 29 / 115


Normal Mean Test with Known Variance: Design

Theorem: Suppose the difference between the actual and hypothesized


means is
δ ≡ µ − µ0 = µ1 − µ 0 .
(Without loss of generality, we’ll assume µ1 > µ0 .)

ISYE 6739 — Goldsman 3/2/20 29 / 115


Normal Mean Test with Known Variance: Design

Theorem: Suppose the difference between the actual and hypothesized


means is
δ ≡ µ − µ0 = µ1 − µ 0 .
(Without loss of generality, we’ll assume µ1 > µ0 .) Then the α and β design
requirements can be achieved by taking a sample of size

ISYE 6739 — Goldsman 3/2/20 29 / 115


Normal Mean Test with Known Variance: Design

Theorem: Suppose the difference between the actual and hypothesized


means is
δ ≡ µ − µ0 = µ1 − µ 0 .
(Without loss of generality, we’ll assume µ1 > µ0 .) Then the α and β design
requirements can be achieved by taking a sample of size
.
n = σ 2 (zα/2 + zβ )2 /δ 2 .

ISYE 6739 — Goldsman 3/2/20 29 / 115


Normal Mean Test with Known Variance: Design

Theorem: Suppose the difference between the actual and hypothesized


means is
δ ≡ µ − µ0 = µ1 − µ 0 .
(Without loss of generality, we’ll assume µ1 > µ0 .) Then the α and β design
requirements can be achieved by taking a sample of size
.
n = σ 2 (zα/2 + zβ )2 /δ 2 .

Remark: In the proof that follows, we’ll get an expression for β that involves
the standard normal cdf evaluated at a mess that contains n.

ISYE 6739 — Goldsman 3/2/20 29 / 115


Normal Mean Test with Known Variance: Design

Theorem: Suppose the difference between the actual and hypothesized


means is
δ ≡ µ − µ0 = µ1 − µ 0 .
(Without loss of generality, we’ll assume µ1 > µ0 .) Then the α and β design
requirements can be achieved by taking a sample of size
.
n = σ 2 (zα/2 + zβ )2 /δ 2 .

Remark: In the proof that follows, we’ll get an expression for β that involves
the standard normal cdf evaluated at a mess that contains n. We’ll then do an
inversion to obtain the desired approximation for n.

ISYE 6739 — Goldsman 3/2/20 29 / 115


Normal Mean Test with Known Variance: Design

Proof: Let’s first look at the β value,

ISYE 6739 — Goldsman 3/2/20 30 / 115


Normal Mean Test with Known Variance: Design

Proof: Let’s first look at the β value,

β = P (Type II error | µ = µ1 > µ0 )

ISYE 6739 — Goldsman 3/2/20 30 / 115


Normal Mean Test with Known Variance: Design

Proof: Let’s first look at the β value,

β = P (Type II error | µ = µ1 > µ0 )

= P (Fail to Reject H0 | H0 false (µ = µ1 > µ0 ))

ISYE 6739 — Goldsman 3/2/20 30 / 115


Normal Mean Test with Known Variance: Design

Proof: Let’s first look at the β value,

β = P (Type II error | µ = µ1 > µ0 )

= P (Fail to Reject H0 | H0 false (µ = µ1 > µ0 ))

= P (|Z0 | ≤ zα/2 | µ = µ1 )

ISYE 6739 — Goldsman 3/2/20 30 / 115


Normal Mean Test with Known Variance: Design

Proof: Let’s first look at the β value,

β = P (Type II error | µ = µ1 > µ0 )

= P (Fail to Reject H0 | H0 false (µ = µ1 > µ0 ))

= P (|Z0 | ≤ zα/2 | µ = µ1 )

= P (−zα/2 ≤ Z0 ≤ zα/2 | µ = µ1 )

ISYE 6739 — Goldsman 3/2/20 30 / 115


Normal Mean Test with Known Variance: Design

Proof: Let’s first look at the β value,

β = P (Type II error | µ = µ1 > µ0 )

= P (Fail to Reject H0 | H0 false (µ = µ1 > µ0 ))

= P (|Z0 | ≤ zα/2 | µ = µ1 )

= P (−zα/2 ≤ Z0 ≤ zα/2 | µ = µ1 )
 
X̄ − µ0
= P −zα/2 ≤ √ ≤ zα/2 µ = µ1
σ/ n

ISYE 6739 — Goldsman 3/2/20 30 / 115


Normal Mean Test with Known Variance: Design

Proof: Let’s first look at the β value,

β = P (Type II error | µ = µ1 > µ0 )

= P (Fail to Reject H0 | H0 false (µ = µ1 > µ0 ))

= P (|Z0 | ≤ zα/2 | µ = µ1 )

= P (−zα/2 ≤ Z0 ≤ zα/2 | µ = µ1 )
 
X̄ − µ0
= P −zα/2 ≤ √ ≤ zα/2 µ = µ1
σ/ n
 
X̄ − µ1 µ1 − µ0
= P −zα/2 ≤ √ + √ ≤ zα/2 µ = µ1 .

σ/ n σ/ n

ISYE 6739 — Goldsman 3/2/20 30 / 115


Normal Mean Test with Known Variance: Design

Notice that
X̄ − µ1
Z ≡ √ ∼ Nor(0, 1).
σ/ n

ISYE 6739 — Goldsman 3/2/20 31 / 115


Normal Mean Test with Known Variance: Design

Notice that
X̄ − µ1
Z ≡ √ ∼ Nor(0, 1).
σ/ n

This gives
 √ 

β = P −zα/2 ≤ Z+ ≤ zα/2
σ

ISYE 6739 — Goldsman 3/2/20 31 / 115


Normal Mean Test with Known Variance: Design

Notice that
X̄ − µ1
Z ≡ √ ∼ Nor(0, 1).
σ/ n

This gives
  √

β = P −zα/2 ≤ Z + ≤ zα/2
σ
 √ √ 
nδ nδ
= P −zα/2 − ≤ Z ≤ zα/2 −
σ σ

ISYE 6739 — Goldsman 3/2/20 31 / 115


Normal Mean Test with Known Variance: Design

Notice that
X̄ − µ1
Z ≡ √ ∼ Nor(0, 1).
σ/ n

This gives
  √

β = P −zα/2 ≤ Z + ≤ zα/2
σ
 √ √ 
nδ nδ
= P −zα/2 − ≤ Z ≤ zα/2 −
σ σ
 √   √ 
nδ nδ
= Φ zα/2 − − Φ −zα/2 − .
σ σ

ISYE 6739 — Goldsman 3/2/20 31 / 115


Normal Mean Test with Known Variance: Design

Notice that
X̄ − µ1
Z ≡ √ ∼ Nor(0, 1).
σ/ n

This gives
  √

β = P −zα/2 ≤ Z + ≤ zα/2
σ
 √ √ 
nδ nδ
= P −zα/2 − ≤ Z ≤ zα/2 −
σ σ
 √   √ 
nδ nδ
= Φ zα/2 − − Φ −zα/2 − .
σ σ

Now, note that −zα/2  0 and − nδ/σ < 0 (since δ > 0).

ISYE 6739 — Goldsman 3/2/20 31 / 115


Normal Mean Test with Known Variance: Design

Notice that
X̄ − µ1
Z ≡ √ ∼ Nor(0, 1).
σ/ n

This gives
  √

β = P −zα/2 ≤ Z + ≤ zα/2
σ
 √ √ 
nδ nδ
= P −zα/2 − ≤ Z ≤ zα/2 −
σ σ
 √   √ 
nδ nδ
= Φ zα/2 − − Φ −zα/2 − .
σ σ

Now, note that −zα/2  0 and − nδ/σ < 0 (since δ > 0).

These two facts imply that the second Φ(·) is pretty much zero, so. . .

ISYE 6739 — Goldsman 3/2/20 31 / 115


Normal Mean Test with Known Variance: Design

We only need to use the first term in the previous expression for β:

ISYE 6739 — Goldsman 3/2/20 32 / 115


Normal Mean Test with Known Variance: Design

We only need to use the first term in the previous expression for β:
 √ 
. nδ
β = Φ zα/2 −
σ

ISYE 6739 — Goldsman 3/2/20 32 / 115


Normal Mean Test with Known Variance: Design

We only need to use the first term in the previous expression for β:
 √ 
. nδ
β = Φ zα/2 −
σ
iff √
−1 . nδ
Φ (β) = −zβ = zα/2 −
σ

ISYE 6739 — Goldsman 3/2/20 32 / 115


Normal Mean Test with Known Variance: Design

We only need to use the first term in the previous expression for β:
 √ 
. nδ
β = Φ zα/2 −
σ
iff √
−1 . nδ
Φ (β) = −zβ = zα/2 −
σ
iff √
nδ .
= zα/2 + zβ
σ

ISYE 6739 — Goldsman 3/2/20 32 / 115


Normal Mean Test with Known Variance: Design

We only need to use the first term in the previous expression for β:
 √ 
. nδ
β = Φ zα/2 −
σ
iff √
−1 . nδ
Φ (β) = −zβ = zα/2 −
σ
iff √
nδ .
= zα/2 + zβ
σ
iff
.
n = σ 2 (zα/2 + zβ )2 /δ 2 . Done! Whew!

ISYE 6739 — Goldsman 3/2/20 32 / 115


Normal Mean Test with Known Variance: Design

Recap: If you want to test H0 : µ = µ0 vs. H1 : µ 6= µ0 , and

ISYE 6739 — Goldsman 3/2/20 33 / 115


Normal Mean Test with Known Variance: Design

Recap: If you want to test H0 : µ = µ0 vs. H1 : µ 6= µ0 , and


(1) You know σ 2 ,

ISYE 6739 — Goldsman 3/2/20 33 / 115


Normal Mean Test with Known Variance: Design

Recap: If you want to test H0 : µ = µ0 vs. H1 : µ 6= µ0 , and


(1) You know σ 2 ,
(2) You want P (Type I error) = α, and

ISYE 6739 — Goldsman 3/2/20 33 / 115


Normal Mean Test with Known Variance: Design

Recap: If you want to test H0 : µ = µ0 vs. H1 : µ 6= µ0 , and


(1) You know σ 2 ,
(2) You want P (Type I error) = α, and
(3) You want P (Type II error) = β when µ = µ1 (6= µ0 ),

ISYE 6739 — Goldsman 3/2/20 33 / 115


Normal Mean Test with Known Variance: Design

Recap: If you want to test H0 : µ = µ0 vs. H1 : µ 6= µ0 , and


(1) You know σ 2 ,
(2) You want P (Type I error) = α, and
(3) You want P (Type II error) = β when µ = µ1 (6= µ0 ),
.
then you have to take n = σ 2 (zα/2 + zβ )2 /δ 2 observations.

ISYE 6739 — Goldsman 3/2/20 33 / 115


Normal Mean Test with Known Variance: Design

Recap: If you want to test H0 : µ = µ0 vs. H1 : µ 6= µ0 , and


(1) You know σ 2 ,
(2) You want P (Type I error) = α, and
(3) You want P (Type II error) = β when µ = µ1 (6= µ0 ),
.
then you have to take n = σ 2 (zα/2 + zβ )2 /δ 2 observations.

Similarly, if you’re doing a one-sided test,

ISYE 6739 — Goldsman 3/2/20 33 / 115


Normal Mean Test with Known Variance: Design

Recap: If you want to test H0 : µ = µ0 vs. H1 : µ 6= µ0 , and


(1) You know σ 2 ,
(2) You want P (Type I error) = α, and
(3) You want P (Type II error) = β when µ = µ1 (6= µ0 ),
.
then you have to take n = σ 2 (zα/2 + zβ )2 /δ 2 observations.

Similarly, if you’re doing a one-sided test, it turns out that you need to take
.
n = σ 2 (zα + zβ )2 /δ 2 observations.

ISYE 6739 — Goldsman 3/2/20 33 / 115


Normal Mean Test with Known Variance: Design

Recap: If you want to test H0 : µ = µ0 vs. H1 : µ 6= µ0 , and


(1) You know σ 2 ,
(2) You want P (Type I error) = α, and
(3) You want P (Type II error) = β when µ = µ1 (6= µ0 ),
.
then you have to take n = σ 2 (zα/2 + zβ )2 /δ 2 observations.

Similarly, if you’re doing a one-sided test, it turns out that you need to take
.
n = σ 2 (zα + zβ )2 /δ 2 observations.

Example: Weights of 9-year-old kids are normal with σ = 4.

ISYE 6739 — Goldsman 3/2/20 33 / 115


Normal Mean Test with Known Variance: Design

Recap: If you want to test H0 : µ = µ0 vs. H1 : µ 6= µ0 , and


(1) You know σ 2 ,
(2) You want P (Type I error) = α, and
(3) You want P (Type II error) = β when µ = µ1 (6= µ0 ),
.
then you have to take n = σ 2 (zα/2 + zβ )2 /δ 2 observations.

Similarly, if you’re doing a one-sided test, it turns out that you need to take
.
n = σ 2 (zα + zβ )2 /δ 2 observations.

Example: Weights of 9-year-old kids are normal with σ = 4. How many


observations should we take if we wish to test H0 : µ = 60 vs. H1 : µ 6= 60,

ISYE 6739 — Goldsman 3/2/20 33 / 115


Normal Mean Test with Known Variance: Design

Recap: If you want to test H0 : µ = µ0 vs. H1 : µ 6= µ0 , and


(1) You know σ 2 ,
(2) You want P (Type I error) = α, and
(3) You want P (Type II error) = β when µ = µ1 (6= µ0 ),
.
then you have to take n = σ 2 (zα/2 + zβ )2 /δ 2 observations.

Similarly, if you’re doing a one-sided test, it turns out that you need to take
.
n = σ 2 (zα + zβ )2 /δ 2 observations.

Example: Weights of 9-year-old kids are normal with σ = 4. How many


observations should we take if we wish to test H0 : µ = 60 vs. H1 : µ 6= 60,
and we want α = 0.05 and β = 0.05, if µ happens to actually equal µ1 = 62?

ISYE 6739 — Goldsman 3/2/20 33 / 115


Normal Mean Test with Known Variance: Design

Recap: If you want to test H0 : µ = µ0 vs. H1 : µ 6= µ0 , and


(1) You know σ 2 ,
(2) You want P (Type I error) = α, and
(3) You want P (Type II error) = β when µ = µ1 (6= µ0 ),
.
then you have to take n = σ 2 (zα/2 + zβ )2 /δ 2 observations.

Similarly, if you’re doing a one-sided test, it turns out that you need to take
.
n = σ 2 (zα + zβ )2 /δ 2 observations.

Example: Weights of 9-year-old kids are normal with σ = 4. How many


observations should we take if we wish to test H0 : µ = 60 vs. H1 : µ 6= 60,
and we want α = 0.05 and β = 0.05, if µ happens to actually equal µ1 = 62?

. σ2
n = 2 (zα/2 + zβ )2
δ

ISYE 6739 — Goldsman 3/2/20 33 / 115


Normal Mean Test with Known Variance: Design

Recap: If you want to test H0 : µ = µ0 vs. H1 : µ 6= µ0 , and


(1) You know σ 2 ,
(2) You want P (Type I error) = α, and
(3) You want P (Type II error) = β when µ = µ1 (6= µ0 ),
.
then you have to take n = σ 2 (zα/2 + zβ )2 /δ 2 observations.

Similarly, if you’re doing a one-sided test, it turns out that you need to take
.
n = σ 2 (zα + zβ )2 /δ 2 observations.

Example: Weights of 9-year-old kids are normal with σ = 4. How many


observations should we take if we wish to test H0 : µ = 60 vs. H1 : µ 6= 60,
and we want α = 0.05 and β = 0.05, if µ happens to actually equal µ1 = 62?

. σ2 16
n = 2 (zα/2 + zβ )2 = (1.96 + 1.645)2 = 51.98.
δ 4

ISYE 6739 — Goldsman 3/2/20 33 / 115


Normal Mean Test with Known Variance: Design

Recap: If you want to test H0 : µ = µ0 vs. H1 : µ 6= µ0 , and


(1) You know σ 2 ,
(2) You want P (Type I error) = α, and
(3) You want P (Type II error) = β when µ = µ1 (6= µ0 ),
.
then you have to take n = σ 2 (zα/2 + zβ )2 /δ 2 observations.

Similarly, if you’re doing a one-sided test, it turns out that you need to take
.
n = σ 2 (zα + zβ )2 /δ 2 observations.

Example: Weights of 9-year-old kids are normal with σ = 4. How many


observations should we take if we wish to test H0 : µ = 60 vs. H1 : µ 6= 60,
and we want α = 0.05 and β = 0.05, if µ happens to actually equal µ1 = 62?

. σ2 16
n = 2 (zα/2 + zβ )2 = (1.96 + 1.645)2 = 51.98.
δ 4
In other words, we need about 52 observations. 2

ISYE 6739 — Goldsman 3/2/20 33 / 115


Two-Sample Normal Means Test with Known Variances

1 Introduction to Hypothesis Testing


2 The Errors of Our Ways
3 Normal Mean Test with Known Variance
4 Normal Mean Test with Known Variance: Design
5 Two-Sample Normal Means Test with Known Variances
6 Normal Mean Test with Unknown Variance
7 Two-Sample Normal Means Tests with Unknown Variances
8 Two-Sample Normal Means Test with Paired Observations
9 Normal Variance Test
10 Two-Sample Normal Variances Test
11 Bernoulli Proportion Test
12 Two-Sample Bernoulli Proportions Test
13 Goodness-of-Fit Tests: Introduction
14 Goodness-of-Fit Tests: Examples
15 Goodness-of-Fit Tests: Honors Example
ISYE 6739 — Goldsman 3/2/20 34 / 115
Two-Sample Normal Means Test with Known Variances

Lesson 7.5 — Two-Sample Normal Means Test with Known


Variances

ISYE 6739 — Goldsman 3/2/20 35 / 115


Two-Sample Normal Means Test with Known Variances

Lesson 7.5 — Two-Sample Normal Means Test with Known


Variances

Suppose we have the following set-up:

ISYE 6739 — Goldsman 3/2/20 35 / 115


Two-Sample Normal Means Test with Known Variances

Lesson 7.5 — Two-Sample Normal Means Test with Known


Variances

Suppose we have the following set-up:


iid
X1 , X2 , . . . , Xn ∼ Nor(µx , σx2 ) and

ISYE 6739 — Goldsman 3/2/20 35 / 115


Two-Sample Normal Means Test with Known Variances

Lesson 7.5 — Two-Sample Normal Means Test with Known


Variances

Suppose we have the following set-up:


iid
X1 , X2 , . . . , Xn ∼ Nor(µx , σx2 ) and
iid
Y1 , Y2 , . . . , Ym ∼ Nor(µy , σy2 ),

ISYE 6739 — Goldsman 3/2/20 35 / 115


Two-Sample Normal Means Test with Known Variances

Lesson 7.5 — Two-Sample Normal Means Test with Known


Variances

Suppose we have the following set-up:


iid
X1 , X2 , . . . , Xn ∼ Nor(µx , σx2 ) and
iid
Y1 , Y2 , . . . , Ym ∼ Nor(µy , σy2 ),
where the samples are independent of each other,

ISYE 6739 — Goldsman 3/2/20 35 / 115


Two-Sample Normal Means Test with Known Variances

Lesson 7.5 — Two-Sample Normal Means Test with Known


Variances

Suppose we have the following set-up:


iid
X1 , X2 , . . . , Xn ∼ Nor(µx , σx2 ) and
iid
Y1 , Y2 , . . . , Ym ∼ Nor(µy , σy2 ),
where the samples are independent of each other,
and σx2 and σy2 are somehow known.

ISYE 6739 — Goldsman 3/2/20 35 / 115


Two-Sample Normal Means Test with Known Variances

Lesson 7.5 — Two-Sample Normal Means Test with Known


Variances

Suppose we have the following set-up:


iid
X1 , X2 , . . . , Xn ∼ Nor(µx , σx2 ) and
iid
Y1 , Y2 , . . . , Ym ∼ Nor(µy , σy2 ),
where the samples are independent of each other,
and σx2 and σy2 are somehow known.

Which of the two populations has the larger mean?

ISYE 6739 — Goldsman 3/2/20 35 / 115


Two-Sample Normal Means Test with Known Variances

Lesson 7.5 — Two-Sample Normal Means Test with Known


Variances

Suppose we have the following set-up:


iid
X1 , X2 , . . . , Xn ∼ Nor(µx , σx2 ) and
iid
Y1 , Y2 , . . . , Ym ∼ Nor(µy , σy2 ),
where the samples are independent of each other,
and σx2 and σy2 are somehow known.

Which of the two populations has the larger mean?

Here’s the two-sided test to see if the means are different.

ISYE 6739 — Goldsman 3/2/20 35 / 115


Two-Sample Normal Means Test with Known Variances

Lesson 7.5 — Two-Sample Normal Means Test with Known


Variances

Suppose we have the following set-up:


iid
X1 , X2 , . . . , Xn ∼ Nor(µx , σx2 ) and
iid
Y1 , Y2 , . . . , Ym ∼ Nor(µy , σy2 ),
where the samples are independent of each other,
and σx2 and σy2 are somehow known.

Which of the two populations has the larger mean?

Here’s the two-sided test to see if the means are different.

H0 : µx = µy

ISYE 6739 — Goldsman 3/2/20 35 / 115


Two-Sample Normal Means Test with Known Variances

Lesson 7.5 — Two-Sample Normal Means Test with Known


Variances

Suppose we have the following set-up:


iid
X1 , X2 , . . . , Xn ∼ Nor(µx , σx2 ) and
iid
Y1 , Y2 , . . . , Ym ∼ Nor(µy , σy2 ),
where the samples are independent of each other,
and σx2 and σy2 are somehow known.

Which of the two populations has the larger mean?

Here’s the two-sided test to see if the means are different.

H0 : µx = µy
H1 : µx 6= µy

ISYE 6739 — Goldsman 3/2/20 35 / 115


Two-Sample Normal Means Test with Known Variances

Define the test statistic

ISYE 6739 — Goldsman 3/2/20 36 / 115


Two-Sample Normal Means Test with Known Variances

Define the test statistic


X̄ − Ȳ − (µx − µy )
Z0 = q .
σx2 σy2
n + m

ISYE 6739 — Goldsman 3/2/20 36 / 115


Two-Sample Normal Means Test with Known Variances

Define the test statistic


X̄ − Ȳ − (µx − µy )
Z0 = q .
σx2 σy2
n + m

If H0 is true (i.e., the means are equal), then

ISYE 6739 — Goldsman 3/2/20 36 / 115


Two-Sample Normal Means Test with Known Variances

Define the test statistic


X̄ − Ȳ − (µx − µy )
Z0 = q .
σx2 σy2
n + m

If H0 is true (i.e., the means are equal), then

X̄ − Ȳ
Z0 = q ∼ Nor(0, 1).
σx2 σy2
n + m

ISYE 6739 — Goldsman 3/2/20 36 / 115


Two-Sample Normal Means Test with Known Variances

Define the test statistic


X̄ − Ȳ − (µx − µy )
Z0 = q .
σx2 σy2
n + m

If H0 is true (i.e., the means are equal), then

X̄ − Ȳ
Z0 = q ∼ Nor(0, 1).
σx2 σy2
n + m

Thus, as before,

ISYE 6739 — Goldsman 3/2/20 36 / 115


Two-Sample Normal Means Test with Known Variances

Define the test statistic


X̄ − Ȳ − (µx − µy )
Z0 = q .
σx2 σy2
n + m

If H0 is true (i.e., the means are equal), then

X̄ − Ȳ
Z0 = q ∼ Nor(0, 1).
σx2 σy2
n + m

Thus, as before,

Reject H0 iff |Z0 | > zα/2 .

ISYE 6739 — Goldsman 3/2/20 36 / 115


Two-Sample Normal Means Test with Known Variances

Using more of the same reasoning as before, we get the following one-sided
tests:

ISYE 6739 — Goldsman 3/2/20 37 / 115


Two-Sample Normal Means Test with Known Variances

Using more of the same reasoning as before, we get the following one-sided
tests:

H0 : µx ≤ µy vs. H1 : µx > µy .

ISYE 6739 — Goldsman 3/2/20 37 / 115


Two-Sample Normal Means Test with Known Variances

Using more of the same reasoning as before, we get the following one-sided
tests:

H0 : µx ≤ µy vs. H1 : µx > µy .

Reject H0 iff Z0 > zα .

ISYE 6739 — Goldsman 3/2/20 37 / 115


Two-Sample Normal Means Test with Known Variances

Using more of the same reasoning as before, we get the following one-sided
tests:

H0 : µx ≤ µy vs. H1 : µx > µy .

Reject H0 iff Z0 > zα .

H0 : µx ≥ µy vs. H1 : µx < µy .

ISYE 6739 — Goldsman 3/2/20 37 / 115


Two-Sample Normal Means Test with Known Variances

Using more of the same reasoning as before, we get the following one-sided
tests:

H0 : µx ≤ µy vs. H1 : µx > µy .

Reject H0 iff Z0 > zα .

H0 : µx ≥ µy vs. H1 : µx < µy .

Reject H0 iff Z0 < −zα .

ISYE 6739 — Goldsman 3/2/20 37 / 115


Two-Sample Normal Means Test with Known Variances

Using more of the same reasoning as before, we get the following one-sided
tests:

H0 : µx ≤ µy vs. H1 : µx > µy .

Reject H0 iff Z0 > zα .

H0 : µx ≥ µy vs. H1 : µx < µy .

Reject H0 iff Z0 < −zα .

It’s so easy!!

ISYE 6739 — Goldsman 3/2/20 37 / 115


Two-Sample Normal Means Test with Known Variances

Example: Suppose we want to test H0 : µx = µy vs. H1 : µx 6= µy , and we


have the following data:

ISYE 6739 — Goldsman 3/2/20 38 / 115


Two-Sample Normal Means Test with Known Variances

Example: Suppose we want to test H0 : µx = µy vs. H1 : µx 6= µy , and we


have the following data:

n = 10, X̄ = 824.9, σx2 = 40

ISYE 6739 — Goldsman 3/2/20 38 / 115


Two-Sample Normal Means Test with Known Variances

Example: Suppose we want to test H0 : µx = µy vs. H1 : µx 6= µy , and we


have the following data:

n = 10, X̄ = 824.9, σx2 = 40


m = 10, Ȳ = 818.6, σy2 = 50,

ISYE 6739 — Goldsman 3/2/20 38 / 115


Two-Sample Normal Means Test with Known Variances

Example: Suppose we want to test H0 : µx = µy vs. H1 : µx 6= µy , and we


have the following data:

n = 10, X̄ = 824.9, σx2 = 40


m = 10, Ȳ = 818.6, σy2 = 50,

where the variances are somehow known.

ISYE 6739 — Goldsman 3/2/20 38 / 115


Two-Sample Normal Means Test with Known Variances

Example: Suppose we want to test H0 : µx = µy vs. H1 : µx 6= µy , and we


have the following data:

n = 10, X̄ = 824.9, σx2 = 40


m = 10, Ȳ = 818.6, σy2 = 50,

where the variances are somehow known.

Then
824.9 − 818.6
Z0 = q = 2.10.
40 50
10 + 10

ISYE 6739 — Goldsman 3/2/20 38 / 115


Two-Sample Normal Means Test with Known Variances

Example: Suppose we want to test H0 : µx = µy vs. H1 : µx 6= µy , and we


have the following data:

n = 10, X̄ = 824.9, σx2 = 40


m = 10, Ȳ = 818.6, σy2 = 50,

where the variances are somehow known.

Then
824.9 − 818.6
Z0 = q = 2.10.
40 50
10 + 10

If α = 0.05, then |Z0 | = 2.10 > zα/2 = 1.96,

ISYE 6739 — Goldsman 3/2/20 38 / 115


Two-Sample Normal Means Test with Known Variances

Example: Suppose we want to test H0 : µx = µy vs. H1 : µx 6= µy , and we


have the following data:

n = 10, X̄ = 824.9, σx2 = 40


m = 10, Ȳ = 818.6, σy2 = 50,

where the variances are somehow known.

Then
824.9 − 818.6
Z0 = q = 2.10.
40 50
10 + 10

If α = 0.05, then |Z0 | = 2.10 > zα/2 = 1.96, and so we reject H0 . 2

ISYE 6739 — Goldsman 3/2/20 38 / 115


Normal Mean Test with Unknown Variance

1 Introduction to Hypothesis Testing


2 The Errors of Our Ways
3 Normal Mean Test with Known Variance
4 Normal Mean Test with Known Variance: Design
5 Two-Sample Normal Means Test with Known Variances
6 Normal Mean Test with Unknown Variance
7 Two-Sample Normal Means Tests with Unknown Variances
8 Two-Sample Normal Means Test with Paired Observations
9 Normal Variance Test
10 Two-Sample Normal Variances Test
11 Bernoulli Proportion Test
12 Two-Sample Bernoulli Proportions Test
13 Goodness-of-Fit Tests: Introduction
14 Goodness-of-Fit Tests: Examples
15 Goodness-of-Fit Tests: Honors Example
ISYE 6739 — Goldsman 3/2/20 39 / 115
Normal Mean Test with Unknown Variance

Lesson 7.6 — Normal Mean Test with Unknown Variance

ISYE 6739 — Goldsman 3/2/20 40 / 115


Normal Mean Test with Unknown Variance

Lesson 7.6 — Normal Mean Test with Unknown Variance

The next few lessons deal with the unknown variance case.

ISYE 6739 — Goldsman 3/2/20 40 / 115


Normal Mean Test with Unknown Variance

Lesson 7.6 — Normal Mean Test with Unknown Variance

The next few lessons deal with the unknown variance case.
Test the mean of a single normal distribution (here).

ISYE 6739 — Goldsman 3/2/20 40 / 115


Normal Mean Test with Unknown Variance

Lesson 7.6 — Normal Mean Test with Unknown Variance

The next few lessons deal with the unknown variance case.
Test the mean of a single normal distribution (here).
Compare the means of two normal distributions when both variances are
unknown (the following three lessons deal with different subcases).

ISYE 6739 — Goldsman 3/2/20 40 / 115


Normal Mean Test with Unknown Variance

Lesson 7.6 — Normal Mean Test with Unknown Variance

The next few lessons deal with the unknown variance case.
Test the mean of a single normal distribution (here).
Compare the means of two normal distributions when both variances are
unknown (the following three lessons deal with different subcases).

Anyhow, it’s time for t again!

ISYE 6739 — Goldsman 3/2/20 40 / 115


Normal Mean Test with Unknown Variance

Lesson 7.6 — Normal Mean Test with Unknown Variance

The next few lessons deal with the unknown variance case.
Test the mean of a single normal distribution (here).
Compare the means of two normal distributions when both variances are
unknown (the following three lessons deal with different subcases).

Anyhow, it’s time for t again!

iid
Suppose X1 , . . . , Xn ∼ Nor(µ, σ 2 ),

ISYE 6739 — Goldsman 3/2/20 40 / 115


Normal Mean Test with Unknown Variance

Lesson 7.6 — Normal Mean Test with Unknown Variance

The next few lessons deal with the unknown variance case.
Test the mean of a single normal distribution (here).
Compare the means of two normal distributions when both variances are
unknown (the following three lessons deal with different subcases).

Anyhow, it’s time for t again!

iid
Suppose X1 , . . . , Xn ∼ Nor(µ, σ 2 ), where σ 2 is unknown.

ISYE 6739 — Goldsman 3/2/20 40 / 115


Normal Mean Test with Unknown Variance

Lesson 7.6 — Normal Mean Test with Unknown Variance

The next few lessons deal with the unknown variance case.
Test the mean of a single normal distribution (here).
Compare the means of two normal distributions when both variances are
unknown (the following three lessons deal with different subcases).

Anyhow, it’s time for t again!

iid
Suppose X1 , . . . , Xn ∼ Nor(µ, σ 2 ), where σ 2 is unknown.

Two-sided (aka simple) test for one normal population:

ISYE 6739 — Goldsman 3/2/20 40 / 115


Normal Mean Test with Unknown Variance

Lesson 7.6 — Normal Mean Test with Unknown Variance

The next few lessons deal with the unknown variance case.
Test the mean of a single normal distribution (here).
Compare the means of two normal distributions when both variances are
unknown (the following three lessons deal with different subcases).

Anyhow, it’s time for t again!

iid
Suppose X1 , . . . , Xn ∼ Nor(µ, σ 2 ), where σ 2 is unknown.

Two-sided (aka simple) test for one normal population:

H0 : µ = µ 0 vs. H1 : µ 6= µ0 .

ISYE 6739 — Goldsman 3/2/20 40 / 115


Normal Mean Test with Unknown Variance

Lesson 7.6 — Normal Mean Test with Unknown Variance

The next few lessons deal with the unknown variance case.
Test the mean of a single normal distribution (here).
Compare the means of two normal distributions when both variances are
unknown (the following three lessons deal with different subcases).

Anyhow, it’s time for t again!

iid
Suppose X1 , . . . , Xn ∼ Nor(µ, σ 2 ), where σ 2 is unknown.

Two-sided (aka simple) test for one normal population:

H0 : µ = µ 0 vs. H1 : µ 6= µ0 .

We’ll use X̄ to estimate µ.

ISYE 6739 — Goldsman 3/2/20 40 / 115


Normal Mean Test with Unknown Variance

Lesson 7.6 — Normal Mean Test with Unknown Variance

The next few lessons deal with the unknown variance case.
Test the mean of a single normal distribution (here).
Compare the means of two normal distributions when both variances are
unknown (the following three lessons deal with different subcases).

Anyhow, it’s time for t again!

iid
Suppose X1 , . . . , Xn ∼ Nor(µ, σ 2 ), where σ 2 is unknown.

Two-sided (aka simple) test for one normal population:

H0 : µ = µ 0 vs. H1 : µ 6= µ0 .

We’ll use X̄ to estimate µ. If X̄ is “significantly different” than µ0 , then we’ll


reject H0 .

ISYE 6739 — Goldsman 3/2/20 40 / 115


Normal Mean Test with Unknown Variance

Lesson 7.6 — Normal Mean Test with Unknown Variance

The next few lessons deal with the unknown variance case.
Test the mean of a single normal distribution (here).
Compare the means of two normal distributions when both variances are
unknown (the following three lessons deal with different subcases).

Anyhow, it’s time for t again!

iid
Suppose X1 , . . . , Xn ∼ Nor(µ, σ 2 ), where σ 2 is unknown.

Two-sided (aka simple) test for one normal population:

H0 : µ = µ 0 vs. H1 : µ 6= µ0 .

We’ll use X̄ to estimate µ. If X̄ is “significantly different” than µ0 , then we’ll


reject H0 . For this purpose, we’ll also need to estimate σ 2 .

ISYE 6739 — Goldsman 3/2/20 40 / 115


Normal Mean Test with Unknown Variance

Define the test statistic


X̄ − µ0
T0 ≡ √ ,
S/ n

ISYE 6739 — Goldsman 3/2/20 41 / 115


Normal Mean Test with Unknown Variance

Define the test statistic


X̄ − µ0
T0 ≡ √ ,
S/ n
where S 2 is our old friend, the sample variance,
n
1 X σ 2 χ2 (n − 1)
S2 ≡ (Xi − X̄)2 ∼ .
n−1 n−1
i=1

ISYE 6739 — Goldsman 3/2/20 41 / 115


Normal Mean Test with Unknown Variance

Define the test statistic


X̄ − µ0
T0 ≡ √ ,
S/ n
where S 2 is our old friend, the sample variance,
n
1 X σ 2 χ2 (n − 1)
S2 ≡ (Xi − X̄)2 ∼ .
n−1 n−1
i=1

If H0 is true, then

ISYE 6739 — Goldsman 3/2/20 41 / 115


Normal Mean Test with Unknown Variance

Define the test statistic


X̄ − µ0
T0 ≡ √ ,
S/ n
where S 2 is our old friend, the sample variance,
n
1 X σ 2 χ2 (n − 1)
S2 ≡ (Xi − X̄)2 ∼ .
n−1 n−1
i=1

If H0 is true, then

X̄−µ0

σ 2 /n
T0 = p
S 2 /σ 2

ISYE 6739 — Goldsman 3/2/20 41 / 115


Normal Mean Test with Unknown Variance

Define the test statistic


X̄ − µ0
T0 ≡ √ ,
S/ n
where S 2 is our old friend, the sample variance,
n
1 X σ 2 χ2 (n − 1)
S2 ≡ (Xi − X̄)2 ∼ .
n−1 n−1
i=1

If H0 is true, then

X̄−µ0

σ 2 /n Nor(0, 1)
T0 = p ∼ q 2 ∼ t(n − 1).
S 2 /σ 2 χ (n−1)
n−1

ISYE 6739 — Goldsman 3/2/20 41 / 115


Normal Mean Test with Unknown Variance

So the two-sided test is:

ISYE 6739 — Goldsman 3/2/20 42 / 115


Normal Mean Test with Unknown Variance

So the two-sided test is:

Reject H0 iff |T0 | > tα/2,n−1 .

ISYE 6739 — Goldsman 3/2/20 42 / 115


Normal Mean Test with Unknown Variance

So the two-sided test is:

Reject H0 iff |T0 | > tα/2,n−1 .

Using the same reasoning as in previous lessons, the one-sided tests are:

ISYE 6739 — Goldsman 3/2/20 42 / 115


Normal Mean Test with Unknown Variance

So the two-sided test is:

Reject H0 iff |T0 | > tα/2,n−1 .

Using the same reasoning as in previous lessons, the one-sided tests are:

H0 : µ ≤ µ0 vs. H1 : µ > µ0 .

ISYE 6739 — Goldsman 3/2/20 42 / 115


Normal Mean Test with Unknown Variance

So the two-sided test is:

Reject H0 iff |T0 | > tα/2,n−1 .

Using the same reasoning as in previous lessons, the one-sided tests are:

H0 : µ ≤ µ0 vs. H1 : µ > µ0 .

Reject H0 iff T0 > tα,n−1 .

ISYE 6739 — Goldsman 3/2/20 42 / 115


Normal Mean Test with Unknown Variance

So the two-sided test is:

Reject H0 iff |T0 | > tα/2,n−1 .

Using the same reasoning as in previous lessons, the one-sided tests are:

H0 : µ ≤ µ0 vs. H1 : µ > µ0 .

Reject H0 iff T0 > tα,n−1 .

H0 : µ ≥ µ0 vs. H1 : µ < µ0 .

ISYE 6739 — Goldsman 3/2/20 42 / 115


Normal Mean Test with Unknown Variance

So the two-sided test is:

Reject H0 iff |T0 | > tα/2,n−1 .

Using the same reasoning as in previous lessons, the one-sided tests are:

H0 : µ ≤ µ0 vs. H1 : µ > µ0 .

Reject H0 iff T0 > tα,n−1 .

H0 : µ ≥ µ0 vs. H1 : µ < µ0 .

Reject H0 iff T0 < −tα,n−1 .

ISYE 6739 — Goldsman 3/2/20 42 / 115


Normal Mean Test with Unknown Variance

Recall: The p-value of a test is the smallest level of significance α that


would lead to rejection of H0 .

ISYE 6739 — Goldsman 3/2/20 43 / 115


Normal Mean Test with Unknown Variance

Recall: The p-value of a test is the smallest level of significance α that


would lead to rejection of H0 .

For this two-sided normal mean test with unknown variance, we reject H0 iff

ISYE 6739 — Goldsman 3/2/20 43 / 115


Normal Mean Test with Unknown Variance

Recall: The p-value of a test is the smallest level of significance α that


would lead to rejection of H0 .

For this two-sided normal mean test with unknown variance, we reject H0 iff
−1
|T0 | > tα/2,n−1 = Fn−1 (1 − α/2),

ISYE 6739 — Goldsman 3/2/20 43 / 115


Normal Mean Test with Unknown Variance

Recall: The p-value of a test is the smallest level of significance α that


would lead to rejection of H0 .

For this two-sided normal mean test with unknown variance, we reject H0 iff
−1
|T0 | > tα/2,n−1 = Fn−1 (1 − α/2),
−1
where Fn−1 (t) is the cdf of the t(n − 1) distribution (and Fn−1 (·) is the
inverse).

ISYE 6739 — Goldsman 3/2/20 43 / 115


Normal Mean Test with Unknown Variance

Recall: The p-value of a test is the smallest level of significance α that


would lead to rejection of H0 .

For this two-sided normal mean test with unknown variance, we reject H0 iff
−1
|T0 | > tα/2,n−1 = Fn−1 (1 − α/2),
−1
where Fn−1 (t) is the cdf of the t(n − 1) distribution (and Fn−1 (·) is the
inverse). This relationship holds iff

Fn−1 (|T0 |) > 1 − α/2 iff α > 2 1 − Fn−1 (|T0 |) .

ISYE 6739 — Goldsman 3/2/20 43 / 115


Normal Mean Test with Unknown Variance

Recall: The p-value of a test is the smallest level of significance α that


would lead to rejection of H0 .

For this two-sided normal mean test with unknown variance, we reject H0 iff
−1
|T0 | > tα/2,n−1 = Fn−1 (1 − α/2),
−1
where Fn−1 (t) is the cdf of the t(n − 1) distribution (and Fn−1 (·) is the
inverse). This relationship holds iff

Fn−1 (|T0 |) > 1 − α/2 iff α > 2 1 − Fn−1 (|T0 |) .

Thus, for the two-sided test for the case of unknown variance,

H0 : µ = µ0 vs. H1 : µ 6= µ0 ,

ISYE 6739 — Goldsman 3/2/20 43 / 115


Normal Mean Test with Unknown Variance

Recall: The p-value of a test is the smallest level of significance α that


would lead to rejection of H0 .

For this two-sided normal mean test with unknown variance, we reject H0 iff
−1
|T0 | > tα/2,n−1 = Fn−1 (1 − α/2),
−1
where Fn−1 (t) is the cdf of the t(n − 1) distribution (and Fn−1 (·) is the
inverse). This relationship holds iff

Fn−1 (|T0 |) > 1 − α/2 iff α > 2 1 − Fn−1 (|T0 |) .

Thus, for the two-sided test for the case of unknown variance,

vs. H1 : µ 6= µ0 ,
H0 : µ = µ0

the p-value is p = 2 1 − Fn−1 (|T0 |) . 2




ISYE 6739 — Goldsman 3/2/20 43 / 115


Normal Mean Test with Unknown Variance

Example: Suppose we want to test at level 0.05 whether or not the mean of
some process is 150.

ISYE 6739 — Goldsman 3/2/20 44 / 115


Normal Mean Test with Unknown Variance

Example: Suppose we want to test at level 0.05 whether or not the mean of
some process is 150.

Data: n = 15, X̄ = 152.18, and S 2 = 16.63.

ISYE 6739 — Goldsman 3/2/20 44 / 115


Normal Mean Test with Unknown Variance

Example: Suppose we want to test at level 0.05 whether or not the mean of
some process is 150.

Data: n = 15, X̄ = 152.18, and S 2 = 16.63.

Then
X̄ − µ0
T0 ≡ √ = 2.07.
S/ n

ISYE 6739 — Goldsman 3/2/20 44 / 115


Normal Mean Test with Unknown Variance

Example: Suppose we want to test at level 0.05 whether or not the mean of
some process is 150.

Data: n = 15, X̄ = 152.18, and S 2 = 16.63.

Then
X̄ − µ0
T0 ≡ √ = 2.07.
S/ n

Let’s do a two-sided test at level α = 0.05.

ISYE 6739 — Goldsman 3/2/20 44 / 115


Normal Mean Test with Unknown Variance

Example: Suppose we want to test at level 0.05 whether or not the mean of
some process is 150.

Data: n = 15, X̄ = 152.18, and S 2 = 16.63.

Then
X̄ − µ0
T0 ≡ √ = 2.07.
S/ n

Let’s do a two-sided test at level α = 0.05. Since


|T0 | < tα/2,n−1 = t0.025,14 = 2.145,

ISYE 6739 — Goldsman 3/2/20 44 / 115


Normal Mean Test with Unknown Variance

Example: Suppose we want to test at level 0.05 whether or not the mean of
some process is 150.

Data: n = 15, X̄ = 152.18, and S 2 = 16.63.

Then
X̄ − µ0
T0 ≡ √ = 2.07.
S/ n

Let’s do a two-sided test at level α = 0.05. Since


|T0 | < tα/2,n−1 = t0.025,14 = 2.145, we (barely) fail to reject H0 .

ISYE 6739 — Goldsman 3/2/20 44 / 115


Normal Mean Test with Unknown Variance

Example: Suppose we want to test at level 0.05 whether or not the mean of
some process is 150.

Data: n = 15, X̄ = 152.18, and S 2 = 16.63.

Then
X̄ − µ0
T0 ≡ √ = 2.07.
S/ n

Let’s do a two-sided test at level α = 0.05. Since


|T0 | < tα/2,n−1 = t0.025,14 = 2.145, we (barely) fail to reject H0 .

Alternatively, note that the p-value is 2 1 − F14 (2.07) = 0.0574,

ISYE 6739 — Goldsman 3/2/20 44 / 115


Normal Mean Test with Unknown Variance

Example: Suppose we want to test at level 0.05 whether or not the mean of
some process is 150.

Data: n = 15, X̄ = 152.18, and S 2 = 16.63.

Then
X̄ − µ0
T0 ≡ √ = 2.07.
S/ n

Let’s do a two-sided test at level α = 0.05. Since


|T0 | < tα/2,n−1 = t0.025,14 = 2.145, we (barely) fail to reject H0 .

Alternatively, note that the p-value is 2 1 − F14 (2.07) = 0.0574, where the
Excel function T.DIST can be used to evaluate the cdf F14 (2.07).

ISYE 6739 — Goldsman 3/2/20 44 / 115


Normal Mean Test with Unknown Variance

Example: Suppose we want to test at level 0.05 whether or not the mean of
some process is 150.

Data: n = 15, X̄ = 152.18, and S 2 = 16.63.

Then
X̄ − µ0
T0 ≡ √ = 2.07.
S/ n

Let’s do a two-sided test at level α = 0.05. Since


|T0 | < tα/2,n−1 = t0.025,14 = 2.145, we (barely) fail to reject H0 .

Alternatively, note that the p-value is 2 1 − F14 (2.07) = 0.0574, where the
Excel function T.DIST can be used to evaluate the cdf F14 (2.07). Since
p = 0.0574 > 0.05 = α, we didn’t quite reject. 2

ISYE 6739 — Goldsman 3/2/20 44 / 115


Two-Sample Normal Means Tests with Unknown Variances

1 Introduction to Hypothesis Testing


2 The Errors of Our Ways
3 Normal Mean Test with Known Variance
4 Normal Mean Test with Known Variance: Design
5 Two-Sample Normal Means Test with Known Variances
6 Normal Mean Test with Unknown Variance
7 Two-Sample Normal Means Tests with Unknown Variances
8 Two-Sample Normal Means Test with Paired Observations
9 Normal Variance Test
10 Two-Sample Normal Variances Test
11 Bernoulli Proportion Test
12 Two-Sample Bernoulli Proportions Test
13 Goodness-of-Fit Tests: Introduction
14 Goodness-of-Fit Tests: Examples
15 Goodness-of-Fit Tests: Honors Example
ISYE 6739 — Goldsman 3/2/20 45 / 115
Two-Sample Normal Means Tests with Unknown Variances

Lesson 7.7 — Two-Sample Normal Means Tests with Unknown


Variances

ISYE 6739 — Goldsman 3/2/20 46 / 115


Two-Sample Normal Means Tests with Unknown Variances

Lesson 7.7 — Two-Sample Normal Means Tests with Unknown


Variances
Suppose we have the following set-up:

ISYE 6739 — Goldsman 3/2/20 46 / 115


Two-Sample Normal Means Tests with Unknown Variances

Lesson 7.7 — Two-Sample Normal Means Tests with Unknown


Variances
Suppose we have the following set-up:
iid
X1 , X2 , . . . , Xn ∼ Nor(µx , σx2 )
iid
Y1 , Y2 , . . . , Ym ∼ Nor(µy , σy2 ),

where the samples are independent of each other, and σx2 and σy2 are unknown.

ISYE 6739 — Goldsman 3/2/20 46 / 115


Two-Sample Normal Means Tests with Unknown Variances

Lesson 7.7 — Two-Sample Normal Means Tests with Unknown


Variances
Suppose we have the following set-up:
iid
X1 , X2 , . . . , Xn ∼ Nor(µx , σx2 )
iid
Y1 , Y2 , . . . , Ym ∼ Nor(µy , σy2 ),

where the samples are independent of each other, and σx2 and σy2 are unknown.

Which population has the larger mean?

ISYE 6739 — Goldsman 3/2/20 46 / 115


Two-Sample Normal Means Tests with Unknown Variances

Lesson 7.7 — Two-Sample Normal Means Tests with Unknown


Variances
Suppose we have the following set-up:
iid
X1 , X2 , . . . , Xn ∼ Nor(µx , σx2 )
iid
Y1 , Y2 , . . . , Ym ∼ Nor(µy , σy2 ),

where the samples are independent of each other, and σx2 and σy2 are unknown.

Which population has the larger mean?

We’ll look at three cases:

ISYE 6739 — Goldsman 3/2/20 46 / 115


Two-Sample Normal Means Tests with Unknown Variances

Lesson 7.7 — Two-Sample Normal Means Tests with Unknown


Variances
Suppose we have the following set-up:
iid
X1 , X2 , . . . , Xn ∼ Nor(µx , σx2 )
iid
Y1 , Y2 , . . . , Ym ∼ Nor(µy , σy2 ),

where the samples are independent of each other, and σx2 and σy2 are unknown.

Which population has the larger mean?

We’ll look at three cases:

Pooled t-test: σx2 = σy2 = σ 2 (next, this lesson).

ISYE 6739 — Goldsman 3/2/20 46 / 115


Two-Sample Normal Means Tests with Unknown Variances

Lesson 7.7 — Two-Sample Normal Means Tests with Unknown


Variances
Suppose we have the following set-up:
iid
X1 , X2 , . . . , Xn ∼ Nor(µx , σx2 )
iid
Y1 , Y2 , . . . , Ym ∼ Nor(µy , σy2 ),

where the samples are independent of each other, and σx2 and σy2 are unknown.

Which population has the larger mean?

We’ll look at three cases:

Pooled t-test: σx2 = σy2 = σ 2 (next, this lesson).

Approximate t-test: σx2 6= σy2 (later, this lesson).

ISYE 6739 — Goldsman 3/2/20 46 / 115


Two-Sample Normal Means Tests with Unknown Variances

Lesson 7.7 — Two-Sample Normal Means Tests with Unknown


Variances
Suppose we have the following set-up:
iid
X1 , X2 , . . . , Xn ∼ Nor(µx , σx2 )
iid
Y1 , Y2 , . . . , Ym ∼ Nor(µy , σy2 ),

where the samples are independent of each other, and σx2 and σy2 are unknown.

Which population has the larger mean?

We’ll look at three cases:

Pooled t-test: σx2 = σy2 = σ 2 (next, this lesson).

Approximate t-test: σx2 6= σy2 (later, this lesson).

Paired t-test: (Xi , Yi ) observations paired (next lesson).


ISYE 6739 — Goldsman 3/2/20 46 / 115
Two-Sample Normal Means Tests with Unknown Variances

Pooled t-Test

ISYE 6739 — Goldsman 3/2/20 47 / 115


Two-Sample Normal Means Tests with Unknown Variances

Pooled t-Test

Suppose that σx2 = σy2 = σ 2 (unknown).

ISYE 6739 — Goldsman 3/2/20 47 / 115


Two-Sample Normal Means Tests with Unknown Variances

Pooled t-Test

Suppose that σx2 = σy2 = σ 2 (unknown).

Consider the two-sided test to see if the means are different,


H0 : µx = µ y vs. H1 : µx 6= µy .

ISYE 6739 — Goldsman 3/2/20 47 / 115


Two-Sample Normal Means Tests with Unknown Variances

Pooled t-Test

Suppose that σx2 = σy2 = σ 2 (unknown).

Consider the two-sided test to see if the means are different,


H0 : µx = µ y vs. H1 : µx 6= µy .
Sample means and variances from the two populations,
n m
1X 1 X
X̄ ≡ Xi and Ȳ ≡ Yi
n m
i=1 i=1
n m
1 X 1 X
Sx2 = (Xi − X̄)2 and Sy2 = (Yi − Ȳ )2 .
n−1 m−1
i=1 i=1

ISYE 6739 — Goldsman 3/2/20 47 / 115


Two-Sample Normal Means Tests with Unknown Variances

Pooled t-Test

Suppose that σx2 = σy2 = σ 2 (unknown).

Consider the two-sided test to see if the means are different,


H0 : µx = µ y vs. H1 : µx 6= µy .
Sample means and variances from the two populations,
n m
1X 1 X
X̄ ≡ Xi and Ȳ ≡ Yi
n m
i=1 i=1
n m
1 X 1 X
Sx2 = (Xi − X̄)2 and Sy2 = (Yi − Ȳ )2 .
n−1 m−1
i=1 i=1
As in the previous module, define the pooled variance estimator by
(n − 1)Sx2 + (m − 1)Sy2
Sp2 ≡ .
n+m−2
ISYE 6739 — Goldsman 3/2/20 47 / 115
Two-Sample Normal Means Tests with Unknown Variances

If H0 is true, it can be shown that

σ 2 χ2 (n + m − 2)
Sp2 ∼ ,
n+m−2

ISYE 6739 — Goldsman 3/2/20 48 / 115


Two-Sample Normal Means Tests with Unknown Variances

If H0 is true, it can be shown that

σ 2 χ2 (n + m − 2)
Sp2 ∼ ,
n+m−2
and then the test statistic
X̄ − Ȳ
T0 ≡ q ∼ t(n + m − 2).
Sp n1 + 1
m

ISYE 6739 — Goldsman 3/2/20 48 / 115


Two-Sample Normal Means Tests with Unknown Variances

If H0 is true, it can be shown that

σ 2 χ2 (n + m − 2)
Sp2 ∼ ,
n+m−2
and then the test statistic
X̄ − Ȳ
T0 ≡ q ∼ t(n + m − 2).
Sp n1 + 1
m

Thus,
Reject H0 iff |T0 | > tα/2,n+m−2 .

ISYE 6739 — Goldsman 3/2/20 48 / 115


Two-Sample Normal Means Tests with Unknown Variances

One-Sided Tests:

ISYE 6739 — Goldsman 3/2/20 49 / 115


Two-Sample Normal Means Tests with Unknown Variances

One-Sided Tests:
H0 : µx ≤ µy vs. H1 : µx > µy .

ISYE 6739 — Goldsman 3/2/20 49 / 115


Two-Sample Normal Means Tests with Unknown Variances

One-Sided Tests:
H0 : µx ≤ µy vs. H1 : µx > µy .

Reject H0 iff T0 > tα,n+m−2 .

ISYE 6739 — Goldsman 3/2/20 49 / 115


Two-Sample Normal Means Tests with Unknown Variances

One-Sided Tests:
H0 : µx ≤ µy vs. H1 : µx > µy .

Reject H0 iff T0 > tα,n+m−2 .

H0 : µx ≥ µy vs. H1 : µx < µy .

ISYE 6739 — Goldsman 3/2/20 49 / 115


Two-Sample Normal Means Tests with Unknown Variances

One-Sided Tests:
H0 : µx ≤ µy vs. H1 : µx > µy .

Reject H0 iff T0 > tα,n+m−2 .

H0 : µx ≥ µy vs. H1 : µx < µy .

Reject H0 iff T0 < −tα,n+m−2 .

ISYE 6739 — Goldsman 3/2/20 49 / 115


Two-Sample Normal Means Tests with Unknown Variances

One-Sided Tests:
H0 : µx ≤ µy vs. H1 : µx > µy .

Reject H0 iff T0 > tα,n+m−2 .

H0 : µx ≥ µy vs. H1 : µx < µy .

Reject H0 iff T0 < −tα,n+m−2 .

Example: Catalyst X is currently used by a certain chemical process.


If catalyst Y gives higher mean yield, we’ll use it instead.

ISYE 6739 — Goldsman 3/2/20 49 / 115


Two-Sample Normal Means Tests with Unknown Variances

One-Sided Tests:
H0 : µx ≤ µy vs. H1 : µx > µy .

Reject H0 iff T0 > tα,n+m−2 .

H0 : µx ≥ µy vs. H1 : µx < µy .

Reject H0 iff T0 < −tα,n+m−2 .

Example: Catalyst X is currently used by a certain chemical process.


If catalyst Y gives higher mean yield, we’ll use it instead.

Thus, we want to test H0 : µx ≥ µy vs. H1 : µx < µy .

ISYE 6739 — Goldsman 3/2/20 49 / 115


Two-Sample Normal Means Tests with Unknown Variances

One-Sided Tests:
H0 : µx ≤ µy vs. H1 : µx > µy .

Reject H0 iff T0 > tα,n+m−2 .

H0 : µx ≥ µy vs. H1 : µx < µy .

Reject H0 iff T0 < −tα,n+m−2 .

Example: Catalyst X is currently used by a certain chemical process.


If catalyst Y gives higher mean yield, we’ll use it instead.

Thus, we want to test H0 : µx ≥ µy vs. H1 : µx < µy .

Suppose we have the following data:


n = 8, X̄ = 91.73, Sx2 = 3.89
m = 8, Ȳ = 93.75, Sy2 = 4.02.
ISYE 6739 — Goldsman 3/2/20 49 / 115
Two-Sample Normal Means Tests with Unknown Variances

.
Sx2 is pretty close to Sy2 , so we’ll assume σx2 = σy2 .

ISYE 6739 — Goldsman 3/2/20 50 / 115


Two-Sample Normal Means Tests with Unknown Variances

.
Sx2 is pretty close to Sy2 , so we’ll assume σx2 = σy2 .

This justifies the use of the pooled variance estimator

(n − 1)Sx2 + (m − 1)Sy2
Sp2 = = 3.955,
n+m−2

ISYE 6739 — Goldsman 3/2/20 50 / 115


Two-Sample Normal Means Tests with Unknown Variances

.
Sx2 is pretty close to Sy2 , so we’ll assume σx2 = σy2 .

This justifies the use of the pooled variance estimator

(n − 1)Sx2 + (m − 1)Sy2
Sp2 = = 3.955,
n+m−2
so that
X̄ − Ȳ
T0 = q = −2.03.
Sp n1 + 1
m

ISYE 6739 — Goldsman 3/2/20 50 / 115


Two-Sample Normal Means Tests with Unknown Variances

.
Sx2 is pretty close to Sy2 , so we’ll assume σx2 = σy2 .

This justifies the use of the pooled variance estimator

(n − 1)Sx2 + (m − 1)Sy2
Sp2 = = 3.955,
n+m−2
so that
X̄ − Ȳ
T0 = q = −2.03.
Sp n1 + 1
m

Let’s test at level α = 0.05. Then

tα,n+m−2 = t0.05,14 = 1.761.

ISYE 6739 — Goldsman 3/2/20 50 / 115


Two-Sample Normal Means Tests with Unknown Variances

.
Sx2 is pretty close to Sy2 , so we’ll assume σx2 = σy2 .

This justifies the use of the pooled variance estimator

(n − 1)Sx2 + (m − 1)Sy2
Sp2 = = 3.955,
n+m−2
so that
X̄ − Ȳ
T0 = q = −2.03.
Sp n1 + 1
m

Let’s test at level α = 0.05. Then

tα,n+m−2 = t0.05,14 = 1.761.

Since T0 < −tα,n+m−2 , we reject H0 .

ISYE 6739 — Goldsman 3/2/20 50 / 115


Two-Sample Normal Means Tests with Unknown Variances

.
Sx2 is pretty close to Sy2 , so we’ll assume σx2 = σy2 .

This justifies the use of the pooled variance estimator

(n − 1)Sx2 + (m − 1)Sy2
Sp2 = = 3.955,
n+m−2
so that
X̄ − Ȳ
T0 = q = −2.03.
Sp n1 + 1
m

Let’s test at level α = 0.05. Then

tα,n+m−2 = t0.05,14 = 1.761.

Since T0 < −tα,n+m−2 , we reject H0 .

Thus, we should probably use catalyst Y. 2

ISYE 6739 — Goldsman 3/2/20 50 / 115


Two-Sample Normal Means Tests with Unknown Variances

Approximate t-Test

ISYE 6739 — Goldsman 3/2/20 51 / 115


Two-Sample Normal Means Tests with Unknown Variances

Approximate t-Test

Suppose that σx2 6= σy2 (both unknown).

ISYE 6739 — Goldsman 3/2/20 51 / 115


Two-Sample Normal Means Tests with Unknown Variances

Approximate t-Test

Suppose that σx2 6= σy2 (both unknown). As with our work with CIs, define

X̄ − Ȳ
T0? ≡ q ≈ t(ν) (if H0 true),
Sx2 Sy2
n + m

ISYE 6739 — Goldsman 3/2/20 51 / 115


Two-Sample Normal Means Tests with Unknown Variances

Approximate t-Test

Suppose that σx2 6= σy2 (both unknown). As with our work with CIs, define

X̄ − Ȳ
T0? ≡ q ≈ t(ν) (if H0 true),
Sx2 Sy2
n + m

where the approximate degrees of freedom is given by


2
Sy2

Sx2
n + m
ν ≡ (Sy2 /m)2
.
(Sx2 /n)2
n−1 + m−1

ISYE 6739 — Goldsman 3/2/20 51 / 115


Two-Sample Normal Means Tests with Unknown Variances

Approximate t-Test

Suppose that σx2 6= σy2 (both unknown). As with our work with CIs, define

X̄ − Ȳ
T0? ≡ q ≈ t(ν) (if H0 true),
Sx2 Sy2
n + m

where the approximate degrees of freedom is given by


2
Sy2

Sx2
n + m
ν ≡ (Sy2 /m)2
.
(Sx2 /n)2
n−1 + m−1

The following table summarizes how to carry out the various two- and
one-sided tests.

ISYE 6739 — Goldsman 3/2/20 51 / 115


Two-Sample Normal Means Tests with Unknown Variances

two-sided H0 : µx = µy Reject H0 iff |T0? | > tα/2,ν


H1 : µx 6= µy

ISYE 6739 — Goldsman 3/2/20 52 / 115


Two-Sample Normal Means Tests with Unknown Variances

two-sided H0 : µx = µy Reject H0 iff |T0? | > tα/2,ν


H1 : µx 6= µy

one-sided H0 : µx ≤ µy Reject H0 iff T0? > tα,ν


H1 : µx > µy

ISYE 6739 — Goldsman 3/2/20 52 / 115


Two-Sample Normal Means Tests with Unknown Variances

two-sided H0 : µx = µy Reject H0 iff |T0? | > tα/2,ν


H1 : µx 6= µy

one-sided H0 : µx ≤ µy Reject H0 iff T0? > tα,ν


H1 : µx > µy

one-sided H0 : µx ≥ µy Reject H0 iff T0? < −tα,ν


H1 : µx < µy

ISYE 6739 — Goldsman 3/2/20 52 / 115


Two-Sample Normal Means Tests with Unknown Variances

Example: Let’s test H0 : µx = µy vs. H1 : µx 6= µy at level α = 0.10.

ISYE 6739 — Goldsman 3/2/20 53 / 115


Two-Sample Normal Means Tests with Unknown Variances

Example: Let’s test H0 : µx = µy vs. H1 : µx 6= µy at level α = 0.10.

Suppose we have the following data:

ISYE 6739 — Goldsman 3/2/20 53 / 115


Two-Sample Normal Means Tests with Unknown Variances

Example: Let’s test H0 : µx = µy vs. H1 : µx 6= µy at level α = 0.10.

Suppose we have the following data:

n = 15, X̄ = 24.2, Sx2 = 10

m = 10, Ȳ = 23.9, Sy2 = 20.

ISYE 6739 — Goldsman 3/2/20 53 / 115


Two-Sample Normal Means Tests with Unknown Variances

Example: Let’s test H0 : µx = µy vs. H1 : µx 6= µy at level α = 0.10.

Suppose we have the following data:

n = 15, X̄ = 24.2, Sx2 = 10

m = 10, Ȳ = 23.9, Sy2 = 20.


Sx2 isn’t very close to Sy2 , so we’ll assume σx2 6= σy2 .

ISYE 6739 — Goldsman 3/2/20 53 / 115


Two-Sample Normal Means Tests with Unknown Variances

Example: Let’s test H0 : µx = µy vs. H1 : µx 6= µy at level α = 0.10.

Suppose we have the following data:

n = 15, X̄ = 24.2, Sx2 = 10

m = 10, Ȳ = 23.9, Sy2 = 20.


Sx2 isn’t very close to Sy2 , so we’ll assume σx2 6= σy2 .

Plug-and-chug to get

T0? = 0.184,

ISYE 6739 — Goldsman 3/2/20 53 / 115


Two-Sample Normal Means Tests with Unknown Variances

Example: Let’s test H0 : µx = µy vs. H1 : µx 6= µy at level α = 0.10.

Suppose we have the following data:

n = 15, X̄ = 24.2, Sx2 = 10

m = 10, Ȳ = 23.9, Sy2 = 20.


Sx2 isn’t very close to Sy2 , so we’ll assume σx2 6= σy2 .

Plug-and-chug to get
.
T0? = 0.184, ν = 14.9 = 15,

ISYE 6739 — Goldsman 3/2/20 53 / 115


Two-Sample Normal Means Tests with Unknown Variances

Example: Let’s test H0 : µx = µy vs. H1 : µx 6= µy at level α = 0.10.

Suppose we have the following data:

n = 15, X̄ = 24.2, Sx2 = 10

m = 10, Ȳ = 23.9, Sy2 = 20.


Sx2 isn’t very close to Sy2 , so we’ll assume σx2 6= σy2 .

Plug-and-chug to get
.
T0? = 0.184, ν = 14.9 = 15, and tα/2,ν = t0.05,15 = 1.753.

ISYE 6739 — Goldsman 3/2/20 53 / 115


Two-Sample Normal Means Tests with Unknown Variances

Example: Let’s test H0 : µx = µy vs. H1 : µx 6= µy at level α = 0.10.

Suppose we have the following data:

n = 15, X̄ = 24.2, Sx2 = 10

m = 10, Ȳ = 23.9, Sy2 = 20.


Sx2 isn’t very close to Sy2 , so we’ll assume σx2 6= σy2 .

Plug-and-chug to get
.
T0? = 0.184, ν = 14.9 = 15, and tα/2,ν = t0.05,15 = 1.753.

Since |T0? | < tα/2,ν , we fail to reject (i.e., grudgingly accept) H0 .

ISYE 6739 — Goldsman 3/2/20 53 / 115


Two-Sample Normal Means Tests with Unknown Variances

Example: Let’s test H0 : µx = µy vs. H1 : µx 6= µy at level α = 0.10.

Suppose we have the following data:

n = 15, X̄ = 24.2, Sx2 = 10

m = 10, Ȳ = 23.9, Sy2 = 20.


Sx2 isn’t very close to Sy2 , so we’ll assume σx2 6= σy2 .

Plug-and-chug to get
.
T0? = 0.184, ν = 14.9 = 15, and tα/2,ν = t0.05,15 = 1.753.

Since |T0? | < tα/2,ν , we fail to reject (i.e., grudgingly accept) H0 .


Actually, since T0? was so close to 0, we didn’t really need the tables. 2

ISYE 6739 — Goldsman 3/2/20 53 / 115


Two-Sample Normal Means Test with Paired Observations

1 Introduction to Hypothesis Testing


2 The Errors of Our Ways
3 Normal Mean Test with Known Variance
4 Normal Mean Test with Known Variance: Design
5 Two-Sample Normal Means Test with Known Variances
6 Normal Mean Test with Unknown Variance
7 Two-Sample Normal Means Tests with Unknown Variances
8 Two-Sample Normal Means Test with Paired Observations
9 Normal Variance Test
10 Two-Sample Normal Variances Test
11 Bernoulli Proportion Test
12 Two-Sample Bernoulli Proportions Test
13 Goodness-of-Fit Tests: Introduction
14 Goodness-of-Fit Tests: Examples
15 Goodness-of-Fit Tests: Honors Example
ISYE 6739 — Goldsman 3/2/20 54 / 115
Two-Sample Normal Means Test with Paired Observations

Lesson 7.8 — Two-Sample Normal Means Test with Paired


Observations

ISYE 6739 — Goldsman 3/2/20 55 / 115


Two-Sample Normal Means Test with Paired Observations

Lesson 7.8 — Two-Sample Normal Means Test with Paired


Observations
Again consider two competing normal populations.

ISYE 6739 — Goldsman 3/2/20 55 / 115


Two-Sample Normal Means Test with Paired Observations

Lesson 7.8 — Two-Sample Normal Means Test with Paired


Observations
Again consider two competing normal populations. Suppose we collect
observations from the two populations in pairs.

ISYE 6739 — Goldsman 3/2/20 55 / 115


Two-Sample Normal Means Test with Paired Observations

Lesson 7.8 — Two-Sample Normal Means Test with Paired


Observations
Again consider two competing normal populations. Suppose we collect
observations from the two populations in pairs.

The RV’s between different pairs are independent.

ISYE 6739 — Goldsman 3/2/20 55 / 115


Two-Sample Normal Means Test with Paired Observations

Lesson 7.8 — Two-Sample Normal Means Test with Paired


Observations
Again consider two competing normal populations. Suppose we collect
observations from the two populations in pairs.

The RV’s between different pairs are independent. The two observations
within the same pair may not be independent —

ISYE 6739 — Goldsman 3/2/20 55 / 115


Two-Sample Normal Means Test with Paired Observations

Lesson 7.8 — Two-Sample Normal Means Test with Paired


Observations
Again consider two competing normal populations. Suppose we collect
observations from the two populations in pairs.

The RV’s between different pairs are independent. The two observations
within the same pair may not be independent — in fact, it’s often good for
them to be positively correlated (as explained in the previous module)!

ISYE 6739 — Goldsman 3/2/20 55 / 115


Two-Sample Normal Means Test with Paired Observations

Lesson 7.8 — Two-Sample Normal Means Test with Paired


Observations
Again consider two competing normal populations. Suppose we collect
observations from the two populations in pairs.

The RV’s between different pairs are independent. The two observations
within the same pair may not be independent — in fact, it’s often good for
them to be positively correlated (as explained in the previous module)!

Example: One twin takes a new drug, the other takes a placebo.

ISYE 6739 — Goldsman 3/2/20 55 / 115


Two-Sample Normal Means Test with Paired Observations

Lesson 7.8 — Two-Sample Normal Means Test with Paired


Observations
Again consider two competing normal populations. Suppose we collect
observations from the two populations in pairs.

The RV’s between different pairs are independent. The two observations
within the same pair may not be independent — in fact, it’s often good for
them to be positively correlated (as explained in the previous module)!

Example: One twin takes a new drug, the other takes a placebo.

 Pair 1 : (X1 , Y1 )







independent







ISYE 6739 — Goldsman 3/2/20 55 / 115


Two-Sample Normal Means Test with Paired Observations

Lesson 7.8 — Two-Sample Normal Means Test with Paired


Observations
Again consider two competing normal populations. Suppose we collect
observations from the two populations in pairs.

The RV’s between different pairs are independent. The two observations
within the same pair may not be independent — in fact, it’s often good for
them to be positively correlated (as explained in the previous module)!

Example: One twin takes a new drug, the other takes a placebo.

 Pair 1 : (X1 , Y1 )





 Pair 2 : (X2 , Y2 )

independent







ISYE 6739 — Goldsman 3/2/20 55 / 115


Two-Sample Normal Means Test with Paired Observations

Lesson 7.8 — Two-Sample Normal Means Test with Paired


Observations
Again consider two competing normal populations. Suppose we collect
observations from the two populations in pairs.

The RV’s between different pairs are independent. The two observations
within the same pair may not be independent — in fact, it’s often good for
them to be positively correlated (as explained in the previous module)!

Example: One twin takes a new drug, the other takes a placebo.

 Pair 1 : (X1 , Y1 )





 Pair 2 : (X2 , Y2 )
.. ..

independent . .





 Pair n : (Xn , Yn )

 | {z }
not indep
ISYE 6739 — Goldsman 3/2/20 55 / 115
Two-Sample Normal Means Test with Paired Observations

Define the pair-wise differences,

ISYE 6739 — Goldsman 3/2/20 56 / 115


Two-Sample Normal Means Test with Paired Observations

Define the pair-wise differences,

Di ≡ Xi − Yi , i = 1, 2, . . . , n.

ISYE 6739 — Goldsman 3/2/20 56 / 115


Two-Sample Normal Means Test with Paired Observations

Define the pair-wise differences,

Di ≡ Xi − Yi , i = 1, 2, . . . , n.
iid
Note that D1 , D2 , . . . , Dn ∼ Nor(µd , σd2 ),

ISYE 6739 — Goldsman 3/2/20 56 / 115


Two-Sample Normal Means Test with Paired Observations

Define the pair-wise differences,

Di ≡ Xi − Yi , i = 1, 2, . . . , n.
iid
Note that D1 , D2 , . . . , Dn ∼ Nor(µd , σd2 ), where

µd ≡ µ x − µy

ISYE 6739 — Goldsman 3/2/20 56 / 115


Two-Sample Normal Means Test with Paired Observations

Define the pair-wise differences,

Di ≡ Xi − Yi , i = 1, 2, . . . , n.
iid
Note that D1 , D2 , . . . , Dn ∼ Nor(µd , σd2 ), where

µd ≡ µ x − µy and σd2 ≡ σx2 + σy2 − 2Cov(Xi , Yi ).

ISYE 6739 — Goldsman 3/2/20 56 / 115


Two-Sample Normal Means Test with Paired Observations

Define the pair-wise differences,

Di ≡ Xi − Yi , i = 1, 2, . . . , n.
iid
Note that D1 , D2 , . . . , Dn ∼ Nor(µd , σd2 ), where

µd ≡ µ x − µy and σd2 ≡ σx2 + σy2 − 2Cov(Xi , Yi ).

Define the sample mean and variance of the differences,


n
X
D̄ ≡ Di /n ∼ Nor(µd , σd2 /n)
i=1
n
1 X σ 2 χ2 (n − 1)
Sd2 ≡ (Di − D̄)2 ∼ d .
n−1 n−1
i=1

ISYE 6739 — Goldsman 3/2/20 56 / 115


Two-Sample Normal Means Test with Paired Observations

Then the test statistic is (assuming µd = µx − µy = 0)

ISYE 6739 — Goldsman 3/2/20 57 / 115


Two-Sample Normal Means Test with Paired Observations

Then the test statistic is (assuming µd = µx − µy = 0)


T0 ≡ q ∼ t(n − 1).
Sd2 /n

ISYE 6739 — Goldsman 3/2/20 57 / 115


Two-Sample Normal Means Test with Paired Observations

Then the test statistic is (assuming µd = µx − µy = 0)


T0 ≡ q ∼ t(n − 1).
Sd2 /n

Using the exact same manipulations as in the single-sample normal mean


problem with unknown variance, we get the following. . . .

ISYE 6739 — Goldsman 3/2/20 57 / 115


Two-Sample Normal Means Test with Paired Observations

Then the test statistic is (assuming µd = µx − µy = 0)


T0 ≡ q ∼ t(n − 1).
Sd2 /n

Using the exact same manipulations as in the single-sample normal mean


problem with unknown variance, we get the following. . . .

two-sided H0 : µd = 0 Reject H0 iff |T0 | > tα/2,n−1


H1 : µd 6= 0

ISYE 6739 — Goldsman 3/2/20 57 / 115


Two-Sample Normal Means Test with Paired Observations

Then the test statistic is (assuming µd = µx − µy = 0)


T0 ≡ q ∼ t(n − 1).
Sd2 /n

Using the exact same manipulations as in the single-sample normal mean


problem with unknown variance, we get the following. . . .

two-sided H0 : µd = 0 Reject H0 iff |T0 | > tα/2,n−1


H1 : µd 6= 0
one-sided H0 : µd ≤ 0 Reject H0 iff T0 > tα,n−1
H1 : µd > 0

ISYE 6739 — Goldsman 3/2/20 57 / 115


Two-Sample Normal Means Test with Paired Observations

Then the test statistic is (assuming µd = µx − µy = 0)


T0 ≡ q ∼ t(n − 1).
Sd2 /n

Using the exact same manipulations as in the single-sample normal mean


problem with unknown variance, we get the following. . . .

two-sided H0 : µd = 0 Reject H0 iff |T0 | > tα/2,n−1


H1 : µd 6= 0
one-sided H0 : µd ≤ 0 Reject H0 iff T0 > tα,n−1
H1 : µd > 0
one-sided H0 : µd ≥ 0 Reject H0 iff T0 < −tα,n−1
H1 : µd < 0

ISYE 6739 — Goldsman 3/2/20 57 / 115


Two-Sample Normal Means Test with Paired Observations

Example: Times for (the same) people to parallel park two cars.

ISYE 6739 — Goldsman 3/2/20 58 / 115


Two-Sample Normal Means Test with Paired Observations

Example: Times for (the same) people to parallel park two cars.

Person Park Honda Park Cadillac Difference

ISYE 6739 — Goldsman 3/2/20 58 / 115


Two-Sample Normal Means Test with Paired Observations

Example: Times for (the same) people to parallel park two cars.

Person Park Honda Park Cadillac Difference


1 10 20 −10

ISYE 6739 — Goldsman 3/2/20 58 / 115


Two-Sample Normal Means Test with Paired Observations

Example: Times for (the same) people to parallel park two cars.

Person Park Honda Park Cadillac Difference


1 10 20 −10
2 25 40 −15

ISYE 6739 — Goldsman 3/2/20 58 / 115


Two-Sample Normal Means Test with Paired Observations

Example: Times for (the same) people to parallel park two cars.

Person Park Honda Park Cadillac Difference


1 10 20 −10
2 25 40 −15
3 5 5 0
4 20 35 −15
5 15 20 −5

ISYE 6739 — Goldsman 3/2/20 58 / 115


Two-Sample Normal Means Test with Paired Observations

Example: Times for (the same) people to parallel park two cars.

Person Park Honda Park Cadillac Difference


1 10 20 −10
2 25 40 −15
3 5 5 0
4 20 35 −15
5 15 20 −5

Let’s test H0 : µh = µc at level α = 0.10.

ISYE 6739 — Goldsman 3/2/20 58 / 115


Two-Sample Normal Means Test with Paired Observations

Example: Times for (the same) people to parallel park two cars.

Person Park Honda Park Cadillac Difference


1 10 20 −10
2 25 40 −15
3 5 5 0
4 20 35 −15
5 15 20 −5

Let’s test H0 : µh = µc at level α = 0.10.

We see that n = 5, D̄ = −9, Sd2 = 42.5.

ISYE 6739 — Goldsman 3/2/20 58 / 115


Two-Sample Normal Means Test with Paired Observations

Example: Times for (the same) people to parallel park two cars.

Person Park Honda Park Cadillac Difference


1 10 20 −10
2 25 40 −15
3 5 5 0
4 20 35 −15
5 15 20 −5

Let’s test H0 : µh = µc at level α = 0.10.

We see that n = 5, D̄ = −9, Sd2 = 42.5. This gives |T0 | = 3.087.

ISYE 6739 — Goldsman 3/2/20 58 / 115


Two-Sample Normal Means Test with Paired Observations

Example: Times for (the same) people to parallel park two cars.

Person Park Honda Park Cadillac Difference


1 10 20 −10
2 25 40 −15
3 5 5 0
4 20 35 −15
5 15 20 −5

Let’s test H0 : µh = µc at level α = 0.10.

We see that n = 5, D̄ = −9, Sd2 = 42.5. This gives |T0 | = 3.087.

Meanwhile, t0.05,4 = 2.13, so we reject H0 .

ISYE 6739 — Goldsman 3/2/20 58 / 115


Two-Sample Normal Means Test with Paired Observations

Example: Times for (the same) people to parallel park two cars.

Person Park Honda Park Cadillac Difference


1 10 20 −10
2 25 40 −15
3 5 5 0
4 20 35 −15
5 15 20 −5

Let’s test H0 : µh = µc at level α = 0.10.

We see that n = 5, D̄ = −9, Sd2 = 42.5. This gives |T0 | = 3.087.

Meanwhile, t0.05,4 = 2.13, so we reject H0 . We conclude that µh 6= µc (and


it’s probably the case that Hondas are easier to park). 2

ISYE 6739 — Goldsman 3/2/20 58 / 115


Normal Variance Test

1 Introduction to Hypothesis Testing


2 The Errors of Our Ways
3 Normal Mean Test with Known Variance
4 Normal Mean Test with Known Variance: Design
5 Two-Sample Normal Means Test with Known Variances
6 Normal Mean Test with Unknown Variance
7 Two-Sample Normal Means Tests with Unknown Variances
8 Two-Sample Normal Means Test with Paired Observations
9 Normal Variance Test
10 Two-Sample Normal Variances Test
11 Bernoulli Proportion Test
12 Two-Sample Bernoulli Proportions Test
13 Goodness-of-Fit Tests: Introduction
14 Goodness-of-Fit Tests: Examples
15 Goodness-of-Fit Tests: Honors Example
ISYE 6739 — Goldsman 3/2/20 59 / 115
Normal Variance Test

Lesson 7.9 — Normal Variance Test

ISYE 6739 — Goldsman 3/2/20 60 / 115


Normal Variance Test

Lesson 7.9 — Normal Variance Test

What’s Coming Up in the Next Few Lessons: We’ll look at a variety of


tests for parameters other than the mean.

ISYE 6739 — Goldsman 3/2/20 60 / 115


Normal Variance Test

Lesson 7.9 — Normal Variance Test

What’s Coming Up in the Next Few Lessons: We’ll look at a variety of


tests for parameters other than the mean.

The variance σ 2 of a normal distribution (this lesson).

ISYE 6739 — Goldsman 3/2/20 60 / 115


Normal Variance Test

Lesson 7.9 — Normal Variance Test

What’s Coming Up in the Next Few Lessons: We’ll look at a variety of


tests for parameters other than the mean.

The variance σ 2 of a normal distribution (this lesson).


The ratio of variances σx2 /σy2 from two normals.

ISYE 6739 — Goldsman 3/2/20 60 / 115


Normal Variance Test

Lesson 7.9 — Normal Variance Test

What’s Coming Up in the Next Few Lessons: We’ll look at a variety of


tests for parameters other than the mean.

The variance σ 2 of a normal distribution (this lesson).


The ratio of variances σx2 /σy2 from two normals.
The Bernoulli success parameter p.

ISYE 6739 — Goldsman 3/2/20 60 / 115


Normal Variance Test

Lesson 7.9 — Normal Variance Test

What’s Coming Up in the Next Few Lessons: We’ll look at a variety of


tests for parameters other than the mean.

The variance σ 2 of a normal distribution (this lesson).


The ratio of variances σx2 /σy2 from two normals.
The Bernoulli success parameter p.
The difference of success parameters, px − py , from two Bernoullis.

ISYE 6739 — Goldsman 3/2/20 60 / 115


Normal Variance Test

Set-up for the Normal Variance Test:

ISYE 6739 — Goldsman 3/2/20 61 / 115


Normal Variance Test

Set-up for the Normal Variance Test:


iid
Suppose X1 , . . . , Xn ∼ Nor(µ, σ 2 ), where µ and σ 2 are unknown.

ISYE 6739 — Goldsman 3/2/20 61 / 115


Normal Variance Test

Set-up for the Normal Variance Test:


iid
Suppose X1 , . . . , Xn ∼ Nor(µ, σ 2 ), where µ and σ 2 are unknown.

Consider the two-sided test (where you specify the hypothesized σ02 ):

ISYE 6739 — Goldsman 3/2/20 61 / 115


Normal Variance Test

Set-up for the Normal Variance Test:


iid
Suppose X1 , . . . , Xn ∼ Nor(µ, σ 2 ), where µ and σ 2 are unknown.

Consider the two-sided test (where you specify the hypothesized σ02 ):

H0 : σ 2 = σ02 vs. H1 : σ 2 6= σ02 .

ISYE 6739 — Goldsman 3/2/20 61 / 115


Normal Variance Test

Set-up for the Normal Variance Test:


iid
Suppose X1 , . . . , Xn ∼ Nor(µ, σ 2 ), where µ and σ 2 are unknown.

Consider the two-sided test (where you specify the hypothesized σ02 ):

H0 : σ 2 = σ02 vs. H1 : σ 2 6= σ02 .

Recall (yet again) that the sample variance


n
1 X σ 2 χ2 (n − 1)
S2 ≡ (Xi − X̄)2 ∼ .
n−1 n−1
i=1

ISYE 6739 — Goldsman 3/2/20 61 / 115


Normal Variance Test

Set-up for the Normal Variance Test:


iid
Suppose X1 , . . . , Xn ∼ Nor(µ, σ 2 ), where µ and σ 2 are unknown.

Consider the two-sided test (where you specify the hypothesized σ02 ):

H0 : σ 2 = σ02 vs. H1 : σ 2 6= σ02 .

Recall (yet again) that the sample variance


n
1 X σ 2 χ2 (n − 1)
S2 ≡ (Xi − X̄)2 ∼ .
n−1 n−1
i=1

We’ll use the test statistic


(n − 1)S 2
χ20 ≡ ∼ χ2 (n − 1) (if H0 is true).
σ02

ISYE 6739 — Goldsman 3/2/20 61 / 115


Normal Variance Test

The two-sided test rejects H0 iff

ISYE 6739 — Goldsman 3/2/20 62 / 115


Normal Variance Test

The two-sided test rejects H0 iff

χ20 < χ21−α/2,n−1 or χ20 > χ2α/2,n−1 .

ISYE 6739 — Goldsman 3/2/20 62 / 115


Normal Variance Test

The two-sided test rejects H0 iff

χ20 < χ21−α/2,n−1 or χ20 > χ2α/2,n−1 .

One-Sided Tests:

ISYE 6739 — Goldsman 3/2/20 62 / 115


Normal Variance Test

The two-sided test rejects H0 iff

χ20 < χ21−α/2,n−1 or χ20 > χ2α/2,n−1 .

One-Sided Tests:
H0 : σ 2 ≤ σ02 vs. H1 : σ 2 > σ02 .

ISYE 6739 — Goldsman 3/2/20 62 / 115


Normal Variance Test

The two-sided test rejects H0 iff

χ20 < χ21−α/2,n−1 or χ20 > χ2α/2,n−1 .

One-Sided Tests:
H0 : σ 2 ≤ σ02 vs. H1 : σ 2 > σ02 .

Reject H0 iff χ20 > χ2α,n−1 .

ISYE 6739 — Goldsman 3/2/20 62 / 115


Normal Variance Test

The two-sided test rejects H0 iff

χ20 < χ21−α/2,n−1 or χ20 > χ2α/2,n−1 .

One-Sided Tests:
H0 : σ 2 ≤ σ02 vs. H1 : σ 2 > σ02 .

Reject H0 iff χ20 > χ2α,n−1 .

H0 : σ 2 ≥ σ02 vs. H1 : σ 2 < σ02 .

ISYE 6739 — Goldsman 3/2/20 62 / 115


Normal Variance Test

The two-sided test rejects H0 iff

χ20 < χ21−α/2,n−1 or χ20 > χ2α/2,n−1 .

One-Sided Tests:
H0 : σ 2 ≤ σ02 vs. H1 : σ 2 > σ02 .

Reject H0 iff χ20 > χ2α,n−1 .

H0 : σ 2 ≥ σ02 vs. H1 : σ 2 < σ02 .

Reject H0 iff χ20 < χ21−α,n−1 .

ISYE 6739 — Goldsman 3/2/20 62 / 115


Normal Variance Test

Example: Suppose we want to test at level 0.05, whether or not the variance
of a certain process is ≤ 0.02, specifically,

ISYE 6739 — Goldsman 3/2/20 63 / 115


Normal Variance Test

Example: Suppose we want to test at level 0.05, whether or not the variance
of a certain process is ≤ 0.02, specifically,

H0 : σ 2 ≤ 0.02 vs. H1 : σ 2 > 0.02.

ISYE 6739 — Goldsman 3/2/20 63 / 115


Normal Variance Test

Example: Suppose we want to test at level 0.05, whether or not the variance
of a certain process is ≤ 0.02, specifically,

H0 : σ 2 ≤ 0.02 vs. H1 : σ 2 > 0.02.

If the sample variance is “too high,” we’ll reject H0 .

ISYE 6739 — Goldsman 3/2/20 63 / 115


Normal Variance Test

Example: Suppose we want to test at level 0.05, whether or not the variance
of a certain process is ≤ 0.02, specifically,

H0 : σ 2 ≤ 0.02 vs. H1 : σ 2 > 0.02.

If the sample variance is “too high,” we’ll reject H0 .

Suppose we have n = 20, X̄ = 125.12, and S 2 = 0.0225.

ISYE 6739 — Goldsman 3/2/20 63 / 115


Normal Variance Test

Example: Suppose we want to test at level 0.05, whether or not the variance
of a certain process is ≤ 0.02, specifically,

H0 : σ 2 ≤ 0.02 vs. H1 : σ 2 > 0.02.

If the sample variance is “too high,” we’ll reject H0 .

Suppose we have n = 20, X̄ = 125.12, and S 2 = 0.0225.

Then the test statistic χ20 = (n − 1)S 2 /σ02 = 21.375 (and isn’t explicitly
dependent on X̄).

ISYE 6739 — Goldsman 3/2/20 63 / 115


Normal Variance Test

Example: Suppose we want to test at level 0.05, whether or not the variance
of a certain process is ≤ 0.02, specifically,

H0 : σ 2 ≤ 0.02 vs. H1 : σ 2 > 0.02.

If the sample variance is “too high,” we’ll reject H0 .

Suppose we have n = 20, X̄ = 125.12, and S 2 = 0.0225.

Then the test statistic χ20 = (n − 1)S 2 /σ02 = 21.375 (and isn’t explicitly
dependent on X̄).

Further, χ2α,n−1 = χ20.05,19 = 30.14.

ISYE 6739 — Goldsman 3/2/20 63 / 115


Normal Variance Test

Example: Suppose we want to test at level 0.05, whether or not the variance
of a certain process is ≤ 0.02, specifically,

H0 : σ 2 ≤ 0.02 vs. H1 : σ 2 > 0.02.

If the sample variance is “too high,” we’ll reject H0 .

Suppose we have n = 20, X̄ = 125.12, and S 2 = 0.0225.

Then the test statistic χ20 = (n − 1)S 2 /σ02 = 21.375 (and isn’t explicitly
dependent on X̄).

Further, χ2α,n−1 = χ20.05,19 = 30.14.

So we fail to reject H0 . 2

ISYE 6739 — Goldsman 3/2/20 63 / 115


Two-Sample Normal Variances Test

1 Introduction to Hypothesis Testing


2 The Errors of Our Ways
3 Normal Mean Test with Known Variance
4 Normal Mean Test with Known Variance: Design
5 Two-Sample Normal Means Test with Known Variances
6 Normal Mean Test with Unknown Variance
7 Two-Sample Normal Means Tests with Unknown Variances
8 Two-Sample Normal Means Test with Paired Observations
9 Normal Variance Test
10 Two-Sample Normal Variances Test
11 Bernoulli Proportion Test
12 Two-Sample Bernoulli Proportions Test
13 Goodness-of-Fit Tests: Introduction
14 Goodness-of-Fit Tests: Examples
15 Goodness-of-Fit Tests: Honors Example
ISYE 6739 — Goldsman 3/2/20 64 / 115
Two-Sample Normal Variances Test

Lesson 7.10 — Two-Sample Normal Variances Test

ISYE 6739 — Goldsman 3/2/20 65 / 115


Two-Sample Normal Variances Test

Lesson 7.10 — Two-Sample Normal Variances Test

Do the two populations have the same variance?

ISYE 6739 — Goldsman 3/2/20 65 / 115


Two-Sample Normal Variances Test

Lesson 7.10 — Two-Sample Normal Variances Test

Do the two populations have the same variance?

The usual set-up:


iid
X1 , X2 , . . . , Xn ∼ Nor(µx , σx2 )
iid
Y1 , Y2 , . . . , Ym ∼ Nor(µy , σy2 ).

ISYE 6739 — Goldsman 3/2/20 65 / 115


Two-Sample Normal Variances Test

Lesson 7.10 — Two-Sample Normal Variances Test

Do the two populations have the same variance?

The usual set-up:


iid
X1 , X2 , . . . , Xn ∼ Nor(µx , σx2 )
iid
Y1 , Y2 , . . . , Ym ∼ Nor(µy , σy2 ).

Assume all X’s and Y ’s are independent.

ISYE 6739 — Goldsman 3/2/20 65 / 115


Two-Sample Normal Variances Test

Lesson 7.10 — Two-Sample Normal Variances Test

Do the two populations have the same variance?

The usual set-up:


iid
X1 , X2 , . . . , Xn ∼ Nor(µx , σx2 )
iid
Y1 , Y2 , . . . , Ym ∼ Nor(µy , σy2 ).

Assume all X’s and Y ’s are independent.

We’ll estimate the variances σx2 and σy2 by the sample variances Sx2 and Sy2 .

ISYE 6739 — Goldsman 3/2/20 65 / 115


Two-Sample Normal Variances Test

Two-sided test: H0 : σx2 = σy2 (or H0 : σx2 /σy2 = 1) vs. H1 : σx2 6= σy2 .

ISYE 6739 — Goldsman 3/2/20 66 / 115


Two-Sample Normal Variances Test

Two-sided test: H0 : σx2 = σy2 (or H0 : σx2 /σy2 = 1) vs. H1 : σx2 6= σy2 .

We’ll use the test statistic


Sx2
F0 ≡ ∼ F (n − 1, m − 1) (if H0 is true).
Sy2

ISYE 6739 — Goldsman 3/2/20 66 / 115


Two-Sample Normal Variances Test

Two-sided test: H0 : σx2 = σy2 (or H0 : σx2 /σy2 = 1) vs. H1 : σx2 6= σy2 .

We’ll use the test statistic


Sx2
F0 ≡ ∼ F (n − 1, m − 1) (if H0 is true).
Sy2

Thus, we reject H0 iff

ISYE 6739 — Goldsman 3/2/20 66 / 115


Two-Sample Normal Variances Test

Two-sided test: H0 : σx2 = σy2 (or H0 : σx2 /σy2 = 1) vs. H1 : σx2 6= σy2 .

We’ll use the test statistic


Sx2
F0 ≡ ∼ F (n − 1, m − 1) (if H0 is true).
Sy2

Thus, we reject H0 iff

F0 < F1−α/2,n−1,m−1 or F0 > Fα/2,n−1,m−1 .

ISYE 6739 — Goldsman 3/2/20 66 / 115


Two-Sample Normal Variances Test

Two-sided test: H0 : σx2 = σy2 (or H0 : σx2 /σy2 = 1) vs. H1 : σx2 6= σy2 .

We’ll use the test statistic


Sx2
F0 ≡ ∼ F (n − 1, m − 1) (if H0 is true).
Sy2

Thus, we reject H0 iff

F0 < F1−α/2,n−1,m−1 or F0 > Fα/2,n−1,m−1 .

iff (because of a property of the F distribution discussed earlier)

ISYE 6739 — Goldsman 3/2/20 66 / 115


Two-Sample Normal Variances Test

Two-sided test: H0 : σx2 = σy2 (or H0 : σx2 /σy2 = 1) vs. H1 : σx2 6= σy2 .

We’ll use the test statistic


Sx2
F0 ≡ ∼ F (n − 1, m − 1) (if H0 is true).
Sy2

Thus, we reject H0 iff

F0 < F1−α/2,n−1,m−1 or F0 > Fα/2,n−1,m−1 .

iff (because of a property of the F distribution discussed earlier)


1
F0 < or F0 > Fα/2,n−1,m−1 .
Fα/2,m−1,n−1

ISYE 6739 — Goldsman 3/2/20 66 / 115


Two-Sample Normal Variances Test

One-Sided Tests:

ISYE 6739 — Goldsman 3/2/20 67 / 115


Two-Sample Normal Variances Test

One-Sided Tests:

H0 : σx2 ≤ σy2 vs. H1 : σx2 > σy2 .

ISYE 6739 — Goldsman 3/2/20 67 / 115


Two-Sample Normal Variances Test

One-Sided Tests:

H0 : σx2 ≤ σy2 vs. H1 : σx2 > σy2 .

Reject H0 iff F0 > Fα,n−1,m−1 .

ISYE 6739 — Goldsman 3/2/20 67 / 115


Two-Sample Normal Variances Test

One-Sided Tests:

H0 : σx2 ≤ σy2 vs. H1 : σx2 > σy2 .

Reject H0 iff F0 > Fα,n−1,m−1 .

H0 : σx2 ≥ σy2 vs. H1 : σx2 < σy2 .

ISYE 6739 — Goldsman 3/2/20 67 / 115


Two-Sample Normal Variances Test

One-Sided Tests:

H0 : σx2 ≤ σy2 vs. H1 : σx2 > σy2 .

Reject H0 iff F0 > Fα,n−1,m−1 .

H0 : σx2 ≥ σy2 vs. H1 : σx2 < σy2 .

Reject H0 iff F0 < F1−α,n−1,m−1 = 1/Fα,m−1,n−1 .

ISYE 6739 — Goldsman 3/2/20 67 / 115


Two-Sample Normal Variances Test

Example: Suppose we want to test at level 0.05 whether or not two processes
have the same variance.

ISYE 6739 — Goldsman 3/2/20 68 / 115


Two-Sample Normal Variances Test

Example: Suppose we want to test at level 0.05 whether or not two processes
have the same variance.

H0 : σx2 = σy2 vs. H1 : σx2 6= σy2 .

ISYE 6739 — Goldsman 3/2/20 68 / 115


Two-Sample Normal Variances Test

Example: Suppose we want to test at level 0.05 whether or not two processes
have the same variance.

H0 : σx2 = σy2 vs. H1 : σx2 6= σy2 .

If the ratio of the sample variances is “too high” or “too low,” reject H0 .

ISYE 6739 — Goldsman 3/2/20 68 / 115


Two-Sample Normal Variances Test

Example: Suppose we want to test at level 0.05 whether or not two processes
have the same variance.

H0 : σx2 = σy2 vs. H1 : σx2 6= σy2 .

If the ratio of the sample variances is “too high” or “too low,” reject H0 .

Data: n = 7 observations with Sx2 = 7.78; and m = 8 with Sy2 = 12.04.

ISYE 6739 — Goldsman 3/2/20 68 / 115


Two-Sample Normal Variances Test

Example: Suppose we want to test at level 0.05 whether or not two processes
have the same variance.

H0 : σx2 = σy2 vs. H1 : σx2 6= σy2 .

If the ratio of the sample variances is “too high” or “too low,” reject H0 .

Data: n = 7 observations with Sx2 = 7.78; and m = 8 with Sy2 = 12.04.

Then F0 = Sx2 /Sy2 = 0.646,

ISYE 6739 — Goldsman 3/2/20 68 / 115


Two-Sample Normal Variances Test

Example: Suppose we want to test at level 0.05 whether or not two processes
have the same variance.

H0 : σx2 = σy2 vs. H1 : σx2 6= σy2 .

If the ratio of the sample variances is “too high” or “too low,” reject H0 .

Data: n = 7 observations with Sx2 = 7.78; and m = 8 with Sy2 = 12.04.

Then F0 = Sx2 /Sy2 = 0.646,

F1−α/2,n−1,m−1

ISYE 6739 — Goldsman 3/2/20 68 / 115


Two-Sample Normal Variances Test

Example: Suppose we want to test at level 0.05 whether or not two processes
have the same variance.

H0 : σx2 = σy2 vs. H1 : σx2 6= σy2 .

If the ratio of the sample variances is “too high” or “too low,” reject H0 .

Data: n = 7 observations with Sx2 = 7.78; and m = 8 with Sy2 = 12.04.

Then F0 = Sx2 /Sy2 = 0.646,

1
F1−α/2,n−1,m−1 = Fα/2,m−1,n−1

ISYE 6739 — Goldsman 3/2/20 68 / 115


Two-Sample Normal Variances Test

Example: Suppose we want to test at level 0.05 whether or not two processes
have the same variance.

H0 : σx2 = σy2 vs. H1 : σx2 6= σy2 .

If the ratio of the sample variances is “too high” or “too low,” reject H0 .

Data: n = 7 observations with Sx2 = 7.78; and m = 8 with Sy2 = 12.04.

Then F0 = Sx2 /Sy2 = 0.646,

1 1
F1−α/2,n−1,m−1 = Fα/2,m−1,n−1 = F0.025,7,6 = 1/5.695 = 0.176, and

ISYE 6739 — Goldsman 3/2/20 68 / 115


Two-Sample Normal Variances Test

Example: Suppose we want to test at level 0.05 whether or not two processes
have the same variance.

H0 : σx2 = σy2 vs. H1 : σx2 6= σy2 .

If the ratio of the sample variances is “too high” or “too low,” reject H0 .

Data: n = 7 observations with Sx2 = 7.78; and m = 8 with Sy2 = 12.04.

Then F0 = Sx2 /Sy2 = 0.646,

1 1
F1−α/2,n−1,m−1 = Fα/2,m−1,n−1 = F0.025,7,6 = 1/5.695 = 0.176, and

Fα/2,n−1,m−1 = F0.025,6,7 = 5.119.

ISYE 6739 — Goldsman 3/2/20 68 / 115


Two-Sample Normal Variances Test

Example: Suppose we want to test at level 0.05 whether or not two processes
have the same variance.

H0 : σx2 = σy2 vs. H1 : σx2 6= σy2 .

If the ratio of the sample variances is “too high” or “too low,” reject H0 .

Data: n = 7 observations with Sx2 = 7.78; and m = 8 with Sy2 = 12.04.

Then F0 = Sx2 /Sy2 = 0.646,

1 1
F1−α/2,n−1,m−1 = Fα/2,m−1,n−1 = F0.025,7,6 = 1/5.695 = 0.176, and

Fα/2,n−1,m−1 = F0.025,6,7 = 5.119.

Since F1−α/2,n−1,m−1 ≤ F0 ≤ Fα/2,n−1,m−1 , we fail to reject H0 . 2

ISYE 6739 — Goldsman 3/2/20 68 / 115


Bernoulli Proportion Test

1 Introduction to Hypothesis Testing


2 The Errors of Our Ways
3 Normal Mean Test with Known Variance
4 Normal Mean Test with Known Variance: Design
5 Two-Sample Normal Means Test with Known Variances
6 Normal Mean Test with Unknown Variance
7 Two-Sample Normal Means Tests with Unknown Variances
8 Two-Sample Normal Means Test with Paired Observations
9 Normal Variance Test
10 Two-Sample Normal Variances Test
11 Bernoulli Proportion Test
12 Two-Sample Bernoulli Proportions Test
13 Goodness-of-Fit Tests: Introduction
14 Goodness-of-Fit Tests: Examples
15 Goodness-of-Fit Tests: Honors Example
ISYE 6739 — Goldsman 3/2/20 69 / 115
Bernoulli Proportion Test

Lesson 7.11 — Bernoulli Proportion Test

ISYE 6739 — Goldsman 3/2/20 70 / 115


Bernoulli Proportion Test

Lesson 7.11 — Bernoulli Proportion Test


iid
Suppose that X1 , X2 , . . . , Xn ∼ Bern(p).

ISYE 6739 — Goldsman 3/2/20 70 / 115


Bernoulli Proportion Test

Lesson 7.11 — Bernoulli Proportion Test


iid
Suppose that X1 , X2 , . . . , Xn ∼ Bern(p).

We’re interested in testing hypotheses about the success parameter p.

ISYE 6739 — Goldsman 3/2/20 70 / 115


Bernoulli Proportion Test

Lesson 7.11 — Bernoulli Proportion Test


iid
Suppose that X1 , X2 , . . . , Xn ∼ Bern(p).

We’re interested in testing hypotheses about the success parameter p.

Two-sided test (you specify the hypothesized p0 ):

ISYE 6739 — Goldsman 3/2/20 70 / 115


Bernoulli Proportion Test

Lesson 7.11 — Bernoulli Proportion Test


iid
Suppose that X1 , X2 , . . . , Xn ∼ Bern(p).

We’re interested in testing hypotheses about the success parameter p.

Two-sided test (you specify the hypothesized p0 ):

H0 : p = p0 vs. H1 : p 6= p0 .

ISYE 6739 — Goldsman 3/2/20 70 / 115


Bernoulli Proportion Test

Lesson 7.11 — Bernoulli Proportion Test


iid
Suppose that X1 , X2 , . . . , Xn ∼ Bern(p).

We’re interested in testing hypotheses about the success parameter p.

Two-sided test (you specify the hypothesized p0 ):

H0 : p = p0 vs. H1 : p 6= p0 .
Pn
Let Y = i=1 Xi ∼ Bin(n, p).

ISYE 6739 — Goldsman 3/2/20 70 / 115


Bernoulli Proportion Test

Lesson 7.11 — Bernoulli Proportion Test


iid
Suppose that X1 , X2 , . . . , Xn ∼ Bern(p).

We’re interested in testing hypotheses about the success parameter p.

Two-sided test (you specify the hypothesized p0 ):

H0 : p = p0 vs. H1 : p 6= p0 .
Pn
Let Y = i=1 Xi ∼ Bin(n, p).

We’ll use the test statistic


Y − np0
Z0 ≡ p
np0 (1 − p0 )

ISYE 6739 — Goldsman 3/2/20 70 / 115


Bernoulli Proportion Test

Lesson 7.11 — Bernoulli Proportion Test


iid
Suppose that X1 , X2 , . . . , Xn ∼ Bern(p).

We’re interested in testing hypotheses about the success parameter p.

Two-sided test (you specify the hypothesized p0 ):

H0 : p = p0 vs. H1 : p 6= p0 .
Pn
Let Y = i=1 Xi ∼ Bin(n, p).

We’ll use the test statistic


Y − np0 X̄ − p0
Z0 ≡ p = p .
np0 (1 − p0 ) p0 (1 − p0 )/n

ISYE 6739 — Goldsman 3/2/20 70 / 115


Bernoulli Proportion Test

Lesson 7.11 — Bernoulli Proportion Test


iid
Suppose that X1 , X2 , . . . , Xn ∼ Bern(p).

We’re interested in testing hypotheses about the success parameter p.

Two-sided test (you specify the hypothesized p0 ):

H0 : p = p0 vs. H1 : p 6= p0 .
Pn
Let Y = i=1 Xi ∼ Bin(n, p).

We’ll use the test statistic


Y − np0 X̄ − p0
Z0 ≡ p = p .
np0 (1 − p0 ) p0 (1 − p0 )/n
If H0 is true, the central limit theorem implies that

Z0 ≈ Nor(0, 1).

ISYE 6739 — Goldsman 3/2/20 70 / 115


Bernoulli Proportion Test

Thus, for the two-sided test, we reject H0 iff |Z0 | > zα/2 .

ISYE 6739 — Goldsman 3/2/20 71 / 115


Bernoulli Proportion Test

Thus, for the two-sided test, we reject H0 iff |Z0 | > zα/2 .

Remark: In order for the CLT to work, you need n large (say at least 30),
and both np ≥ 5 and nq ≥ 5 (so that p isn’t too close to 0 or 1).

ISYE 6739 — Goldsman 3/2/20 71 / 115


Bernoulli Proportion Test

Thus, for the two-sided test, we reject H0 iff |Z0 | > zα/2 .

Remark: In order for the CLT to work, you need n large (say at least 30),
and both np ≥ 5 and nq ≥ 5 (so that p isn’t too close to 0 or 1).

Remark: If n isn’t very big, you may have to use Binomial tables (instead of
the normal approximation).

ISYE 6739 — Goldsman 3/2/20 71 / 115


Bernoulli Proportion Test

Thus, for the two-sided test, we reject H0 iff |Z0 | > zα/2 .

Remark: In order for the CLT to work, you need n large (say at least 30),
and both np ≥ 5 and nq ≥ 5 (so that p isn’t too close to 0 or 1).

Remark: If n isn’t very big, you may have to use Binomial tables (instead of
the normal approximation). This gets tedious, and I won’t go into it here!

ISYE 6739 — Goldsman 3/2/20 71 / 115


Bernoulli Proportion Test

Thus, for the two-sided test, we reject H0 iff |Z0 | > zα/2 .

Remark: In order for the CLT to work, you need n large (say at least 30),
and both np ≥ 5 and nq ≥ 5 (so that p isn’t too close to 0 or 1).

Remark: If n isn’t very big, you may have to use Binomial tables (instead of
the normal approximation). This gets tedious, and I won’t go into it here!

One-Sided Tests:

ISYE 6739 — Goldsman 3/2/20 71 / 115


Bernoulli Proportion Test

Thus, for the two-sided test, we reject H0 iff |Z0 | > zα/2 .

Remark: In order for the CLT to work, you need n large (say at least 30),
and both np ≥ 5 and nq ≥ 5 (so that p isn’t too close to 0 or 1).

Remark: If n isn’t very big, you may have to use Binomial tables (instead of
the normal approximation). This gets tedious, and I won’t go into it here!

One-Sided Tests:

H0 : p ≤ p0 vs. H1 : p > p0 .

ISYE 6739 — Goldsman 3/2/20 71 / 115


Bernoulli Proportion Test

Thus, for the two-sided test, we reject H0 iff |Z0 | > zα/2 .

Remark: In order for the CLT to work, you need n large (say at least 30),
and both np ≥ 5 and nq ≥ 5 (so that p isn’t too close to 0 or 1).

Remark: If n isn’t very big, you may have to use Binomial tables (instead of
the normal approximation). This gets tedious, and I won’t go into it here!

One-Sided Tests:

H0 : p ≤ p0 vs. H1 : p > p0 .

Reject H0 iff Z0 > zα .

ISYE 6739 — Goldsman 3/2/20 71 / 115


Bernoulli Proportion Test

Thus, for the two-sided test, we reject H0 iff |Z0 | > zα/2 .

Remark: In order for the CLT to work, you need n large (say at least 30),
and both np ≥ 5 and nq ≥ 5 (so that p isn’t too close to 0 or 1).

Remark: If n isn’t very big, you may have to use Binomial tables (instead of
the normal approximation). This gets tedious, and I won’t go into it here!

One-Sided Tests:

H0 : p ≤ p0 vs. H1 : p > p0 .

Reject H0 iff Z0 > zα .

H0 : p ≥ p0 vs. H1 : p < p0 .

ISYE 6739 — Goldsman 3/2/20 71 / 115


Bernoulli Proportion Test

Thus, for the two-sided test, we reject H0 iff |Z0 | > zα/2 .

Remark: In order for the CLT to work, you need n large (say at least 30),
and both np ≥ 5 and nq ≥ 5 (so that p isn’t too close to 0 or 1).

Remark: If n isn’t very big, you may have to use Binomial tables (instead of
the normal approximation). This gets tedious, and I won’t go into it here!

One-Sided Tests:

H0 : p ≤ p0 vs. H1 : p > p0 .

Reject H0 iff Z0 > zα .

H0 : p ≥ p0 vs. H1 : p < p0 .

Reject H0 iff Z0 < −zα .

ISYE 6739 — Goldsman 3/2/20 71 / 115


Bernoulli Proportion Test

Example: In 200 samples of a certain semiconductor, there were only 4


defectives.

ISYE 6739 — Goldsman 3/2/20 72 / 115


Bernoulli Proportion Test

Example: In 200 samples of a certain semiconductor, there were only 4


defectives. We’re interested in proving “beyond a shadow of a doubt” that the
probability of a defective is less than 0.06.

ISYE 6739 — Goldsman 3/2/20 72 / 115


Bernoulli Proportion Test

Example: In 200 samples of a certain semiconductor, there were only 4


defectives. We’re interested in proving “beyond a shadow of a doubt” that the
probability of a defective is less than 0.06. Let’s conduct the test at level 0.05.

ISYE 6739 — Goldsman 3/2/20 72 / 115


Bernoulli Proportion Test

Example: In 200 samples of a certain semiconductor, there were only 4


defectives. We’re interested in proving “beyond a shadow of a doubt” that the
probability of a defective is less than 0.06. Let’s conduct the test at level 0.05.

H0 : p ≥ 0.06 vs. H1 : p < 0.06.

ISYE 6739 — Goldsman 3/2/20 72 / 115


Bernoulli Proportion Test

Example: In 200 samples of a certain semiconductor, there were only 4


defectives. We’re interested in proving “beyond a shadow of a doubt” that the
probability of a defective is less than 0.06. Let’s conduct the test at level 0.05.

H0 : p ≥ 0.06 vs. H1 : p < 0.06.

(Since p is close to 0, we really did need to take a lot of observations — 200


in this case — in order for the CLT to work.)

ISYE 6739 — Goldsman 3/2/20 72 / 115


Bernoulli Proportion Test

Example: In 200 samples of a certain semiconductor, there were only 4


defectives. We’re interested in proving “beyond a shadow of a doubt” that the
probability of a defective is less than 0.06. Let’s conduct the test at level 0.05.

H0 : p ≥ 0.06 vs. H1 : p < 0.06.

(Since p is close to 0, we really did need to take a lot of observations — 200


in this case — in order for the CLT to work.)

We have n = 200, Y = 4 defectives, and p0 = 0.06.

ISYE 6739 — Goldsman 3/2/20 72 / 115


Bernoulli Proportion Test

Example: In 200 samples of a certain semiconductor, there were only 4


defectives. We’re interested in proving “beyond a shadow of a doubt” that the
probability of a defective is less than 0.06. Let’s conduct the test at level 0.05.

H0 : p ≥ 0.06 vs. H1 : p < 0.06.

(Since p is close to 0, we really did need to take a lot of observations — 200


in this case — in order for the CLT to work.)

We have n = 200, Y = 4 defectives, and p0 = 0.06.

The test statistic is


Y − np0
Z0 = p = −2.357.
np0 (1 − p0 )

ISYE 6739 — Goldsman 3/2/20 72 / 115


Bernoulli Proportion Test

Example: In 200 samples of a certain semiconductor, there were only 4


defectives. We’re interested in proving “beyond a shadow of a doubt” that the
probability of a defective is less than 0.06. Let’s conduct the test at level 0.05.

H0 : p ≥ 0.06 vs. H1 : p < 0.06.

(Since p is close to 0, we really did need to take a lot of observations — 200


in this case — in order for the CLT to work.)

We have n = 200, Y = 4 defectives, and p0 = 0.06.

The test statistic is


Y − np0
Z0 = p = −2.357.
np0 (1 − p0 )

Since −zα = −1.645, we reject H0 ;

ISYE 6739 — Goldsman 3/2/20 72 / 115


Bernoulli Proportion Test

Example: In 200 samples of a certain semiconductor, there were only 4


defectives. We’re interested in proving “beyond a shadow of a doubt” that the
probability of a defective is less than 0.06. Let’s conduct the test at level 0.05.

H0 : p ≥ 0.06 vs. H1 : p < 0.06.

(Since p is close to 0, we really did need to take a lot of observations — 200


in this case — in order for the CLT to work.)

We have n = 200, Y = 4 defectives, and p0 = 0.06.

The test statistic is


Y − np0
Z0 = p = −2.357.
np0 (1 − p0 )

Since −zα = −1.645, we reject H0 ; so it seems p really is < 0.06. 2

ISYE 6739 — Goldsman 3/2/20 72 / 115


Bernoulli Proportion Test

Sample-Size Selection

ISYE 6739 — Goldsman 3/2/20 73 / 115


Bernoulli Proportion Test

Sample-Size Selection

Can we design a two-sided test H0 : p = p0 vs. H1 : p 6= p0 such that

ISYE 6739 — Goldsman 3/2/20 73 / 115


Bernoulli Proportion Test

Sample-Size Selection

Can we design a two-sided test H0 : p = p0 vs. H1 : p 6= p0 such that

P (Type I error) = α

ISYE 6739 — Goldsman 3/2/20 73 / 115


Bernoulli Proportion Test

Sample-Size Selection

Can we design a two-sided test H0 : p = p0 vs. H1 : p 6= p0 such that

P (Type I error) = α and P (Type II error | p 6= p0 ) = β?

ISYE 6739 — Goldsman 3/2/20 73 / 115


Bernoulli Proportion Test

Sample-Size Selection

Can we design a two-sided test H0 : p = p0 vs. H1 : p 6= p0 such that

P (Type I error) = α and P (Type II error | p 6= p0 ) = β?

Yes! We’ll now show that the necessary sample size is

ISYE 6739 — Goldsman 3/2/20 73 / 115


Bernoulli Proportion Test

Sample-Size Selection

Can we design a two-sided test H0 : p = p0 vs. H1 : p 6= p0 such that

P (Type I error) = α and P (Type II error | p 6= p0 ) = β?

Yes! We’ll now show that the necessary sample size is


√ √ 
zα/2 p0 q0 + zβ pq 2

n ≈ ,
p − p0

ISYE 6739 — Goldsman 3/2/20 73 / 115


Bernoulli Proportion Test

Sample-Size Selection

Can we design a two-sided test H0 : p = p0 vs. H1 : p 6= p0 such that

P (Type I error) = α and P (Type II error | p 6= p0 ) = β?

Yes! We’ll now show that the necessary sample size is


√ √ 
zα/2 p0 q0 + zβ pq 2

n ≈ ,
p − p0

where, to save space, we let q ≡ 1 − p and q0 ≡ 1 − p0 .

ISYE 6739 — Goldsman 3/2/20 73 / 115


Bernoulli Proportion Test

Sample-Size Selection

Can we design a two-sided test H0 : p = p0 vs. H1 : p 6= p0 such that

P (Type I error) = α and P (Type II error | p 6= p0 ) = β?

Yes! We’ll now show that the necessary sample size is


√ √ 
zα/2 p0 q0 + zβ pq 2

n ≈ ,
p − p0

where, to save space, we let q ≡ 1 − p and q0 ≡ 1 − p0 .

Note that n is a function of the unknown p.

ISYE 6739 — Goldsman 3/2/20 73 / 115


Bernoulli Proportion Test

Sample-Size Selection

Can we design a two-sided test H0 : p = p0 vs. H1 : p 6= p0 such that

P (Type I error) = α and P (Type II error | p 6= p0 ) = β?

Yes! We’ll now show that the necessary sample size is


√ √ 
zα/2 p0 q0 + zβ pq 2

n ≈ ,
p − p0

where, to save space, we let q ≡ 1 − p and q0 ≡ 1 − p0 .

Note that n is a function of the unknown p. In practice, we’ll choose some


p = p1 and ask “How many observations should I take if p happens to equal
p1 instead of p0 ” (where you pick p1 )?

ISYE 6739 — Goldsman 3/2/20 73 / 115


Bernoulli Proportion Test

Sample-Size Selection

Can we design a two-sided test H0 : p = p0 vs. H1 : p 6= p0 such that

P (Type I error) = α and P (Type II error | p 6= p0 ) = β?

Yes! We’ll now show that the necessary sample size is


√ √ 
zα/2 p0 q0 + zβ pq 2

n ≈ ,
p − p0

where, to save space, we let q ≡ 1 − p and q0 ≡ 1 − p0 .

Note that n is a function of the unknown p. In practice, we’ll choose some


p = p1 and ask “How many observations should I take if p happens to equal
p1 instead of p0 ” (where you pick p1 )? Thus, we guard against the scenario in
which p actually equals p1 .

ISYE 6739 — Goldsman 3/2/20 73 / 115


Bernoulli Proportion Test

Proof (similar to normal mean design proof):

ISYE 6739 — Goldsman 3/2/20 74 / 115


Bernoulli Proportion Test

Proof (similar to normal mean design proof):

β = P (Type II error)

ISYE 6739 — Goldsman 3/2/20 74 / 115


Bernoulli Proportion Test

Proof (similar to normal mean design proof):

β = P (Type II error)
= P (Fail to Reject H0 | H0 false)

ISYE 6739 — Goldsman 3/2/20 74 / 115


Bernoulli Proportion Test

Proof (similar to normal mean design proof):

β = P (Type II error)
= P (Fail to Reject H0 | H0 false)
.
= P (|Z0 | ≤ zα/2 | p 6= p0 ) (by the CLT)

ISYE 6739 — Goldsman 3/2/20 74 / 115


Bernoulli Proportion Test

Proof (similar to normal mean design proof):

β = P (Type II error)
= P (Fail to Reject H0 | H0 false)
.
= P (|Z0 | ≤ zα/2 | p 6= p0 ) (by the CLT)
= P (−zα/2 ≤ Z0 ≤ zα/2 | p 6= p0 )

ISYE 6739 — Goldsman 3/2/20 74 / 115


Bernoulli Proportion Test

Proof (similar to normal mean design proof):

β = P (Type II error)
= P (Fail to Reject H0 | H0 false)
.
= P (|Z0 | ≤ zα/2 | p 6= p0 ) (by the CLT)
= P (−zα/2 ≤ Z0 ≤ zα/2 | p 6= p0 )
 
Y − np0
= P −zα/2 ≤ p ≤ zα/2 p 6= p0

np0 (1 − p0 )

ISYE 6739 — Goldsman 3/2/20 74 / 115


Bernoulli Proportion Test

Proof (similar to normal mean design proof):

β = P (Type II error)
= P (Fail to Reject H0 | H0 false)
.
= P (|Z0 | ≤ zα/2 | p 6= p0 ) (by the CLT)
= P (−zα/2 ≤ Z0 ≤ zα/2 | p 6= p0 )
 
Y − np0
= P −zα/2 ≤ p ≤ zα/2 p 6= p0

np0 (1 − p0 )
 
Y − np0
r r
p0 q0 p0 q0
= P −zα/2 ≤ √ ≤ zα/2 p 6= p0
pq npq pq

ISYE 6739 — Goldsman 3/2/20 74 / 115


Bernoulli Proportion Test

Proof (similar to normal mean design proof):

β = P (Type II error)
= P (Fail to Reject H0 | H0 false)
.
= P (|Z0 | ≤ zα/2 | p 6= p0 ) (by the CLT)
= P (−zα/2 ≤ Z0 ≤ zα/2 | p 6= p0 )
 
Y − np0
= P −zα/2 ≤ p ≤ zα/2 p 6= p0

np0 (1 − p0 )
 
Y − np0
r r
p0 q0 p0 q0
= P −zα/2 ≤ √ ≤ zα/2 p 6= p0
pq npq pq
 
Y − np n(p − p0 )
= P −c ≤ √ + √ ≤ c p 6= p0 ,

npq npq

ISYE 6739 — Goldsman 3/2/20 74 / 115


Bernoulli Proportion Test

Proof (similar to normal mean design proof):

β = P (Type II error)
= P (Fail to Reject H0 | H0 false)
.
= P (|Z0 | ≤ zα/2 | p 6= p0 ) (by the CLT)
= P (−zα/2 ≤ Z0 ≤ zα/2 | p 6= p0 )
 
Y − np0
= P −zα/2 ≤ p ≤ zα/2 p 6= p0

np0 (1 − p0 )
 
Y − np0
r r
p0 q0 p0 q0
= P −zα/2 ≤ √ ≤ zα/2 p 6= p0
pq npq pq
 
Y − np n(p − p0 )
= P −c ≤ √ + √ ≤ c p 6= p0 ,

npq npq

where r
p 0 q0
c ≡ zα/2 .
pq

ISYE 6739 — Goldsman 3/2/20 74 / 115


Bernoulli Proportion Test

Now notice that (since p is the true success probability),

ISYE 6739 — Goldsman 3/2/20 75 / 115


Bernoulli Proportion Test

Now notice that (since p is the true success probability),


Y − np
Z ≡ √ ≈ Nor(0, 1).
npq

ISYE 6739 — Goldsman 3/2/20 75 / 115


Bernoulli Proportion Test

Now notice that (since p is the true success probability),


Y − np
Z ≡ √ ≈ Nor(0, 1).
npq

This gives
 
. n(p − p0 )
β = P −c ≤ Z + √ ≤ c
npq

ISYE 6739 — Goldsman 3/2/20 75 / 115


Bernoulli Proportion Test

Now notice that (since p is the true success probability),


Y − np
Z ≡ √ ≈ Nor(0, 1).
npq

This gives
 
. n(p − p0 )
β = P −c ≤ Z + √ ≤ c
npq
 √ √ 
n(p − p0 ) n(p − p0 )
= P −c − √ ≤ Z ≤ c− √
pq pq

ISYE 6739 — Goldsman 3/2/20 75 / 115


Bernoulli Proportion Test

Now notice that (since p is the true success probability),


Y − np
Z ≡ √ ≈ Nor(0, 1).
npq

This gives
 
. n(p − p0 )
β = P −c ≤ Z + √ ≤ c
npq
 √ √ 
n(p − p0 ) n(p − p0 )
= P −c − √ ≤ Z ≤ c− √
pq pq
= P (−c − d ≤ Z ≤ c − d)

ISYE 6739 — Goldsman 3/2/20 75 / 115


Bernoulli Proportion Test

Now notice that (since p is the true success probability),


Y − np
Z ≡ √ ≈ Nor(0, 1).
npq

This gives
 
. n(p − p0 )
β = P −c ≤ Z + √ ≤ c
npq
 √ √ 
n(p − p0 ) n(p − p0 )
= P −c − √ ≤ Z ≤ c− √
pq pq
= P (−c − d ≤ Z ≤ c − d)
= Φ(c − d) − Φ(−c − d),

ISYE 6739 — Goldsman 3/2/20 75 / 115


Bernoulli Proportion Test

Now notice that (since p is the true success probability),


Y − np
Z ≡ √ ≈ Nor(0, 1).
npq

This gives
 
. n(p − p0 )
β = P −c ≤ Z + √ ≤ c
npq
 √ √ 
n(p − p0 ) n(p − p0 )
= P −c − √ ≤ Z ≤ c− √
pq pq
= P (−c − d ≤ Z ≤ c − d)
= Φ(c − d) − Φ(−c − d),

where √
n(p − p0 )
d ≡ √ .
pq

ISYE 6739 — Goldsman 3/2/20 75 / 115


Bernoulli Proportion Test

Also notice that

ISYE 6739 — Goldsman 3/2/20 76 / 115


Bernoulli Proportion Test

Also notice that



n(p − p0 )
r
p0 q0
−c − d = −zα/2 − √  0.
pq pq

ISYE 6739 — Goldsman 3/2/20 76 / 115


Bernoulli Proportion Test

Also notice that



n(p − p0 )
r
p0 q0
−c − d = −zα/2 − √  0.
pq pq
. .
This implies Φ(−c − d) = 0, and so β = Φ(c − d).

ISYE 6739 — Goldsman 3/2/20 76 / 115


Bernoulli Proportion Test

Also notice that



n(p − p0 )
r
p0 q0
−c − d = −zα/2 − √  0.
pq pq
. .
This implies Φ(−c − d) = 0, and so β = Φ(c − d). Thus,

−zβ ≡ Φ−1 (β)

ISYE 6739 — Goldsman 3/2/20 76 / 115


Bernoulli Proportion Test

Also notice that



n(p − p0 )
r
p0 q0
−c − d = −zα/2 − √  0.
pq pq
. .
This implies Φ(−c − d) = 0, and so β = Φ(c − d). Thus,

.
−zβ ≡ Φ−1 (β) = c − d

ISYE 6739 — Goldsman 3/2/20 76 / 115


Bernoulli Proportion Test

Also notice that



n(p − p0 )
r
p0 q0
−c − d = −zα/2 − √  0.
pq pq
. .
This implies Φ(−c − d) = 0, and so β = Φ(c − d). Thus,

n(p − p0 )
r
−1 . p 0 q0
−zβ ≡ Φ (β) = c − d = zα/2 − √ .
pq pq

ISYE 6739 — Goldsman 3/2/20 76 / 115


Bernoulli Proportion Test

Also notice that



n(p − p0 )
r
p0 q0
−c − d = −zα/2 − √  0.
pq pq
. .
This implies Φ(−c − d) = 0, and so β = Φ(c − d). Thus,

n(p − p0 )
r
−1 . p 0 q0
−zβ ≡ Φ (β) = c − d = zα/2 − √ .
pq pq
After a little algebra, we finally(!) get

ISYE 6739 — Goldsman 3/2/20 76 / 115


Bernoulli Proportion Test

Also notice that



n(p − p0 )
r
p0 q0
−c − d = −zα/2 − √  0.
pq pq
. .
This implies Φ(−c − d) = 0, and so β = Φ(c − d). Thus,

n(p − p0 )
r
−1 . p 0 q0
−zβ ≡ Φ (β) = c − d = zα/2 − √ .
pq pq
After a little algebra, we finally(!) get
√ √ 2
. zα/2 p0 q0 + zβ pq

n = .
p − p0

ISYE 6739 — Goldsman 3/2/20 76 / 115


Bernoulli Proportion Test

Also notice that



n(p − p0 )
r
p0 q0
−c − d = −zα/2 − √  0.
pq pq
. .
This implies Φ(−c − d) = 0, and so β = Φ(c − d). Thus,

n(p − p0 )
r
−1 . p 0 q0
−zβ ≡ Φ (β) = c − d = zα/2 − √ .
pq pq
After a little algebra, we finally(!) get
√ √ 2
. zα/2 p0 q0 + zβ pq

n = .
p − p0

Similarly, the sample size for the corresponding one-sided test is

ISYE 6739 — Goldsman 3/2/20 76 / 115


Bernoulli Proportion Test

Also notice that



n(p − p0 )
r
p0 q0
−c − d = −zα/2 − √  0.
pq pq
. .
This implies Φ(−c − d) = 0, and so β = Φ(c − d). Thus,

n(p − p0 )
r
−1 . p 0 q0
−zβ ≡ Φ (β) = c − d = zα/2 − √ .
pq pq
After a little algebra, we finally(!) get
√ √ 2
. zα/2 p0 q0 + zβ pq

n = .
p − p0

Similarly, the sample size for the corresponding one-sided test is


 √ √ 2
. zα p0 q0 + zβ pq
n = . Whew!
p − p0

ISYE 6739 — Goldsman 3/2/20 76 / 115


Bernoulli Proportion Test

Example: We’re conducting a study on whether or not a particular allergy


medication works effectively.

ISYE 6739 — Goldsman 3/2/20 77 / 115


Bernoulli Proportion Test

Example: We’re conducting a study on whether or not a particular allergy


medication works effectively. We’ll assume that the drug either clearly works
or doesn’t work for each independent subject, so that we’ll have legitimate
Bernoulli trials.

ISYE 6739 — Goldsman 3/2/20 77 / 115


Bernoulli Proportion Test

Example: We’re conducting a study on whether or not a particular allergy


medication works effectively. We’ll assume that the drug either clearly works
or doesn’t work for each independent subject, so that we’ll have legitimate
Bernoulli trials. Our hypothesis is H0 : p = p0 = 0.8 vs. H1 : p 6= 0.8.

ISYE 6739 — Goldsman 3/2/20 77 / 115


Bernoulli Proportion Test

Example: We’re conducting a study on whether or not a particular allergy


medication works effectively. We’ll assume that the drug either clearly works
or doesn’t work for each independent subject, so that we’ll have legitimate
Bernoulli trials. Our hypothesis is H0 : p = p0 = 0.8 vs. H1 : p 6= 0.8.

In order to design our test (i.e., determine its sample size), let’s set our Type I
error probability to α = 0.05.

ISYE 6739 — Goldsman 3/2/20 77 / 115


Bernoulli Proportion Test

Example: We’re conducting a study on whether or not a particular allergy


medication works effectively. We’ll assume that the drug either clearly works
or doesn’t work for each independent subject, so that we’ll have legitimate
Bernoulli trials. Our hypothesis is H0 : p = p0 = 0.8 vs. H1 : p 6= 0.8.

In order to design our test (i.e., determine its sample size), let’s set our Type I
error probability to α = 0.05.

We’d like to protect against goofing up on the poor performance side, so let’s
set our Type II to error to β = 0.10 in the special case that p = p1 = 0.7.

ISYE 6739 — Goldsman 3/2/20 77 / 115


Bernoulli Proportion Test

Example: We’re conducting a study on whether or not a particular allergy


medication works effectively. We’ll assume that the drug either clearly works
or doesn’t work for each independent subject, so that we’ll have legitimate
Bernoulli trials. Our hypothesis is H0 : p = p0 = 0.8 vs. H1 : p 6= 0.8.

In order to design our test (i.e., determine its sample size), let’s set our Type I
error probability to α = 0.05.

We’d like to protect against goofing up on the poor performance side, so let’s
set our Type II to error to β = 0.10 in the special case that p = p1 = 0.7.
Then
√ √
zα/2 p0 q0 + zβ p1 q1 2
 
.
n =
p1 − p0

ISYE 6739 — Goldsman 3/2/20 77 / 115


Bernoulli Proportion Test

Example: We’re conducting a study on whether or not a particular allergy


medication works effectively. We’ll assume that the drug either clearly works
or doesn’t work for each independent subject, so that we’ll have legitimate
Bernoulli trials. Our hypothesis is H0 : p = p0 = 0.8 vs. H1 : p 6= 0.8.

In order to design our test (i.e., determine its sample size), let’s set our Type I
error probability to α = 0.05.

We’d like to protect against goofing up on the poor performance side, so let’s
set our Type II to error to β = 0.10 in the special case that p = p1 = 0.7.
Then
√ √
zα/2 p0 q0 + zβ p1 q1 2
 
.
n =
p1 − p0
1.96 (0.8)(0.2) + 1.28 (0.7)(0.3) 2
 p p 
=
0.7 − 0.8

ISYE 6739 — Goldsman 3/2/20 77 / 115


Bernoulli Proportion Test

Example: We’re conducting a study on whether or not a particular allergy


medication works effectively. We’ll assume that the drug either clearly works
or doesn’t work for each independent subject, so that we’ll have legitimate
Bernoulli trials. Our hypothesis is H0 : p = p0 = 0.8 vs. H1 : p 6= 0.8.

In order to design our test (i.e., determine its sample size), let’s set our Type I
error probability to α = 0.05.

We’d like to protect against goofing up on the poor performance side, so let’s
set our Type II to error to β = 0.10 in the special case that p = p1 = 0.7.
Then
√ √
zα/2 p0 q0 + zβ p1 q1 2
 
.
n =
p1 − p0
1.96 (0.8)(0.2) + 1.28 (0.7)(0.3) 2
 p p 
=
0.7 − 0.8
= 187.8 → 188. 2

ISYE 6739 — Goldsman 3/2/20 77 / 115


Two-Sample Bernoulli Proportions Test

1 Introduction to Hypothesis Testing


2 The Errors of Our Ways
3 Normal Mean Test with Known Variance
4 Normal Mean Test with Known Variance: Design
5 Two-Sample Normal Means Test with Known Variances
6 Normal Mean Test with Unknown Variance
7 Two-Sample Normal Means Tests with Unknown Variances
8 Two-Sample Normal Means Test with Paired Observations
9 Normal Variance Test
10 Two-Sample Normal Variances Test
11 Bernoulli Proportion Test
12 Two-Sample Bernoulli Proportions Test
13 Goodness-of-Fit Tests: Introduction
14 Goodness-of-Fit Tests: Examples
15 Goodness-of-Fit Tests: Honors Example
ISYE 6739 — Goldsman 3/2/20 78 / 115
Two-Sample Bernoulli Proportions Test

Lesson 7.12 — Two-Sample Bernoulli Proportions Test

ISYE 6739 — Goldsman 3/2/20 79 / 115


Two-Sample Bernoulli Proportions Test

Lesson 7.12 — Two-Sample Bernoulli Proportions Test

iid iid
Suppose that X1 , X2 , . . . , Xn ∼ Bern(px ) and Y1 , Y2 , . . . , Ym ∼ Bern(py )
are two independent Bernoulli samples.

ISYE 6739 — Goldsman 3/2/20 79 / 115


Two-Sample Bernoulli Proportions Test

Lesson 7.12 — Two-Sample Bernoulli Proportions Test

iid iid
Suppose that X1 , X2 , . . . , Xn ∼ Bern(px ) and Y1 , Y2 , . . . , Ym ∼ Bern(py )
are two independent Bernoulli samples.

Now we’re interested in testing hypotheses about the difference in the success
parameters, px − py .

ISYE 6739 — Goldsman 3/2/20 79 / 115


Two-Sample Bernoulli Proportions Test

Lesson 7.12 — Two-Sample Bernoulli Proportions Test

iid iid
Suppose that X1 , X2 , . . . , Xn ∼ Bern(px ) and Y1 , Y2 , . . . , Ym ∼ Bern(py )
are two independent Bernoulli samples.

Now we’re interested in testing hypotheses about the difference in the success
parameters, px − py .

Two-sided test:
H0 : px = py vs. H1 : px 6= py .

ISYE 6739 — Goldsman 3/2/20 79 / 115


Two-Sample Bernoulli Proportions Test

Lesson 7.12 — Two-Sample Bernoulli Proportions Test

iid iid
Suppose that X1 , X2 , . . . , Xn ∼ Bern(px ) and Y1 , Y2 , . . . , Ym ∼ Bern(py )
are two independent Bernoulli samples.

Now we’re interested in testing hypotheses about the difference in the success
parameters, px − py .

Two-sided test:
H0 : px = py vs. H1 : px 6= py .

Denote the respective sample means by


n
1X Bin(n, px ) Bin(m, py )
X̄ = Xi ∼ and Ȳ ∼ .
n n m
i=1

ISYE 6739 — Goldsman 3/2/20 79 / 115


Two-Sample Bernoulli Proportions Test

By the CLT and our confidence interval work from the previous module, we
know that for large n and m,

ISYE 6739 — Goldsman 3/2/20 80 / 115


Two-Sample Bernoulli Proportions Test

By the CLT and our confidence interval work from the previous module, we
know that for large n and m,
 
px (1 − px )
X̄ ≈ Nor px ,
n

ISYE 6739 — Goldsman 3/2/20 80 / 115


Two-Sample Bernoulli Proportions Test

By the CLT and our confidence interval work from the previous module, we
know that for large n and m,
   
px (1 − px ) py (1 − py )
X̄ ≈ Nor px , and Ȳ ≈ Nor py , .
n m

ISYE 6739 — Goldsman 3/2/20 80 / 115


Two-Sample Bernoulli Proportions Test

By the CLT and our confidence interval work from the previous module, we
know that for large n and m,
   
px (1 − px ) py (1 − py )
X̄ ≈ Nor px , and Ȳ ≈ Nor py , .
n m

Then
X̄ − Ȳ − (px − py )
q ≈ Nor(0, 1).
px (1−px ) py (1−py )
n + m

ISYE 6739 — Goldsman 3/2/20 80 / 115


Two-Sample Bernoulli Proportions Test

By the CLT and our confidence interval work from the previous module, we
know that for large n and m,
   
px (1 − px ) py (1 − py )
X̄ ≈ Nor px , and Ȳ ≈ Nor py , .
n m

Then
X̄ − Ȳ − (px − py )
q ≈ Nor(0, 1).
px (1−px ) py (1−py )
n + m

Moreover, under the null hypothesis, we have p ≡ px = py , in which case

ISYE 6739 — Goldsman 3/2/20 80 / 115


Two-Sample Bernoulli Proportions Test

By the CLT and our confidence interval work from the previous module, we
know that for large n and m,
   
px (1 − px ) py (1 − py )
X̄ ≈ Nor px , and Ȳ ≈ Nor py , .
n m

Then
X̄ − Ȳ − (px − py )
q ≈ Nor(0, 1).
px (1−px ) py (1−py )
n + m

Moreover, under the null hypothesis, we have p ≡ px = py , in which case

X̄ − Ȳ
q  ≈ Nor(0, 1).
p(1 − p) n1 + 1

m

ISYE 6739 — Goldsman 3/2/20 80 / 115


Two-Sample Bernoulli Proportions Test

Of course, p in the above equation is unknown.

ISYE 6739 — Goldsman 3/2/20 81 / 115


Two-Sample Bernoulli Proportions Test

Of course, p in the above equation is unknown. But if H0 is true, then


p = px = py , so let’s estimate p by the pooled estimator,

ISYE 6739 — Goldsman 3/2/20 81 / 115


Two-Sample Bernoulli Proportions Test

Of course, p in the above equation is unknown. But if H0 is true, then


p = px = py , so let’s estimate p by the pooled estimator,
Pn Pm
i=1 Xi + j=1 Yj
p̂ ≡ .
n+m

ISYE 6739 — Goldsman 3/2/20 81 / 115


Two-Sample Bernoulli Proportions Test

Of course, p in the above equation is unknown. But if H0 is true, then


p = px = py , so let’s estimate p by the pooled estimator,
Pn Pm
i=1 Xi + j=1 Yj
p̂ ≡ .
n+m
Now plug this into the previous equation to get one last approximation — the
test statistic that we can finally work with:

ISYE 6739 — Goldsman 3/2/20 81 / 115


Two-Sample Bernoulli Proportions Test

Of course, p in the above equation is unknown. But if H0 is true, then


p = px = py , so let’s estimate p by the pooled estimator,
Pn Pm
i=1 Xi + j=1 Yj
p̂ ≡ .
n+m
Now plug this into the previous equation to get one last approximation — the
test statistic that we can finally work with:

X̄ − Ȳ
Z0 ≡ q  ≈ Nor(0, 1) (under H0 ).
p̂(1 − p̂) n1 + 1

m

ISYE 6739 — Goldsman 3/2/20 81 / 115


Two-Sample Bernoulli Proportions Test

Of course, p in the above equation is unknown. But if H0 is true, then


p = px = py , so let’s estimate p by the pooled estimator,
Pn Pm
i=1 Xi + j=1 Yj
p̂ ≡ .
n+m
Now plug this into the previous equation to get one last approximation — the
test statistic that we can finally work with:

X̄ − Ȳ
Z0 ≡ q  ≈ Nor(0, 1) (under H0 ).
p̂(1 − p̂) n1 + 1

m

Thus, for the two-sided test, we reject H0 iff |Z0 | > zα/2 .

ISYE 6739 — Goldsman 3/2/20 81 / 115


Two-Sample Bernoulli Proportions Test

Of course, p in the above equation is unknown. But if H0 is true, then


p = px = py , so let’s estimate p by the pooled estimator,
Pn Pm
i=1 Xi + j=1 Yj
p̂ ≡ .
n+m
Now plug this into the previous equation to get one last approximation — the
test statistic that we can finally work with:

X̄ − Ȳ
Z0 ≡ q  ≈ Nor(0, 1) (under H0 ).
p̂(1 − p̂) n1 + 1

m

Thus, for the two-sided test, we reject H0 iff |Z0 | > zα/2 .

One-Sided Tests:

ISYE 6739 — Goldsman 3/2/20 81 / 115


Two-Sample Bernoulli Proportions Test

Of course, p in the above equation is unknown. But if H0 is true, then


p = px = py , so let’s estimate p by the pooled estimator,
Pn Pm
i=1 Xi + j=1 Yj
p̂ ≡ .
n+m
Now plug this into the previous equation to get one last approximation — the
test statistic that we can finally work with:

X̄ − Ȳ
Z0 ≡ q  ≈ Nor(0, 1) (under H0 ).
p̂(1 − p̂) n1 + 1

m

Thus, for the two-sided test, we reject H0 iff |Z0 | > zα/2 .

One-Sided Tests:
H0 : px ≤ py vs. H1 : px > py

ISYE 6739 — Goldsman 3/2/20 81 / 115


Two-Sample Bernoulli Proportions Test

Of course, p in the above equation is unknown. But if H0 is true, then


p = px = py , so let’s estimate p by the pooled estimator,
Pn Pm
i=1 Xi + j=1 Yj
p̂ ≡ .
n+m
Now plug this into the previous equation to get one last approximation — the
test statistic that we can finally work with:

X̄ − Ȳ
Z0 ≡ q  ≈ Nor(0, 1) (under H0 ).
p̂(1 − p̂) n1 + 1

m

Thus, for the two-sided test, we reject H0 iff |Z0 | > zα/2 .

One-Sided Tests:
H0 : px ≤ py vs. H1 : px > py ⇒ reject H0 iff Z0 > zα .

ISYE 6739 — Goldsman 3/2/20 81 / 115


Two-Sample Bernoulli Proportions Test

Of course, p in the above equation is unknown. But if H0 is true, then


p = px = py , so let’s estimate p by the pooled estimator,
Pn Pm
i=1 Xi + j=1 Yj
p̂ ≡ .
n+m
Now plug this into the previous equation to get one last approximation — the
test statistic that we can finally work with:

X̄ − Ȳ
Z0 ≡ q  ≈ Nor(0, 1) (under H0 ).
p̂(1 − p̂) n1 + 1

m

Thus, for the two-sided test, we reject H0 iff |Z0 | > zα/2 .

One-Sided Tests:
H0 : px ≤ py vs. H1 : px > py ⇒ reject H0 iff Z0 > zα .
H0 : px ≥ py vs. H1 : px < py

ISYE 6739 — Goldsman 3/2/20 81 / 115


Two-Sample Bernoulli Proportions Test

Of course, p in the above equation is unknown. But if H0 is true, then


p = px = py , so let’s estimate p by the pooled estimator,
Pn Pm
i=1 Xi + j=1 Yj
p̂ ≡ .
n+m
Now plug this into the previous equation to get one last approximation — the
test statistic that we can finally work with:

X̄ − Ȳ
Z0 ≡ q  ≈ Nor(0, 1) (under H0 ).
p̂(1 − p̂) n1 + 1

m

Thus, for the two-sided test, we reject H0 iff |Z0 | > zα/2 .

One-Sided Tests:
H0 : px ≤ py vs. H1 : px > py ⇒ reject H0 iff Z0 > zα .
H0 : px ≥ py vs. H1 : px < py ⇒ reject H0 iff Z0 < −zα .

ISYE 6739 — Goldsman 3/2/20 81 / 115


Two-Sample Bernoulli Proportions Test

Example: Compare two restaurants based on customer reviews (either


yummy or nasty).

ISYE 6739 — Goldsman 3/2/20 82 / 115


Two-Sample Bernoulli Proportions Test

Example: Compare two restaurants based on customer reviews (either


yummy or nasty). Burger Fil-A got 178 yummies out of n = 260 reviews (+
82 nasties),

ISYE 6739 — Goldsman 3/2/20 82 / 115


Two-Sample Bernoulli Proportions Test

Example: Compare two restaurants based on customer reviews (either


yummy or nasty). Burger Fil-A got 178 yummies out of n = 260 reviews (+
82 nasties), while McWendy’s got 250 yummies (+ 50 nasties) out of
m = 300 reviews.

ISYE 6739 — Goldsman 3/2/20 82 / 115


Two-Sample Bernoulli Proportions Test

Example: Compare two restaurants based on customer reviews (either


yummy or nasty). Burger Fil-A got 178 yummies out of n = 260 reviews (+
82 nasties), while McWendy’s got 250 yummies (+ 50 nasties) out of
m = 300 reviews.

Test H0 : pb = pm vs. H1 : pb 6= pm at level α = 0.05.

ISYE 6739 — Goldsman 3/2/20 82 / 115


Two-Sample Bernoulli Proportions Test

Example: Compare two restaurants based on customer reviews (either


yummy or nasty). Burger Fil-A got 178 yummies out of n = 260 reviews (+
82 nasties), while McWendy’s got 250 yummies (+ 50 nasties) out of
m = 300 reviews.

Test H0 : pb = pm vs. H1 : pb 6= pm at level α = 0.05. We have


178
B̄ = = 0.6846,
260

ISYE 6739 — Goldsman 3/2/20 82 / 115


Two-Sample Bernoulli Proportions Test

Example: Compare two restaurants based on customer reviews (either


yummy or nasty). Burger Fil-A got 178 yummies out of n = 260 reviews (+
82 nasties), while McWendy’s got 250 yummies (+ 50 nasties) out of
m = 300 reviews.

Test H0 : pb = pm vs. H1 : pb 6= pm at level α = 0.05. We have


178 250
B̄ = = 0.6846, M̄ = = 0.8333,
260 300

ISYE 6739 — Goldsman 3/2/20 82 / 115


Two-Sample Bernoulli Proportions Test

Example: Compare two restaurants based on customer reviews (either


yummy or nasty). Burger Fil-A got 178 yummies out of n = 260 reviews (+
82 nasties), while McWendy’s got 250 yummies (+ 50 nasties) out of
m = 300 reviews.

Test H0 : pb = pm vs. H1 : pb 6= pm at level α = 0.05. We have


178 250 178 + 250
B̄ = = 0.6846, M̄ = = 0.8333, and p̂ = = 0.7643.
260 300 260 + 300

ISYE 6739 — Goldsman 3/2/20 82 / 115


Two-Sample Bernoulli Proportions Test

Example: Compare two restaurants based on customer reviews (either


yummy or nasty). Burger Fil-A got 178 yummies out of n = 260 reviews (+
82 nasties), while McWendy’s got 250 yummies (+ 50 nasties) out of
m = 300 reviews.

Test H0 : pb = pm vs. H1 : pb 6= pm at level α = 0.05. We have


178 250 178 + 250
B̄ = = 0.6846, M̄ = = 0.8333, and p̂ = = 0.7643.
260 300 260 + 300
This gives us

B̄ − M̄
Z0 = q
p̂(1 − p̂) n1 + 1
 
m

ISYE 6739 — Goldsman 3/2/20 82 / 115


Two-Sample Bernoulli Proportions Test

Example: Compare two restaurants based on customer reviews (either


yummy or nasty). Burger Fil-A got 178 yummies out of n = 260 reviews (+
82 nasties), while McWendy’s got 250 yummies (+ 50 nasties) out of
m = 300 reviews.

Test H0 : pb = pm vs. H1 : pb 6= pm at level α = 0.05. We have


178 250 178 + 250
B̄ = = 0.6846, M̄ = = 0.8333, and p̂ = = 0.7643.
260 300 260 + 300
This gives us

B̄ − M̄ 0.6846 − 0.8333
Z0 = q = q  = −4.135.
p̂(1 − p̂) n1 + 1
   1 1
m 0.7643(0.2357) 260 + 300

ISYE 6739 — Goldsman 3/2/20 82 / 115


Two-Sample Bernoulli Proportions Test

Example: Compare two restaurants based on customer reviews (either


yummy or nasty). Burger Fil-A got 178 yummies out of n = 260 reviews (+
82 nasties), while McWendy’s got 250 yummies (+ 50 nasties) out of
m = 300 reviews.

Test H0 : pb = pm vs. H1 : pb 6= pm at level α = 0.05. We have


178 250 178 + 250
B̄ = = 0.6846, M̄ = = 0.8333, and p̂ = = 0.7643.
260 300 260 + 300
This gives us

B̄ − M̄ 0.6846 − 0.8333
Z0 = q = q  = −4.135.
p̂(1 − p̂) n1 + 1
   1 1
m 0.7643(0.2357) 260 + 300

Since |Z0 | > z0.025 = 1.96, we easily reject H0 ,

ISYE 6739 — Goldsman 3/2/20 82 / 115


Two-Sample Bernoulli Proportions Test

Example: Compare two restaurants based on customer reviews (either


yummy or nasty). Burger Fil-A got 178 yummies out of n = 260 reviews (+
82 nasties), while McWendy’s got 250 yummies (+ 50 nasties) out of
m = 300 reviews.

Test H0 : pb = pm vs. H1 : pb 6= pm at level α = 0.05. We have


178 250 178 + 250
B̄ = = 0.6846, M̄ = = 0.8333, and p̂ = = 0.7643.
260 300 260 + 300
This gives us

B̄ − M̄ 0.6846 − 0.8333
Z0 = q = q  = −4.135.
p̂(1 − p̂) n1 + 1
   1 1
m 0.7643(0.2357) 260 + 300

Since |Z0 | > z0.025 = 1.96, we easily reject H0 , and informally declare
McWendy’s the winner. 2

ISYE 6739 — Goldsman 3/2/20 82 / 115


Goodness-of-Fit Tests: Introduction

1 Introduction to Hypothesis Testing


2 The Errors of Our Ways
3 Normal Mean Test with Known Variance
4 Normal Mean Test with Known Variance: Design
5 Two-Sample Normal Means Test with Known Variances
6 Normal Mean Test with Unknown Variance
7 Two-Sample Normal Means Tests with Unknown Variances
8 Two-Sample Normal Means Test with Paired Observations
9 Normal Variance Test
10 Two-Sample Normal Variances Test
11 Bernoulli Proportion Test
12 Two-Sample Bernoulli Proportions Test
13 Goodness-of-Fit Tests: Introduction
14 Goodness-of-Fit Tests: Examples
15 Goodness-of-Fit Tests: Honors Example
ISYE 6739 — Goldsman 3/2/20 83 / 115
Goodness-of-Fit Tests: Introduction

Lesson 7.13 — Goodness-of-Fit Tests: Introduction

ISYE 6739 — Goldsman 3/2/20 84 / 115


Goodness-of-Fit Tests: Introduction

Lesson 7.13 — Goodness-of-Fit Tests: Introduction

At this point, let’s suppose that we’ve guessed a reasonable distribution and
then estimated the relevant parameters.

ISYE 6739 — Goldsman 3/2/20 84 / 115


Goodness-of-Fit Tests: Introduction

Lesson 7.13 — Goodness-of-Fit Tests: Introduction

At this point, let’s suppose that we’ve guessed a reasonable distribution and
then estimated the relevant parameters. Now let’s conduct a formal test to see
just how successful our toils have been

ISYE 6739 — Goldsman 3/2/20 84 / 115


Goodness-of-Fit Tests: Introduction

Lesson 7.13 — Goodness-of-Fit Tests: Introduction

At this point, let’s suppose that we’ve guessed a reasonable distribution and
then estimated the relevant parameters. Now let’s conduct a formal test to see
just how successful our toils have been — in other words, is our hypothesized
distribution + relevant parameters acceptable?

ISYE 6739 — Goldsman 3/2/20 84 / 115


Goodness-of-Fit Tests: Introduction

Lesson 7.13 — Goodness-of-Fit Tests: Introduction

At this point, let’s suppose that we’ve guessed a reasonable distribution and
then estimated the relevant parameters. Now let’s conduct a formal test to see
just how successful our toils have been — in other words, is our hypothesized
distribution + relevant parameters acceptable?

In particular, we’ll carry out a goodness-of-fit test,

ISYE 6739 — Goldsman 3/2/20 84 / 115


Goodness-of-Fit Tests: Introduction

Lesson 7.13 — Goodness-of-Fit Tests: Introduction

At this point, let’s suppose that we’ve guessed a reasonable distribution and
then estimated the relevant parameters. Now let’s conduct a formal test to see
just how successful our toils have been — in other words, is our hypothesized
distribution + relevant parameters acceptable?

In particular, we’ll carry out a goodness-of-fit test,


iid
H0 : X1 , X2 , . . . , Xn ∼ pmf / pdf f (x).

ISYE 6739 — Goldsman 3/2/20 84 / 115


Goodness-of-Fit Tests: Introduction

Lesson 7.13 — Goodness-of-Fit Tests: Introduction

At this point, let’s suppose that we’ve guessed a reasonable distribution and
then estimated the relevant parameters. Now let’s conduct a formal test to see
just how successful our toils have been — in other words, is our hypothesized
distribution + relevant parameters acceptable?

In particular, we’ll carry out a goodness-of-fit test,


iid
H0 : X1 , X2 , . . . , Xn ∼ pmf / pdf f (x).

What’s Coming Up:


Introduction (this lesson)

ISYE 6739 — Goldsman 3/2/20 84 / 115


Goodness-of-Fit Tests: Introduction

Lesson 7.13 — Goodness-of-Fit Tests: Introduction

At this point, let’s suppose that we’ve guessed a reasonable distribution and
then estimated the relevant parameters. Now let’s conduct a formal test to see
just how successful our toils have been — in other words, is our hypothesized
distribution + relevant parameters acceptable?

In particular, we’ll carry out a goodness-of-fit test,


iid
H0 : X1 , X2 , . . . , Xn ∼ pmf / pdf f (x).

What’s Coming Up:


Introduction (this lesson)
Various examples (next lesson)

ISYE 6739 — Goldsman 3/2/20 84 / 115


Goodness-of-Fit Tests: Introduction

Lesson 7.13 — Goodness-of-Fit Tests: Introduction

At this point, let’s suppose that we’ve guessed a reasonable distribution and
then estimated the relevant parameters. Now let’s conduct a formal test to see
just how successful our toils have been — in other words, is our hypothesized
distribution + relevant parameters acceptable?

In particular, we’ll carry out a goodness-of-fit test,


iid
H0 : X1 , X2 , . . . , Xn ∼ pmf / pdf f (x).

What’s Coming Up:


Introduction (this lesson)
Various examples (next lesson)
A tough honors example (final lesson)

ISYE 6739 — Goldsman 3/2/20 84 / 115


Goodness-of-Fit Tests: Introduction

High-level view of a goodness-of-fit test procedure:

ISYE 6739 — Goldsman 3/2/20 85 / 115


Goodness-of-Fit Tests: Introduction

High-level view of a goodness-of-fit test procedure:


1. Divide the domain of f (x) into k sets, say, A1 , A2 , . . . , Ak

ISYE 6739 — Goldsman 3/2/20 85 / 115


Goodness-of-Fit Tests: Introduction

High-level view of a goodness-of-fit test procedure:


1. Divide the domain of f (x) into k sets, say, A1 , A2 , . . . , Ak (distinct
points if X is discrete, or intervals if X is continuous).

ISYE 6739 — Goldsman 3/2/20 85 / 115


Goodness-of-Fit Tests: Introduction

High-level view of a goodness-of-fit test procedure:


1. Divide the domain of f (x) into k sets, say, A1 , A2 , . . . , Ak (distinct
points if X is discrete, or intervals if X is continuous).
2. Tally the actual number of observations Oi that fall in set Ai ,
i = 1, 2, . . . , k.

ISYE 6739 — Goldsman 3/2/20 85 / 115


Goodness-of-Fit Tests: Introduction

High-level view of a goodness-of-fit test procedure:


1. Divide the domain of f (x) into k sets, say, A1 , A2 , . . . , Ak (distinct
points if X is discrete, or intervals if X is continuous).
2. Tally the actual number of observations Oi that fall in set Ai ,
i = 1, 2, . . . , k. Define pi ≡ P (X ∈ Ai ), so Oi ∼ Bin(n, pi ).

ISYE 6739 — Goldsman 3/2/20 85 / 115


Goodness-of-Fit Tests: Introduction

High-level view of a goodness-of-fit test procedure:


1. Divide the domain of f (x) into k sets, say, A1 , A2 , . . . , Ak (distinct
points if X is discrete, or intervals if X is continuous).
2. Tally the actual number of observations Oi that fall in set Ai ,
i = 1, 2, . . . , k. Define pi ≡ P (X ∈ Ai ), so Oi ∼ Bin(n, pi ).
3. Determine the expected number of observations that would fall in each
set if H0 were true,

ISYE 6739 — Goldsman 3/2/20 85 / 115


Goodness-of-Fit Tests: Introduction

High-level view of a goodness-of-fit test procedure:


1. Divide the domain of f (x) into k sets, say, A1 , A2 , . . . , Ak (distinct
points if X is discrete, or intervals if X is continuous).
2. Tally the actual number of observations Oi that fall in set Ai ,
i = 1, 2, . . . , k. Define pi ≡ P (X ∈ Ai ), so Oi ∼ Bin(n, pi ).
3. Determine the expected number of observations that would fall in each
set if H0 were true, say, Ei = E[Oi ] = npi , i = 1, 2, . . . , k.

ISYE 6739 — Goldsman 3/2/20 85 / 115


Goodness-of-Fit Tests: Introduction

High-level view of a goodness-of-fit test procedure:


1. Divide the domain of f (x) into k sets, say, A1 , A2 , . . . , Ak (distinct
points if X is discrete, or intervals if X is continuous).
2. Tally the actual number of observations Oi that fall in set Ai ,
i = 1, 2, . . . , k. Define pi ≡ P (X ∈ Ai ), so Oi ∼ Bin(n, pi ).
3. Determine the expected number of observations that would fall in each
set if H0 were true, say, Ei = E[Oi ] = npi , i = 1, 2, . . . , k.
4. Calculate a test statistic based on the differences between the Ei ’s and
Oi ’s.

ISYE 6739 — Goldsman 3/2/20 85 / 115


Goodness-of-Fit Tests: Introduction

High-level view of a goodness-of-fit test procedure:


1. Divide the domain of f (x) into k sets, say, A1 , A2 , . . . , Ak (distinct
points if X is discrete, or intervals if X is continuous).
2. Tally the actual number of observations Oi that fall in set Ai ,
i = 1, 2, . . . , k. Define pi ≡ P (X ∈ Ai ), so Oi ∼ Bin(n, pi ).
3. Determine the expected number of observations that would fall in each
set if H0 were true, say, Ei = E[Oi ] = npi , i = 1, 2, . . . , k.
4. Calculate a test statistic based on the differences between the Ei ’s and
Oi ’s. The chi-squared g-o-f test statistic is
k
X (Oi − Ei )2
χ20 ≡ .
Ei
i=1

ISYE 6739 — Goldsman 3/2/20 85 / 115


Goodness-of-Fit Tests: Introduction

High-level view of a goodness-of-fit test procedure:


1. Divide the domain of f (x) into k sets, say, A1 , A2 , . . . , Ak (distinct
points if X is discrete, or intervals if X is continuous).
2. Tally the actual number of observations Oi that fall in set Ai ,
i = 1, 2, . . . , k. Define pi ≡ P (X ∈ Ai ), so Oi ∼ Bin(n, pi ).
3. Determine the expected number of observations that would fall in each
set if H0 were true, say, Ei = E[Oi ] = npi , i = 1, 2, . . . , k.
4. Calculate a test statistic based on the differences between the Ei ’s and
Oi ’s. The chi-squared g-o-f test statistic is
k
X (Oi − Ei )2
χ20 ≡ .
Ei
i=1

Why does the above test statistic remind me of Old McDonald’s Farm?

ISYE 6739 — Goldsman 3/2/20 85 / 115


Goodness-of-Fit Tests: Introduction

5. A large value of χ20 indicates a bad fit (so just do one-sided test).

ISYE 6739 — Goldsman 3/2/20 86 / 115


Goodness-of-Fit Tests: Introduction

5. A large value of χ20 indicates a bad fit (so just do one-sided test).

We reject H0 if χ20 > χ2α,k−1−s , where

ISYE 6739 — Goldsman 3/2/20 86 / 115


Goodness-of-Fit Tests: Introduction

5. A large value of χ20 indicates a bad fit (so just do one-sided test).

We reject H0 if χ20 > χ2α,k−1−s , where

s is the number of unknown parameters from f (x) that have to be


estimated.

ISYE 6739 — Goldsman 3/2/20 86 / 115


Goodness-of-Fit Tests: Introduction

5. A large value of χ20 indicates a bad fit (so just do one-sided test).

We reject H0 if χ20 > χ2α,k−1−s , where

s is the number of unknown parameters from f (x) that have to be


estimated. E.g., if X ∼ Nor(µ, σ 2 ), then s = 2.

ISYE 6739 — Goldsman 3/2/20 86 / 115


Goodness-of-Fit Tests: Introduction

5. A large value of χ20 indicates a bad fit (so just do one-sided test).

We reject H0 if χ20 > χ2α,k−1−s , where

s is the number of unknown parameters from f (x) that have to be


estimated. E.g., if X ∼ Nor(µ, σ 2 ), then s = 2.

χ2α,ν is the (1 − α) quantile of the χ2 (ν) distribution,

ISYE 6739 — Goldsman 3/2/20 86 / 115


Goodness-of-Fit Tests: Introduction

5. A large value of χ20 indicates a bad fit (so just do one-sided test).

We reject H0 if χ20 > χ2α,k−1−s , where

s is the number of unknown parameters from f (x) that have to be


estimated. E.g., if X ∼ Nor(µ, σ 2 ), then s = 2.

χ2α,ν is the (1 − α) quantile of the χ2 (ν) distribution, i.e.,



P χ2 (ν) < χ2α,ν = 1 − α.

ISYE 6739 — Goldsman 3/2/20 86 / 115


Goodness-of-Fit Tests: Introduction

5. A large value of χ20 indicates a bad fit (so just do one-sided test).

We reject H0 if χ20 > χ2α,k−1−s , where

s is the number of unknown parameters from f (x) that have to be


estimated. E.g., if X ∼ Nor(µ, σ 2 ), then s = 2.

χ2α,ν is the (1 − α) quantile of the χ2 (ν) distribution, i.e.,



P χ2 (ν) < χ2α,ν = 1 − α.

If χ20 ≤ χ2α,k−1−s , we fail to reject (grudgingly accept) H0 .

ISYE 6739 — Goldsman 3/2/20 86 / 115


Goodness-of-Fit Tests: Introduction

Remarks:

ISYE 6739 — Goldsman 3/2/20 87 / 115


Goodness-of-Fit Tests: Introduction

Remarks:
Usual recommendation: For the χ2 g-o-f test to work, pick k, n such that
Ei ≥ 5 for all i, and n is at least 30.

ISYE 6739 — Goldsman 3/2/20 87 / 115


Goodness-of-Fit Tests: Introduction

Remarks:
Usual recommendation: For the χ2 g-o-f test to work, pick k, n such that
Ei ≥ 5 for all i, and n is at least 30.

If the df ν = k − 1 − s happens to be very big, then

ISYE 6739 — Goldsman 3/2/20 87 / 115


Goodness-of-Fit Tests: Introduction

Remarks:
Usual recommendation: For the χ2 g-o-f test to work, pick k, n such that
Ei ≥ 5 for all i, and n is at least 30.

If the df ν = k − 1 − s happens to be very big, then


" r #3
2 2
χ2α,ν ≈ ν 1− + zα ,
9ν 9ν

ISYE 6739 — Goldsman 3/2/20 87 / 115


Goodness-of-Fit Tests: Introduction

Remarks:
Usual recommendation: For the χ2 g-o-f test to work, pick k, n such that
Ei ≥ 5 for all i, and n is at least 30.

If the df ν = k − 1 − s happens to be very big, then


" r #3
2 2
χ2α,ν ≈ ν 1− + zα ,
9ν 9ν

where zα is the appropriate standard normal quantile.

ISYE 6739 — Goldsman 3/2/20 87 / 115


Goodness-of-Fit Tests: Introduction

Remarks:
Usual recommendation: For the χ2 g-o-f test to work, pick k, n such that
Ei ≥ 5 for all i, and n is at least 30.

If the df ν = k − 1 − s happens to be very big, then


" r #3
2 2
χ2α,ν ≈ ν 1− + zα ,
9ν 9ν

where zα is the appropriate standard normal quantile.

Other g-o-f tests: Kolmogorov–Smirnov, Anderson–Darling,


Shapiro–Wilk, etc.

ISYE 6739 — Goldsman 3/2/20 87 / 115


Goodness-of-Fit Tests: Introduction

Baby Example: Test H0 : Xi ’s are Unif(0,1), with α = 0.05.

ISYE 6739 — Goldsman 3/2/20 88 / 115


Goodness-of-Fit Tests: Introduction

Baby Example: Test H0 : Xi ’s are Unif(0,1), with α = 0.05.

Suppose we have n = 1000 observations divided into k = 5 equal-length


intervals.

ISYE 6739 — Goldsman 3/2/20 88 / 115


Goodness-of-Fit Tests: Introduction

Baby Example: Test H0 : Xi ’s are Unif(0,1), with α = 0.05.

Suppose we have n = 1000 observations divided into k = 5 equal-length


intervals.

interval [0,0.2] (0.2,0.4] (0.4,0.6] (0.6,0.8] (0.8,1.0]

ISYE 6739 — Goldsman 3/2/20 88 / 115


Goodness-of-Fit Tests: Introduction

Baby Example: Test H0 : Xi ’s are Unif(0,1), with α = 0.05.

Suppose we have n = 1000 observations divided into k = 5 equal-length


intervals.

interval [0,0.2] (0.2,0.4] (0.4,0.6] (0.6,0.8] (0.8,1.0]


pi 0.2 0.2 0.2 0.2 0.2

ISYE 6739 — Goldsman 3/2/20 88 / 115


Goodness-of-Fit Tests: Introduction

Baby Example: Test H0 : Xi ’s are Unif(0,1), with α = 0.05.

Suppose we have n = 1000 observations divided into k = 5 equal-length


intervals.

interval [0,0.2] (0.2,0.4] (0.4,0.6] (0.6,0.8] (0.8,1.0]


pi 0.2 0.2 0.2 0.2 0.2
Ei = npi 200 200 200 200 200

ISYE 6739 — Goldsman 3/2/20 88 / 115


Goodness-of-Fit Tests: Introduction

Baby Example: Test H0 : Xi ’s are Unif(0,1), with α = 0.05.

Suppose we have n = 1000 observations divided into k = 5 equal-length


intervals.

interval [0,0.2] (0.2,0.4] (0.4,0.6] (0.6,0.8] (0.8,1.0]


pi 0.2 0.2 0.2 0.2 0.2
Ei = npi 200 200 200 200 200
Oi 179 208 222 199 192

ISYE 6739 — Goldsman 3/2/20 88 / 115


Goodness-of-Fit Tests: Introduction

Baby Example: Test H0 : Xi ’s are Unif(0,1), with α = 0.05.

Suppose we have n = 1000 observations divided into k = 5 equal-length


intervals.

interval [0,0.2] (0.2,0.4] (0.4,0.6] (0.6,0.8] (0.8,1.0]


pi 0.2 0.2 0.2 0.2 0.2
Ei = npi 200 200 200 200 200
Oi 179 208 222 199 192
Pk
It turns out that χ20 ≡ i=1 (Oi − Ei )2 /Ei = 5.27.

ISYE 6739 — Goldsman 3/2/20 88 / 115


Goodness-of-Fit Tests: Introduction

Baby Example: Test H0 : Xi ’s are Unif(0,1), with α = 0.05.

Suppose we have n = 1000 observations divided into k = 5 equal-length


intervals.

interval [0,0.2] (0.2,0.4] (0.4,0.6] (0.6,0.8] (0.8,1.0]


pi 0.2 0.2 0.2 0.2 0.2
Ei = npi 200 200 200 200 200
Oi 179 208 222 199 192
Pk
It turns out that χ20 ≡ i=1 (Oi − Ei )2 /Ei = 5.27.

No unknown parameters, so s = 0.

ISYE 6739 — Goldsman 3/2/20 88 / 115


Goodness-of-Fit Tests: Introduction

Baby Example: Test H0 : Xi ’s are Unif(0,1), with α = 0.05.

Suppose we have n = 1000 observations divided into k = 5 equal-length


intervals.

interval [0,0.2] (0.2,0.4] (0.4,0.6] (0.6,0.8] (0.8,1.0]


pi 0.2 0.2 0.2 0.2 0.2
Ei = npi 200 200 200 200 200
Oi 179 208 222 199 192
Pk
It turns out that χ20 ≡ i=1 (Oi − Ei )2 /Ei = 5.27.

No unknown parameters, so s = 0. Then χ2α,k−1−s = χ20.05,4 = 9.49.

ISYE 6739 — Goldsman 3/2/20 88 / 115


Goodness-of-Fit Tests: Introduction

Baby Example: Test H0 : Xi ’s are Unif(0,1), with α = 0.05.

Suppose we have n = 1000 observations divided into k = 5 equal-length


intervals.

interval [0,0.2] (0.2,0.4] (0.4,0.6] (0.6,0.8] (0.8,1.0]


pi 0.2 0.2 0.2 0.2 0.2
Ei = npi 200 200 200 200 200
Oi 179 208 222 199 192
Pk
It turns out that χ20 ≡ i=1 (Oi − Ei )2 /Ei = 5.27.

No unknown parameters, so s = 0. Then χ2α,k−1−s = χ20.05,4 = 9.49.

Since χ20 ≤ χ2α,k−1−s , we fail to reject H0 . So we’ll grudgingly pretend that


the numbers are uniform. 2

ISYE 6739 — Goldsman 3/2/20 88 / 115


Goodness-of-Fit Tests: Examples

1 Introduction to Hypothesis Testing


2 The Errors of Our Ways
3 Normal Mean Test with Known Variance
4 Normal Mean Test with Known Variance: Design
5 Two-Sample Normal Means Test with Known Variances
6 Normal Mean Test with Unknown Variance
7 Two-Sample Normal Means Tests with Unknown Variances
8 Two-Sample Normal Means Test with Paired Observations
9 Normal Variance Test
10 Two-Sample Normal Variances Test
11 Bernoulli Proportion Test
12 Two-Sample Bernoulli Proportions Test
13 Goodness-of-Fit Tests: Introduction
14 Goodness-of-Fit Tests: Examples
15 Goodness-of-Fit Tests: Honors Example
ISYE 6739 — Goldsman 3/2/20 89 / 115
Goodness-of-Fit Tests: Examples

Lesson 7.14 — Goodness-of-Fit Tests: Examples

ISYE 6739 — Goldsman 3/2/20 90 / 115


Goodness-of-Fit Tests: Examples

Lesson 7.14 — Goodness-of-Fit Tests: Examples

We’ll do a couple of detailed examples in this lesson.

ISYE 6739 — Goldsman 3/2/20 90 / 115


Goodness-of-Fit Tests: Examples

Lesson 7.14 — Goodness-of-Fit Tests: Examples

We’ll do a couple of detailed examples in this lesson.

Discrete Example: The number of defects in printed circuit boards is


hypothesized to follow a Geometric(p) distribution.

ISYE 6739 — Goldsman 3/2/20 90 / 115


Goodness-of-Fit Tests: Examples

Lesson 7.14 — Goodness-of-Fit Tests: Examples

We’ll do a couple of detailed examples in this lesson.

Discrete Example: The number of defects in printed circuit boards is


hypothesized to follow a Geometric(p) distribution. We collect a random
sample of n = 70 printed boards, and we observe the number of defects in
each.

ISYE 6739 — Goldsman 3/2/20 90 / 115


Goodness-of-Fit Tests: Examples

Lesson 7.14 — Goodness-of-Fit Tests: Examples

We’ll do a couple of detailed examples in this lesson.

Discrete Example: The number of defects in printed circuit boards is


hypothesized to follow a Geometric(p) distribution. We collect a random
sample of n = 70 printed boards, and we observe the number of defects in
each.
# defects frequency
1 34
2 18
3 2
4 9
5 7
70

ISYE 6739 — Goldsman 3/2/20 90 / 115


Goodness-of-Fit Tests: Examples

Start by getting the maximum likelihood estimator for the geometric


parameter p. The likelihood function is

ISYE 6739 — Goldsman 3/2/20 91 / 115


Goodness-of-Fit Tests: Examples

Start by getting the maximum likelihood estimator for the geometric


parameter p. The likelihood function is
n
Y
L(p) = f (xi )
i=1

ISYE 6739 — Goldsman 3/2/20 91 / 115


Goodness-of-Fit Tests: Examples

Start by getting the maximum likelihood estimator for the geometric


parameter p. The likelihood function is
n
Y n
Y
L(p) = f (xi ) = (1 − p)xi −1 p
i=1 i=1

ISYE 6739 — Goldsman 3/2/20 91 / 115


Goodness-of-Fit Tests: Examples

Start by getting the maximum likelihood estimator for the geometric


parameter p. The likelihood function is
n
Y n
Y Pn
L(p) = f (xi ) = (1 − p)xi −1 p = (1 − p) i=1 xi −n n
p
i=1 i=1

ISYE 6739 — Goldsman 3/2/20 91 / 115


Goodness-of-Fit Tests: Examples

Start by getting the maximum likelihood estimator for the geometric


parameter p. The likelihood function is
n
Y n
Y Pn
L(p) = f (xi ) = (1 − p)xi −1 p = (1 − p) i=1 xi −n n
p
i=1 i=1
n
X 
`n(L(p)) = xi − n `n(1 − p) + n `n(p)
i=1

ISYE 6739 — Goldsman 3/2/20 91 / 115


Goodness-of-Fit Tests: Examples

Start by getting the maximum likelihood estimator for the geometric


parameter p. The likelihood function is
n
Y n
Y Pn
L(p) = f (xi ) = (1 − p)xi −1 p = (1 − p) i=1 xi −n n
p
i=1 i=1
n
X 
`n(L(p)) = xi − n `n(1 − p) + n `n(p)
i=1
Pn
d `n(L(p)) − i=1 xi + n n
= + = 0.
dp 1−p p

ISYE 6739 — Goldsman 3/2/20 91 / 115


Goodness-of-Fit Tests: Examples

Start by getting the maximum likelihood estimator for the geometric


parameter p. The likelihood function is
n
Y n
Y Pn
L(p) = f (xi ) = (1 − p)xi −1 p = (1 − p) i=1 xi −n n
p
i=1 i=1
n
X 
`n(L(p)) = xi − n `n(1 − p) + n `n(p)
i=1
Pn
d `n(L(p)) − i=1 xi + n n
= + = 0.
dp 1−p p
Solving for p gives the MLE,
1
p̂ =

ISYE 6739 — Goldsman 3/2/20 91 / 115


Goodness-of-Fit Tests: Examples

Start by getting the maximum likelihood estimator for the geometric


parameter p. The likelihood function is
n
Y n
Y Pn
L(p) = f (xi ) = (1 − p)xi −1 p = (1 − p) i=1 xi −n n
p
i=1 i=1
n
X 
`n(L(p)) = xi − n `n(1 − p) + n `n(p)
i=1
Pn
d `n(L(p)) − i=1 xi + n n
= + = 0.
dp 1−p p
Solving for p gives the MLE,
1 70
p̂ = = = 0.4762.
X̄ 1(34) + 2(18) + 3(2) + 4(9) + 5(7)

ISYE 6739 — Goldsman 3/2/20 91 / 115


Goodness-of-Fit Tests: Examples

Let’s get the g-o-f test statistic, χ20 .

ISYE 6739 — Goldsman 3/2/20 92 / 115


Goodness-of-Fit Tests: Examples

Let’s get the g-o-f test statistic, χ20 . We’ll make a little table, assuming
p̂ = 0.4762 is correct.

ISYE 6739 — Goldsman 3/2/20 92 / 115


Goodness-of-Fit Tests: Examples

Let’s get the g-o-f test statistic, χ20 . We’ll make a little table, assuming
p̂ = 0.4762 is correct. By the Invariance Property of MLEs (this is why we
learned it!),

ISYE 6739 — Goldsman 3/2/20 92 / 115


Goodness-of-Fit Tests: Examples

Let’s get the g-o-f test statistic, χ20 . We’ll make a little table, assuming
p̂ = 0.4762 is correct. By the Invariance Property of MLEs (this is why we
learned it!), the expected number of boards having a certain value x is
Ex = nP (X = x) = n(1 − p̂)x−1 p̂ (assuming p̂ is actually p).

ISYE 6739 — Goldsman 3/2/20 92 / 115


Goodness-of-Fit Tests: Examples

Let’s get the g-o-f test statistic, χ20 . We’ll make a little table, assuming
p̂ = 0.4762 is correct. By the Invariance Property of MLEs (this is why we
learned it!), the expected number of boards having a certain value x is
Ex = nP (X = x) = n(1 − p̂)x−1 p̂ (assuming p̂ is actually p).

x P (X = x) Ex Ox

ISYE 6739 — Goldsman 3/2/20 92 / 115


Goodness-of-Fit Tests: Examples

Let’s get the g-o-f test statistic, χ20 . We’ll make a little table, assuming
p̂ = 0.4762 is correct. By the Invariance Property of MLEs (this is why we
learned it!), the expected number of boards having a certain value x is
Ex = nP (X = x) = n(1 − p̂)x−1 p̂ (assuming p̂ is actually p).

x P (X = x) Ex Ox
1 0.4762 33.33 34

ISYE 6739 — Goldsman 3/2/20 92 / 115


Goodness-of-Fit Tests: Examples

Let’s get the g-o-f test statistic, χ20 . We’ll make a little table, assuming
p̂ = 0.4762 is correct. By the Invariance Property of MLEs (this is why we
learned it!), the expected number of boards having a certain value x is
Ex = nP (X = x) = n(1 − p̂)x−1 p̂ (assuming p̂ is actually p).

x P (X = x) Ex Ox
1 0.4762 33.33 34
2 0.2494 17.46 18

ISYE 6739 — Goldsman 3/2/20 92 / 115


Goodness-of-Fit Tests: Examples

Let’s get the g-o-f test statistic, χ20 . We’ll make a little table, assuming
p̂ = 0.4762 is correct. By the Invariance Property of MLEs (this is why we
learned it!), the expected number of boards having a certain value x is
Ex = nP (X = x) = n(1 − p̂)x−1 p̂ (assuming p̂ is actually p).

x P (X = x) Ex Ox
1 0.4762 33.33 34
2 0.2494 17.46 18
3 0.1307 9.15 2
4 0.0684 4.79 9
≥ 5? 0.0753 5.27 7
1.0000 70 70

ISYE 6739 — Goldsman 3/2/20 92 / 115


Goodness-of-Fit Tests: Examples

Let’s get the g-o-f test statistic, χ20 . We’ll make a little table, assuming
p̂ = 0.4762 is correct. By the Invariance Property of MLEs (this is why we
learned it!), the expected number of boards having a certain value x is
Ex = nP (X = x) = n(1 − p̂)x−1 p̂ (assuming p̂ is actually p).

x P (X = x) Ex Ox
1 0.4762 33.33 34
2 0.2494 17.46 18
3 0.1307 9.15 2
4 0.0684 4.79 9
≥ 5? 0.0753 5.27 7
1.0000 70 70
? Combine the entries in the last row (≥ 5) so the probabilities sum to one.

ISYE 6739 — Goldsman 3/2/20 92 / 115


Goodness-of-Fit Tests: Examples

Well, we really ought to combine the last two cells too, since E4 = 4.79 < 5.

ISYE 6739 — Goldsman 3/2/20 93 / 115


Goodness-of-Fit Tests: Examples

Well, we really ought to combine the last two cells too, since E4 = 4.79 < 5.
Let’s do so to get the following “improved” table.

ISYE 6739 — Goldsman 3/2/20 93 / 115


Goodness-of-Fit Tests: Examples

Well, we really ought to combine the last two cells too, since E4 = 4.79 < 5.
Let’s do so to get the following “improved” table.

x P (X = x) Ex Ox
1 0.4762 33.33 34
2 0.2494 17.46 18
3 0.1307 9.15 2
≥4 0.1437 10.06 16
1.0000 70 70

ISYE 6739 — Goldsman 3/2/20 93 / 115


Goodness-of-Fit Tests: Examples

Well, we really ought to combine the last two cells too, since E4 = 4.79 < 5.
Let’s do so to get the following “improved” table.

x P (X = x) Ex Ox
1 0.4762 33.33 34
2 0.2494 17.46 18
3 0.1307 9.15 2
≥4 0.1437 10.06 16
1.0000 70 70

Thus, the test statistic is


4
X (Ex − Ox )2
χ20 =
Ex
x=1

ISYE 6739 — Goldsman 3/2/20 93 / 115


Goodness-of-Fit Tests: Examples

Well, we really ought to combine the last two cells too, since E4 = 4.79 < 5.
Let’s do so to get the following “improved” table.

x P (X = x) Ex Ox
1 0.4762 33.33 34
2 0.2494 17.46 18
3 0.1307 9.15 2
≥4 0.1437 10.06 16
1.0000 70 70

Thus, the test statistic is


4
X (Ex − Ox )2 (33.33 − 34)2
χ20 = = + · · · = 9.12.
Ex 33.33
x=1

ISYE 6739 — Goldsman 3/2/20 93 / 115


Goodness-of-Fit Tests: Examples

Let k = 4 denote the number of cells (that we ultimately ended up with),

ISYE 6739 — Goldsman 3/2/20 94 / 115


Goodness-of-Fit Tests: Examples

Let k = 4 denote the number of cells (that we ultimately ended up with), and
let s = 1 denote the number of parameters we had to estimate.

ISYE 6739 — Goldsman 3/2/20 94 / 115


Goodness-of-Fit Tests: Examples

Let k = 4 denote the number of cells (that we ultimately ended up with), and
let s = 1 denote the number of parameters we had to estimate.

Suppose the level α = 0.05.

ISYE 6739 — Goldsman 3/2/20 94 / 115


Goodness-of-Fit Tests: Examples

Let k = 4 denote the number of cells (that we ultimately ended up with), and
let s = 1 denote the number of parameters we had to estimate.

Suppose the level α = 0.05.

Then we compare χ20 = 9.12 against χ2α,k−1−s = χ20.05,2 = 5.99.

ISYE 6739 — Goldsman 3/2/20 94 / 115


Goodness-of-Fit Tests: Examples

Let k = 4 denote the number of cells (that we ultimately ended up with), and
let s = 1 denote the number of parameters we had to estimate.

Suppose the level α = 0.05.

Then we compare χ20 = 9.12 against χ2α,k−1−s = χ20.05,2 = 5.99.

Since χ20 > χ2α,k−1−s , we reject H0 .

ISYE 6739 — Goldsman 3/2/20 94 / 115


Goodness-of-Fit Tests: Examples

Let k = 4 denote the number of cells (that we ultimately ended up with), and
let s = 1 denote the number of parameters we had to estimate.

Suppose the level α = 0.05.

Then we compare χ20 = 9.12 against χ2α,k−1−s = χ20.05,2 = 5.99.

Since χ20 > χ2α,k−1−s , we reject H0 .

This means that the number of defects probably isn’t geometric. 2

ISYE 6739 — Goldsman 3/2/20 94 / 115


Goodness-of-Fit Tests: Examples

Continuous Distributions:

ISYE 6739 — Goldsman 3/2/20 95 / 115


Goodness-of-Fit Tests: Examples

Continuous Distributions: For the continuous case, let’s denote the


intervals Ai ≡ (ai−1 , ai ], i = 1, 2, . . . , k.

ISYE 6739 — Goldsman 3/2/20 95 / 115


Goodness-of-Fit Tests: Examples

Continuous Distributions: For the continuous case, let’s denote the


intervals Ai ≡ (ai−1 , ai ], i = 1, 2, . . . , k. For convenience, we choose the ai ’s
to ensure that we have equal-probability intervals,

ISYE 6739 — Goldsman 3/2/20 95 / 115


Goodness-of-Fit Tests: Examples

Continuous Distributions: For the continuous case, let’s denote the


intervals Ai ≡ (ai−1 , ai ], i = 1, 2, . . . , k. For convenience, we choose the ai ’s
to ensure that we have equal-probability intervals, i.e.,

pi = P (X ∈ Ai )

ISYE 6739 — Goldsman 3/2/20 95 / 115


Goodness-of-Fit Tests: Examples

Continuous Distributions: For the continuous case, let’s denote the


intervals Ai ≡ (ai−1 , ai ], i = 1, 2, . . . , k. For convenience, we choose the ai ’s
to ensure that we have equal-probability intervals, i.e.,

pi = P (X ∈ Ai ) = P (ai−1 < X ≤ ai )

ISYE 6739 — Goldsman 3/2/20 95 / 115


Goodness-of-Fit Tests: Examples

Continuous Distributions: For the continuous case, let’s denote the


intervals Ai ≡ (ai−1 , ai ], i = 1, 2, . . . , k. For convenience, we choose the ai ’s
to ensure that we have equal-probability intervals, i.e.,

pi = P (X ∈ Ai ) = P (ai−1 < X ≤ ai ) = 1/k for all i.

ISYE 6739 — Goldsman 3/2/20 95 / 115


Goodness-of-Fit Tests: Examples

Continuous Distributions: For the continuous case, let’s denote the


intervals Ai ≡ (ai−1 , ai ], i = 1, 2, . . . , k. For convenience, we choose the ai ’s
to ensure that we have equal-probability intervals, i.e.,

pi = P (X ∈ Ai ) = P (ai−1 < X ≤ ai ) = 1/k for all i.

In this case, we immediately have Ei = n/k for all i, and then

ISYE 6739 — Goldsman 3/2/20 95 / 115


Goodness-of-Fit Tests: Examples

Continuous Distributions: For the continuous case, let’s denote the


intervals Ai ≡ (ai−1 , ai ], i = 1, 2, . . . , k. For convenience, we choose the ai ’s
to ensure that we have equal-probability intervals, i.e.,

pi = P (X ∈ Ai ) = P (ai−1 < X ≤ ai ) = 1/k for all i.

In this case, we immediately have Ei = n/k for all i, and then


k
X (Oi − (n/k))2
χ20 = .
n/k
i=1

ISYE 6739 — Goldsman 3/2/20 95 / 115


Goodness-of-Fit Tests: Examples

Continuous Distributions: For the continuous case, let’s denote the


intervals Ai ≡ (ai−1 , ai ], i = 1, 2, . . . , k. For convenience, we choose the ai ’s
to ensure that we have equal-probability intervals, i.e.,

pi = P (X ∈ Ai ) = P (ai−1 < X ≤ ai ) = 1/k for all i.

In this case, we immediately have Ei = n/k for all i, and then


k
X (Oi − (n/k))2
χ20 = .
n/k
i=1

The issue is that the ai ’s might depend on unknown parameters.

ISYE 6739 — Goldsman 3/2/20 95 / 115


Goodness-of-Fit Tests: Examples

Example: Suppose that we’re interested in fitting a distribution to a series of


interarrival times.

ISYE 6739 — Goldsman 3/2/20 96 / 115


Goodness-of-Fit Tests: Examples

Example: Suppose that we’re interested in fitting a distribution to a series of


interarrival times. Could they be Exponential?

ISYE 6739 — Goldsman 3/2/20 96 / 115


Goodness-of-Fit Tests: Examples

Example: Suppose that we’re interested in fitting a distribution to a series of


interarrival times. Could they be Exponential?
iid
H0 : X1 , X2 , . . . , Xn ∼ Exp(λ).

ISYE 6739 — Goldsman 3/2/20 96 / 115


Goodness-of-Fit Tests: Examples

Example: Suppose that we’re interested in fitting a distribution to a series of


interarrival times. Could they be Exponential?
iid
H0 : X1 , X2 , . . . , Xn ∼ Exp(λ).

Let’s do a χ2 g-o-f test with equal-probability intervals.

ISYE 6739 — Goldsman 3/2/20 96 / 115


Goodness-of-Fit Tests: Examples

Example: Suppose that we’re interested in fitting a distribution to a series of


interarrival times. Could they be Exponential?
iid
H0 : X1 , X2 , . . . , Xn ∼ Exp(λ).

Let’s do a χ2 g-o-f test with equal-probability intervals.

This amounts to choosing ai ’s such that the cdf

ISYE 6739 — Goldsman 3/2/20 96 / 115


Goodness-of-Fit Tests: Examples

Example: Suppose that we’re interested in fitting a distribution to a series of


interarrival times. Could they be Exponential?
iid
H0 : X1 , X2 , . . . , Xn ∼ Exp(λ).

Let’s do a χ2 g-o-f test with equal-probability intervals.

This amounts to choosing ai ’s such that the cdf

F (ai ) = P (X ≤ ai )

ISYE 6739 — Goldsman 3/2/20 96 / 115


Goodness-of-Fit Tests: Examples

Example: Suppose that we’re interested in fitting a distribution to a series of


interarrival times. Could they be Exponential?
iid
H0 : X1 , X2 , . . . , Xn ∼ Exp(λ).

Let’s do a χ2 g-o-f test with equal-probability intervals.

This amounts to choosing ai ’s such that the cdf

F (ai ) = P (X ≤ ai ) = 1 − e−λai

ISYE 6739 — Goldsman 3/2/20 96 / 115


Goodness-of-Fit Tests: Examples

Example: Suppose that we’re interested in fitting a distribution to a series of


interarrival times. Could they be Exponential?
iid
H0 : X1 , X2 , . . . , Xn ∼ Exp(λ).

Let’s do a χ2 g-o-f test with equal-probability intervals.

This amounts to choosing ai ’s such that the cdf


i
F (ai ) = P (X ≤ ai ) = 1 − e−λai = , i = 0, 1, 2, . . . , k.
k

ISYE 6739 — Goldsman 3/2/20 96 / 115


Goodness-of-Fit Tests: Examples

Example: Suppose that we’re interested in fitting a distribution to a series of


interarrival times. Could they be Exponential?
iid
H0 : X1 , X2 , . . . , Xn ∼ Exp(λ).

Let’s do a χ2 g-o-f test with equal-probability intervals.

This amounts to choosing ai ’s such that the cdf


i
F (ai ) = P (X ≤ ai ) = 1 − e−λai = , i = 0, 1, 2, . . . , k.
k
That is, after a wee bit of algebra,

ISYE 6739 — Goldsman 3/2/20 96 / 115


Goodness-of-Fit Tests: Examples

Example: Suppose that we’re interested in fitting a distribution to a series of


interarrival times. Could they be Exponential?
iid
H0 : X1 , X2 , . . . , Xn ∼ Exp(λ).

Let’s do a χ2 g-o-f test with equal-probability intervals.

This amounts to choosing ai ’s such that the cdf


i
F (ai ) = P (X ≤ ai ) = 1 − e−λai = , i = 0, 1, 2, . . . , k.
k
That is, after a wee bit of algebra,
1  i
ai = − `n 1 − , i = 0, 1, 2, . . . , k.
λ k

ISYE 6739 — Goldsman 3/2/20 96 / 115


Goodness-of-Fit Tests: Examples

Great, but λ is unknown (so we’ll need to estimate s = 1 parameter).

ISYE 6739 — Goldsman 3/2/20 97 / 115


Goodness-of-Fit Tests: Examples

Great, but λ is unknown (so we’ll need to estimate s = 1 parameter).

Good News: We know that the MLE is λ


b = 1/X̄.

ISYE 6739 — Goldsman 3/2/20 97 / 115


Goodness-of-Fit Tests: Examples

Great, but λ is unknown (so we’ll need to estimate s = 1 parameter).

Good News: We know that the MLE is λb = 1/X̄. Thus, by the Invariance
Property, the MLEs of the ai ’s are

ISYE 6739 — Goldsman 3/2/20 97 / 115


Goodness-of-Fit Tests: Examples

Great, but λ is unknown (so we’ll need to estimate s = 1 parameter).

Good News: We know that the MLE is λb = 1/X̄. Thus, by the Invariance
Property, the MLEs of the ai ’s are
1  i
ai = − `n 1 −
b
λ
b k

ISYE 6739 — Goldsman 3/2/20 97 / 115


Goodness-of-Fit Tests: Examples

Great, but λ is unknown (so we’ll need to estimate s = 1 parameter).

Good News: We know that the MLE is λb = 1/X̄. Thus, by the Invariance
Property, the MLEs of the ai ’s are
1  i  i
ai = − `n 1 −
b = −X̄ `n 1 − , i = 0, 1, 2, . . . , k.
λ
b k k

ISYE 6739 — Goldsman 3/2/20 97 / 115


Goodness-of-Fit Tests: Examples

Great, but λ is unknown (so we’ll need to estimate s = 1 parameter).

Good News: We know that the MLE is λb = 1/X̄. Thus, by the Invariance
Property, the MLEs of the ai ’s are
1  i  i
ai = − `n 1 −
b = −X̄ `n 1 − , i = 0, 1, 2, . . . , k.
λ
b k k

Continue the Example: We take n = 100 observations and divide them into
k = 10 equal-probability intervals, so that Ei = n/k = 10 for all i.

ISYE 6739 — Goldsman 3/2/20 97 / 115


Goodness-of-Fit Tests: Examples

Great, but λ is unknown (so we’ll need to estimate s = 1 parameter).

Good News: We know that the MLE is λb = 1/X̄. Thus, by the Invariance
Property, the MLEs of the ai ’s are
1  i  i
ai = − `n 1 −
b = −X̄ `n 1 − , i = 0, 1, 2, . . . , k.
λ
b k k

Continue the Example: We take n = 100 observations and divide them into
k = 10 equal-probability intervals, so that Ei = n/k = 10 for all i. Suppose
that the sample mean based on the 100 observations is X̄ = 0.8778.

ISYE 6739 — Goldsman 3/2/20 97 / 115


Goodness-of-Fit Tests: Examples

Great, but λ is unknown (so we’ll need to estimate s = 1 parameter).

Good News: We know that the MLE is λb = 1/X̄. Thus, by the Invariance
Property, the MLEs of the ai ’s are
1  i  i
ai = − `n 1 −
b = −X̄ `n 1 − , i = 0, 1, 2, . . . , k.
λ
b k k

Continue the Example: We take n = 100 observations and divide them into
k = 10 equal-probability intervals, so that Ei = n/k = 10 for all i. Suppose
that the sample mean based on the 100 observations is X̄ = 0.8778. Then

ai = −0.8778 `n 1 − 0.1i , i = 0, 1, 2, . . . , 10.
b

ISYE 6739 — Goldsman 3/2/20 97 / 115


Goodness-of-Fit Tests: Examples

Great, but λ is unknown (so we’ll need to estimate s = 1 parameter).

Good News: We know that the MLE is λb = 1/X̄. Thus, by the Invariance
Property, the MLEs of the ai ’s are
1  i  i
ai = − `n 1 −
b = −X̄ `n 1 − , i = 0, 1, 2, . . . , k.
λ
b k k

Continue the Example: We take n = 100 observations and divide them into
k = 10 equal-probability intervals, so that Ei = n/k = 10 for all i. Suppose
that the sample mean based on the 100 observations is X̄ = 0.8778. Then

ai = −0.8778 `n 1 − 0.1i , i = 0, 1, 2, . . . , 10.
b

Further suppose we determine which interval each of the 100 observations


belongs to and tally them up to get the Oi ’s. . . .

ISYE 6739 — Goldsman 3/2/20 97 / 115


Goodness-of-Fit Tests: Examples

interval (âi−1 , âi ] Oi Ei = n/k


[0, 0.092] 0 10
(0.092, 0.196] 1 10
(0.196, 0.313] 1 10
(0.313, 0.448] 6 10
(0.448, 0.608] 17 10
(0.608, 0.804] 21 10
(0.804, 1.057] 23 10
(1.057, 1.413] 24 10
(1.413, 2.021] 7 10
(2.021, ∞) 0 10
100 100

ISYE 6739 — Goldsman 3/2/20 98 / 115


Goodness-of-Fit Tests: Examples

interval (âi−1 , âi ] Oi Ei = n/k


[0, 0.092] 0 10
(0.092, 0.196] 1 10
(0.196, 0.313] 1 10
(0.313, 0.448] 6 10
(0.448, 0.608] 17 10
(0.608, 0.804] 21 10
(0.804, 1.057] 23 10
(1.057, 1.413] 24 10
(1.413, 2.021] 7 10
(2.021, ∞) 0 10
100 100
k
X
χ20 = (Oi − Ei )2 /Ei = 92.2
i=1

ISYE 6739 — Goldsman 3/2/20 98 / 115


Goodness-of-Fit Tests: Examples

interval (âi−1 , âi ] Oi Ei = n/k


[0, 0.092] 0 10
(0.092, 0.196] 1 10
(0.196, 0.313] 1 10
(0.313, 0.448] 6 10
(0.448, 0.608] 17 10
(0.608, 0.804] 21 10
(0.804, 1.057] 23 10
(1.057, 1.413] 24 10
(1.413, 2.021] 7 10
(2.021, ∞) 0 10
100 100
k
X
χ20 = (Oi − Ei )2 /Ei = 92.2 and χ2α,k−1−s = χ20.05,8 = 15.51.
i=1

ISYE 6739 — Goldsman 3/2/20 98 / 115


Goodness-of-Fit Tests: Examples

interval (âi−1 , âi ] Oi Ei = n/k


[0, 0.092] 0 10
(0.092, 0.196] 1 10
(0.196, 0.313] 1 10
(0.313, 0.448] 6 10
(0.448, 0.608] 17 10
(0.608, 0.804] 21 10
(0.804, 1.057] 23 10
(1.057, 1.413] 24 10
(1.413, 2.021] 7 10
(2.021, ∞) 0 10
100 100
k
X
χ20 = (Oi − Ei )2 /Ei = 92.2 and χ2α,k−1−s = χ20.05,8 = 15.51.
i=1

So reject H0 . These guys ain’t Expo. No way, no how.


ISYE 6739 — Goldsman 3/2/20 98 / 115
Goodness-of-Fit Tests: Honors Example

1 Introduction to Hypothesis Testing


2 The Errors of Our Ways
3 Normal Mean Test with Known Variance
4 Normal Mean Test with Known Variance: Design
5 Two-Sample Normal Means Test with Known Variances
6 Normal Mean Test with Unknown Variance
7 Two-Sample Normal Means Tests with Unknown Variances
8 Two-Sample Normal Means Test with Paired Observations
9 Normal Variance Test
10 Two-Sample Normal Variances Test
11 Bernoulli Proportion Test
12 Two-Sample Bernoulli Proportions Test
13 Goodness-of-Fit Tests: Introduction
14 Goodness-of-Fit Tests: Examples
15 Goodness-of-Fit Tests: Honors Example
ISYE 6739 — Goldsman 3/2/20 99 / 115
Goodness-of-Fit Tests: Honors Example

Lesson 7.15 — Goodness-of-Fit Tests: Honors Example

ISYE 6739 — Goldsman 3/2/20 100 / 115


Goodness-of-Fit Tests: Honors Example

Lesson 7.15 — Goodness-of-Fit Tests: Honors Example

Let’s make things more interesting with an extended example / mini-project.

ISYE 6739 — Goldsman 3/2/20 100 / 115


Goodness-of-Fit Tests: Honors Example

Lesson 7.15 — Goodness-of-Fit Tests: Honors Example

Let’s make things more interesting with an extended example / mini-project.

We consider the same sample of 100 iid observations from the end of the last
lesson, now with some more details.
0.9448 0.8332 0.6811 ··· 0.5635

ISYE 6739 — Goldsman 3/2/20 100 / 115


Goodness-of-Fit Tests: Honors Example

Lesson 7.15 — Goodness-of-Fit Tests: Honors Example

Let’s make things more interesting with an extended example / mini-project.

We consider the same sample of 100 iid observations from the end of the last
lesson, now with some more details.
0.9448 0.8332 0.6811 ··· 0.5635
The sample mean for this data set is X̄ = 0.8778, and the sample standard
deviation is S = 0.3347. Here’s what the little fella looks like:

ISYE 6739 — Goldsman 3/2/20 100 / 115


Goodness-of-Fit Tests: Honors Example

Lesson 7.15 — Goodness-of-Fit Tests: Honors Example

Let’s make things more interesting with an extended example / mini-project.

We consider the same sample of 100 iid observations from the end of the last
lesson, now with some more details.
0.9448 0.8332 0.6811 ··· 0.5635
The sample mean for this data set is X̄ = 0.8778, and the sample standard
deviation is S = 0.3347. Here’s what the little fella looks like:

ISYE 6739 — Goldsman 3/2/20 100 / 115


Goodness-of-Fit Tests: Honors Example

In this lesson, we’ll do various goodness-of-fit tests to determine which


distribution(s) the data could come from.
iid
H0 : X1 , X2 , . . . , Xn ∼ f (x),

ISYE 6739 — Goldsman 3/2/20 101 / 115


Goodness-of-Fit Tests: Honors Example

In this lesson, we’ll do various goodness-of-fit tests to determine which


distribution(s) the data could come from.
iid
H0 : X1 , X2 , . . . , Xn ∼ f (x),

where we’ll consider the following possibilities:


Exponential (rejected in the previous lesson).
Gamma (which generalizes the exponential).
Weibull (which generalizes the exponential in a different way).

ISYE 6739 — Goldsman 3/2/20 101 / 115


Goodness-of-Fit Tests: Honors Example

In this lesson, we’ll do various goodness-of-fit tests to determine which


distribution(s) the data could come from.
iid
H0 : X1 , X2 , . . . , Xn ∼ f (x),

where we’ll consider the following possibilities:


Exponential (rejected in the previous lesson).
Gamma (which generalizes the exponential).
Weibull (which generalizes the exponential in a different way).

In each case, we’ll divide the data into k = 10 equal-probability intervals and
perform a χ2 g-o-f test at level α = 0.05.

ISYE 6739 — Goldsman 3/2/20 101 / 115


Goodness-of-Fit Tests: Honors Example

In this lesson, we’ll do various goodness-of-fit tests to determine which


distribution(s) the data could come from.
iid
H0 : X1 , X2 , . . . , Xn ∼ f (x),

where we’ll consider the following possibilities:


Exponential (rejected in the previous lesson).
Gamma (which generalizes the exponential).
Weibull (which generalizes the exponential in a different way).

In each case, we’ll divide the data into k = 10 equal-probability intervals and
perform a χ2 g-o-f test at level α = 0.05.

Along the way, we’ll encounter a number of interesting issues that we’ll need
to deal with; but it’ll all work out in the end.

ISYE 6739 — Goldsman 3/2/20 101 / 115


Goodness-of-Fit Tests: Honors Example

Exponential: In the previous lesson, we tested the null hypothesis that


iid
H0 : X1 , X2 , . . . , Xn ∼ Exp(λ).

ISYE 6739 — Goldsman 3/2/20 102 / 115


Goodness-of-Fit Tests: Honors Example

Exponential: In the previous lesson, we tested the null hypothesis that


iid
H0 : X1 , X2 , . . . , Xn ∼ Exp(λ).

Recall that we failed miserably.

ISYE 6739 — Goldsman 3/2/20 102 / 115


Goodness-of-Fit Tests: Honors Example

Exponential: In the previous lesson, we tested the null hypothesis that


iid
H0 : X1 , X2 , . . . , Xn ∼ Exp(λ).

Recall that we failed miserably.

But, in retrospect, this makes sense in light of the facts that:

ISYE 6739 — Goldsman 3/2/20 102 / 115


Goodness-of-Fit Tests: Honors Example

Exponential: In the previous lesson, we tested the null hypothesis that


iid
H0 : X1 , X2 , . . . , Xn ∼ Exp(λ).

Recall that we failed miserably.

But, in retrospect, this makes sense in light of the facts that:


The graph doesn’t look anywhere near exponential.

ISYE 6739 — Goldsman 3/2/20 102 / 115


Goodness-of-Fit Tests: Honors Example

Exponential: In the previous lesson, we tested the null hypothesis that


iid
H0 : X1 , X2 , . . . , Xn ∼ Exp(λ).

Recall that we failed miserably.

But, in retrospect, this makes sense in light of the facts that:


The graph doesn’t look anywhere near exponential.
The expected value and standard deviation of an Exp(λ) random variable
are both 1/λ; yet the sample mean X̄ = 0.8778 is  the sample
standard deviation S = 0.3347.

ISYE 6739 — Goldsman 3/2/20 102 / 115


Goodness-of-Fit Tests: Honors Example

Exponential: In the previous lesson, we tested the null hypothesis that


iid
H0 : X1 , X2 , . . . , Xn ∼ Exp(λ).

Recall that we failed miserably.

But, in retrospect, this makes sense in light of the facts that:


The graph doesn’t look anywhere near exponential.
The expected value and standard deviation of an Exp(λ) random variable
are both 1/λ; yet the sample mean X̄ = 0.8778 is  the sample
standard deviation S = 0.3347.

So this motivates our need to look at other distributions in our quest to find a
good data fit.

ISYE 6739 — Goldsman 3/2/20 102 / 115


Goodness-of-Fit Tests: Honors Example

Gamma: The Gamma distribution with parameters r and λ has pdf

ISYE 6739 — Goldsman 3/2/20 103 / 115


Goodness-of-Fit Tests: Honors Example

Gamma: The Gamma distribution with parameters r and λ has pdf

λr r−1 −λx
f (x) = x e , x > 0.
Γ(r)

ISYE 6739 — Goldsman 3/2/20 103 / 115


Goodness-of-Fit Tests: Honors Example

Gamma: The Gamma distribution with parameters r and λ has pdf

λr r−1 −λx
f (x) = x e , x > 0.
Γ(r)

Note that r = 1 yields the Exp(λ) as a special case.

ISYE 6739 — Goldsman 3/2/20 103 / 115


Goodness-of-Fit Tests: Honors Example

Gamma: The Gamma distribution with parameters r and λ has pdf

λr r−1 −λx
f (x) = x e , x > 0.
Γ(r)

Note that r = 1 yields the Exp(λ) as a special case. We’ll test


iid
H0 : X1 , X2 , . . . , Xn ∼ Gam(r, λ).

ISYE 6739 — Goldsman 3/2/20 103 / 115


Goodness-of-Fit Tests: Honors Example

Gamma: The Gamma distribution with parameters r and λ has pdf

λr r−1 −λx
f (x) = x e , x > 0.
Γ(r)

Note that r = 1 yields the Exp(λ) as a special case. We’ll test


iid
H0 : X1 , X2 , . . . , Xn ∼ Gam(r, λ).

Way back in the good old days, we found the MLEs for r and λ:

ISYE 6739 — Goldsman 3/2/20 103 / 115


Goodness-of-Fit Tests: Honors Example

Gamma: The Gamma distribution with parameters r and λ has pdf

λr r−1 −λx
f (x) = x e , x > 0.
Γ(r)

Note that r = 1 yields the Exp(λ) as a special case. We’ll test


iid
H0 : X1 , X2 , . . . , Xn ∼ Gam(r, λ).

Way back in the good old days, we found the MLEs for r and λ:

λ̂ = r̂/X̄,

ISYE 6739 — Goldsman 3/2/20 103 / 115


Goodness-of-Fit Tests: Honors Example

Gamma: The Gamma distribution with parameters r and λ has pdf

λr r−1 −λx
f (x) = x e , x > 0.
Γ(r)

Note that r = 1 yields the Exp(λ) as a special case. We’ll test


iid
H0 : X1 , X2 , . . . , Xn ∼ Gam(r, λ).

Way back in the good old days, we found the MLEs for r and λ:

λ̂ = r̂/X̄,

where r̂ solves
n
Y 
g(r) ≡ n `n(r/X̄) − nΨ(r) + `n Xi = 0,
i=1

ISYE 6739 — Goldsman 3/2/20 103 / 115


Goodness-of-Fit Tests: Honors Example

Gamma: The Gamma distribution with parameters r and λ has pdf

λr r−1 −λx
f (x) = x e , x > 0.
Γ(r)

Note that r = 1 yields the Exp(λ) as a special case. We’ll test


iid
H0 : X1 , X2 , . . . , Xn ∼ Gam(r, λ).

Way back in the good old days, we found the MLEs for r and λ:

λ̂ = r̂/X̄,

where r̂ solves
n
Y 
g(r) ≡ n `n(r/X̄) − nΨ(r) + `n Xi = 0,
i=1

and where Ψ(r) ≡ Γ0 (r)/Γ(r) is the digamma function.


ISYE 6739 — Goldsman 3/2/20 103 / 115
Goodness-of-Fit Tests: Honors Example

Since the digamma is sometimes a little hard to find in the usual software
packages, we’ll incorporate the approximation

. Γ(r + h) − Γ(r)
Γ0 (r) = (for any small h of your choosing).
h

ISYE 6739 — Goldsman 3/2/20 104 / 115


Goodness-of-Fit Tests: Honors Example

Since the digamma is sometimes a little hard to find in the usual software
packages, we’ll incorporate the approximation

. Γ(r + h) − Γ(r)
Γ0 (r) = (for any small h of your choosing).
h
So we need to find r̂ that solves
n
. n  Γ(r + h)  Y 
g(r) = n `n(r) − n `n(X̄) − − 1 + `n Xi = 0. (1)
h Γ(r)
i=1

ISYE 6739 — Goldsman 3/2/20 104 / 115


Goodness-of-Fit Tests: Honors Example

Since the digamma is sometimes a little hard to find in the usual software
packages, we’ll incorporate the approximation

. Γ(r + h) − Γ(r)
Γ0 (r) = (for any small h of your choosing).
h
So we need to find r̂ that solves
n
. n  Γ(r + h)  Y 
g(r) = n `n(r) − n `n(X̄) − − 1 + `n Xi = 0. (1)
h Γ(r)
i=1

How to solve for a zero?

ISYE 6739 — Goldsman 3/2/20 104 / 115


Goodness-of-Fit Tests: Honors Example

Since the digamma is sometimes a little hard to find in the usual software
packages, we’ll incorporate the approximation

. Γ(r + h) − Γ(r)
Γ0 (r) = (for any small h of your choosing).
h
So we need to find r̂ that solves
n
. n  Γ(r + h)  Y 
g(r) = n `n(r) − n `n(X̄) − − 1 + `n Xi = 0. (1)
h Γ(r)
i=1

How to solve for a zero?


trial-and-error or by some sort of linear search — that’s for losers!

ISYE 6739 — Goldsman 3/2/20 104 / 115


Goodness-of-Fit Tests: Honors Example

Since the digamma is sometimes a little hard to find in the usual software
packages, we’ll incorporate the approximation

. Γ(r + h) − Γ(r)
Γ0 (r) = (for any small h of your choosing).
h
So we need to find r̂ that solves
n
. n  Γ(r + h)  Y 
g(r) = n `n(r) − n `n(X̄) − − 1 + `n Xi = 0. (1)
h Γ(r)
i=1

How to solve for a zero?


trial-and-error or by some sort of linear search — that’s for losers!
bisection method — let’s try it here!

ISYE 6739 — Goldsman 3/2/20 104 / 115


Goodness-of-Fit Tests: Honors Example

Since the digamma is sometimes a little hard to find in the usual software
packages, we’ll incorporate the approximation

. Γ(r + h) − Γ(r)
Γ0 (r) = (for any small h of your choosing).
h
So we need to find r̂ that solves
n
. n  Γ(r + h)  Y 
g(r) = n `n(r) − n `n(X̄) − − 1 + `n Xi = 0. (1)
h Γ(r)
i=1

How to solve for a zero?


trial-and-error or by some sort of linear search — that’s for losers!
bisection method — let’s try it here!
Newton’s method — stay tuned!

ISYE 6739 — Goldsman 3/2/20 104 / 115


Goodness-of-Fit Tests: Honors Example

Bisection is an easy way to find a zero of any continuous function g(r).

ISYE 6739 — Goldsman 3/2/20 105 / 115


Goodness-of-Fit Tests: Honors Example

Bisection is an easy way to find a zero of any continuous function g(r). It


relies on the Intermediate Value Theorem (IVT), which states that if
g(`)g(u) < 0, then there is a zero r? ∈ [`, u].

ISYE 6739 — Goldsman 3/2/20 105 / 115


Goodness-of-Fit Tests: Honors Example

Bisection is an easy way to find a zero of any continuous function g(r). It


relies on the Intermediate Value Theorem (IVT), which states that if
g(`)g(u) < 0, then there is a zero r? ∈ [`, u]. Using this fact, it’s easy to hone
in on a zero via sequential bisecting:

ISYE 6739 — Goldsman 3/2/20 105 / 115


Goodness-of-Fit Tests: Honors Example

Bisection is an easy way to find a zero of any continuous function g(r). It


relies on the Intermediate Value Theorem (IVT), which states that if
g(`)g(u) < 0, then there is a zero r? ∈ [`, u]. Using this fact, it’s easy to hone
in on a zero via sequential bisecting:
Initialization: Find lower and upper bounds `0 < u0 such that
g(`0 )g(u0 ) < 0. Then the IVT implies that r? ∈ [`0 , u0 ].

ISYE 6739 — Goldsman 3/2/20 105 / 115


Goodness-of-Fit Tests: Honors Example

Bisection is an easy way to find a zero of any continuous function g(r). It


relies on the Intermediate Value Theorem (IVT), which states that if
g(`)g(u) < 0, then there is a zero r? ∈ [`, u]. Using this fact, it’s easy to hone
in on a zero via sequential bisecting:
Initialization: Find lower and upper bounds `0 < u0 such that
g(`0 )g(u0 ) < 0. Then the IVT implies that r? ∈ [`0 , u0 ].
For j = 0, 1, 2, . . .,

ISYE 6739 — Goldsman 3/2/20 105 / 115


Goodness-of-Fit Tests: Honors Example

Bisection is an easy way to find a zero of any continuous function g(r). It


relies on the Intermediate Value Theorem (IVT), which states that if
g(`)g(u) < 0, then there is a zero r? ∈ [`, u]. Using this fact, it’s easy to hone
in on a zero via sequential bisecting:
Initialization: Find lower and upper bounds `0 < u0 such that
g(`0 )g(u0 ) < 0. Then the IVT implies that r? ∈ [`0 , u0 ].
For j = 0, 1, 2, . . .,
Let the midpoint of the current interval be rj ← (`j + uj )/2.

ISYE 6739 — Goldsman 3/2/20 105 / 115


Goodness-of-Fit Tests: Honors Example

Bisection is an easy way to find a zero of any continuous function g(r). It


relies on the Intermediate Value Theorem (IVT), which states that if
g(`)g(u) < 0, then there is a zero r? ∈ [`, u]. Using this fact, it’s easy to hone
in on a zero via sequential bisecting:
Initialization: Find lower and upper bounds `0 < u0 such that
g(`0 )g(u0 ) < 0. Then the IVT implies that r? ∈ [`0 , u0 ].
For j = 0, 1, 2, . . .,
Let the midpoint of the current interval be rj ← (`j + uj )/2.
If g(rj ) is sufficiently close to 0, or the interval width uj − `j is
sufficiently small, or your iteration budget is exceeded, then set r? ← rj
and STOP.

ISYE 6739 — Goldsman 3/2/20 105 / 115


Goodness-of-Fit Tests: Honors Example

Bisection is an easy way to find a zero of any continuous function g(r). It


relies on the Intermediate Value Theorem (IVT), which states that if
g(`)g(u) < 0, then there is a zero r? ∈ [`, u]. Using this fact, it’s easy to hone
in on a zero via sequential bisecting:
Initialization: Find lower and upper bounds `0 < u0 such that
g(`0 )g(u0 ) < 0. Then the IVT implies that r? ∈ [`0 , u0 ].
For j = 0, 1, 2, . . .,
Let the midpoint of the current interval be rj ← (`j + uj )/2.
If g(rj ) is sufficiently close to 0, or the interval width uj − `j is
sufficiently small, or your iteration budget is exceeded, then set r? ← rj
and STOP.
If the sign of g(rj ) matches that of g(`j ), this means that r? ∈ [rj , uj ]; so
set `j+1 ← rj and uj+1 ← uj .

ISYE 6739 — Goldsman 3/2/20 105 / 115


Goodness-of-Fit Tests: Honors Example

Bisection is an easy way to find a zero of any continuous function g(r). It


relies on the Intermediate Value Theorem (IVT), which states that if
g(`)g(u) < 0, then there is a zero r? ∈ [`, u]. Using this fact, it’s easy to hone
in on a zero via sequential bisecting:
Initialization: Find lower and upper bounds `0 < u0 such that
g(`0 )g(u0 ) < 0. Then the IVT implies that r? ∈ [`0 , u0 ].
For j = 0, 1, 2, . . .,
Let the midpoint of the current interval be rj ← (`j + uj )/2.
If g(rj ) is sufficiently close to 0, or the interval width uj − `j is
sufficiently small, or your iteration budget is exceeded, then set r? ← rj
and STOP.
If the sign of g(rj ) matches that of g(`j ), this means that r? ∈ [rj , uj ]; so
set `j+1 ← rj and uj+1 ← uj . Otherwise, r? ∈ [`j , rj ]; so set `j+1 ← `j
and uj+1 ← rj .

ISYE 6739 — Goldsman 3/2/20 105 / 115


Goodness-of-Fit Tests: Honors Example

Bisection is an easy way to find a zero of any continuous function g(r). It


relies on the Intermediate Value Theorem (IVT), which states that if
g(`)g(u) < 0, then there is a zero r? ∈ [`, u]. Using this fact, it’s easy to hone
in on a zero via sequential bisecting:
Initialization: Find lower and upper bounds `0 < u0 such that
g(`0 )g(u0 ) < 0. Then the IVT implies that r? ∈ [`0 , u0 ].
For j = 0, 1, 2, . . .,
Let the midpoint of the current interval be rj ← (`j + uj )/2.
If g(rj ) is sufficiently close to 0, or the interval width uj − `j is
sufficiently small, or your iteration budget is exceeded, then set r? ← rj
and STOP.
If the sign of g(rj ) matches that of g(`j ), this means that r? ∈ [rj , uj ]; so
set `j+1 ← rj and uj+1 ← uj . Otherwise, r? ∈ [`j , rj ]; so set `j+1 ← `j
and uj+1 ← rj .
Each iteration of the algorithm chops the search area in two and therefore
converges to r? pretty quickly.

ISYE 6739 — Goldsman 3/2/20 105 / 115


Goodness-of-Fit Tests: Honors Example

Let’s try bisection out on our dataset of n = 100 observations, where we


recall that the sample mean is x̄ = 0.8778.

ISYE 6739 — Goldsman 3/2/20 106 / 115


Goodness-of-Fit Tests: Honors Example

Let’s try bisection out on our dataset of n = 100 observations, where we


recall
Qthat
n  sample mean is x̄ = 0.8778. And trust me that
the
`n i=1 xi = −21.5623.

ISYE 6739 — Goldsman 3/2/20 106 / 115


Goodness-of-Fit Tests: Honors Example

Let’s try bisection out on our dataset of n = 100 observations, where we


recall
Qthat
n  sample mean is x̄ = 0.8778. And trust me that
the
`n i=1 xi = −21.5623.

Let’s take the approximate differentiation term h = 0.01. Then here’s what
Equation (1) simplifies to:

. 100  Γ(r + 0.01) 


g(r) = 100 `n(r) − 100 `n(0.8778) − − 1 − 21.5623
0.01 Γ(r)

ISYE 6739 — Goldsman 3/2/20 106 / 115


Goodness-of-Fit Tests: Honors Example

Let’s try bisection out on our dataset of n = 100 observations, where we


recall
Qthat
n  sample mean is x̄ = 0.8778. And trust me that
the
`n i=1 xi = −21.5623.

Let’s take the approximate differentiation term h = 0.01. Then here’s what
Equation (1) simplifies to:

. 100  Γ(r + 0.01) 


g(r) = 100 `n(r) − 100 `n(0.8778) − − 1 − 21.5623
0.01 Γ(r)
10000 Γ(r + 0.01)
= 100 `n(r) − + 9991.47 = 0.
Γ(r)

ISYE 6739 — Goldsman 3/2/20 106 / 115


Goodness-of-Fit Tests: Honors Example

Let’s try bisection out on our dataset of n = 100 observations, where we


recall
Qthat
n  sample mean is x̄ = 0.8778. And trust me that
the
`n i=1 xi = −21.5623.

Let’s take the approximate differentiation term h = 0.01. Then here’s what
Equation (1) simplifies to:

. 100  Γ(r + 0.01) 


g(r) = 100 `n(r) − 100 `n(0.8778) − − 1 − 21.5623
0.01 Γ(r)
10000 Γ(r + 0.01)
= 100 `n(r) − + 9991.47 = 0.
Γ(r)

In order to initialize the bisection algorithm, we note that g(5) = 0.5506 and
g(7) = −3.0595. So there’s a zero in there somewhere just itching to be
found!

ISYE 6739 — Goldsman 3/2/20 106 / 115


Goodness-of-Fit Tests: Honors Example

Let’s try bisection out on our dataset of n = 100 observations, where we


recall
Qthat
n  sample mean is x̄ = 0.8778. And trust me that
the
`n i=1 xi = −21.5623.

Let’s take the approximate differentiation term h = 0.01. Then here’s what
Equation (1) simplifies to:

. 100  Γ(r + 0.01) 


g(r) = 100 `n(r) − 100 `n(0.8778) − − 1 − 21.5623
0.01 Γ(r)
10000 Γ(r + 0.01)
= 100 `n(r) − + 9991.47 = 0.
Γ(r)

In order to initialize the bisection algorithm, we note that g(5) = 0.5506 and
g(7) = −3.0595. So there’s a zero in there somewhere just itching to be
found!

The algorithm is depicted in all of its glory in the next table.

ISYE 6739 — Goldsman 3/2/20 106 / 115


Goodness-of-Fit Tests: Honors Example

step `j g(`j ) uj g(uj ) rj g(rj )

ISYE 6739 — Goldsman 3/2/20 107 / 115


Goodness-of-Fit Tests: Honors Example

step `j g(`j ) uj g(uj ) rj g(rj )


0 5.0000 0.5506 7.0000 −3.0595 6.0000 −1.5210

ISYE 6739 — Goldsman 3/2/20 107 / 115


Goodness-of-Fit Tests: Honors Example

step `j g(`j ) uj g(uj ) rj g(rj )


0 5.0000 0.5506 7.0000 −3.0595 6.0000 −1.5210
1 5.0000 0.5506 6.0000 −1.5210 5.5000 −0.5698

ISYE 6739 — Goldsman 3/2/20 107 / 115


Goodness-of-Fit Tests: Honors Example

step `j g(`j ) uj g(uj ) rj g(rj )


0 5.0000 0.5506 7.0000 −3.0595 6.0000 −1.5210
1 5.0000 0.5506 6.0000 −1.5210 5.5000 −0.5698
2 5.0000 0.5506 5.5000 −0.5698 5.2500 −0.0338

ISYE 6739 — Goldsman 3/2/20 107 / 115


Goodness-of-Fit Tests: Honors Example

step `j g(`j ) uj g(uj ) rj g(rj )


0 5.0000 0.5506 7.0000 −3.0595 6.0000 −1.5210
1 5.0000 0.5506 6.0000 −1.5210 5.5000 −0.5698
2 5.0000 0.5506 5.5000 −0.5698 5.2500 −0.0338
3 5.0000 0.5506 5.2500 −0.0338 5.1250 0.2519
4 5.1250 0.2519 5.2500 −0.0338 5.1875 0.1075
5 5.1875 0.1075 5.2500 −0.0338 5.2188 0.0365
6 5.2188 0.0365 5.2500 −0.0338 5.2344 0.0013
7 5.2344 0.0013 5.2500 −0.0338 5.2422 −0.0163
..
.
14 5.2349 0.0000 5.2349 0.0000 r ? = 5.2349 0.0000

ISYE 6739 — Goldsman 3/2/20 107 / 115


Goodness-of-Fit Tests: Honors Example

We see that the algorithm eventually gives r̂ = r? = 5.2349; and then


λ̂ = r̂/X̄ = 5.9637.

ISYE 6739 — Goldsman 3/2/20 108 / 115


Goodness-of-Fit Tests: Honors Example

We see that the algorithm eventually gives r̂ = r? = 5.2349; and then


λ̂ = r̂/X̄ = 5.9637.

So now we can start our χ2 goodness-of-fit toils, noting that we have s = 2


unknown parameters.

ISYE 6739 — Goldsman 3/2/20 108 / 115


Goodness-of-Fit Tests: Honors Example

We see that the algorithm eventually gives r̂ = r? = 5.2349; and then


λ̂ = r̂/X̄ = 5.9637.

So now we can start our χ2 goodness-of-fit toils, noting that we have s = 2


unknown parameters.

We take the n = 100 observations and divide them into k = 10


equal-probability intervals, so that Ei = n/k = 10 for all i.

ISYE 6739 — Goldsman 3/2/20 108 / 115


Goodness-of-Fit Tests: Honors Example

We see that the algorithm eventually gives r̂ = r? = 5.2349; and then


λ̂ = r̂/X̄ = 5.9637.

So now we can start our χ2 goodness-of-fit toils, noting that we have s = 2


unknown parameters.

We take the n = 100 observations and divide them into k = 10


equal-probability intervals, so that Ei = n/k = 10 for all i.

The (approximate) endpoints of the intervals are implicitly given by


Fb(âi ) = i/k, i = 0, 1, 2, . . . , k, where Fb(x) is the cdf of the Gam(r̂, λ̂)
distribution.

ISYE 6739 — Goldsman 3/2/20 108 / 115


Goodness-of-Fit Tests: Honors Example

We see that the algorithm eventually gives r̂ = r? = 5.2349; and then


λ̂ = r̂/X̄ = 5.9637.

So now we can start our χ2 goodness-of-fit toils, noting that we have s = 2


unknown parameters.

We take the n = 100 observations and divide them into k = 10


equal-probability intervals, so that Ei = n/k = 10 for all i.

The (approximate) endpoints of the intervals are implicitly given by


Fb(âi ) = i/k, i = 0, 1, 2, . . . , k, where Fb(x) is the cdf of the Gam(r̂, λ̂)
distribution.

Sadly, gamma distribution’s cdf doesn’t have a closed-form.

ISYE 6739 — Goldsman 3/2/20 108 / 115


Goodness-of-Fit Tests: Honors Example

We see that the algorithm eventually gives r̂ = r? = 5.2349; and then


λ̂ = r̂/X̄ = 5.9637.

So now we can start our χ2 goodness-of-fit toils, noting that we have s = 2


unknown parameters.

We take the n = 100 observations and divide them into k = 10


equal-probability intervals, so that Ei = n/k = 10 for all i.

The (approximate) endpoints of the intervals are implicitly given by


Fb(âi ) = i/k, i = 0, 1, 2, . . . , k, where Fb(x) is the cdf of the Gam(r̂, λ̂)
distribution.

Sadly, gamma distribution’s cdf doesn’t have a closed-form. But that’s why
we have Excel (or its friends) around, e.g.,

âi = Fb−1 (i/k) = GAMMAINV(i/k, r̂, λ̂).

ISYE 6739 — Goldsman 3/2/20 108 / 115


Goodness-of-Fit Tests: Honors Example

interval (âi−1 , âi ] Oi Ei = n/k


[0.000, 0.436] 8 10
(0.436, 0.550] 12 10
(0.550, 0.644] 6 10
(0.644, 0.733] 9 10
(0.733, 0.823] 12 10
(0.823, 0.920] 8 10
(0.920, 1.032] 13 10
(1.032, 1.174] 14 10
(1.174, 1.391] 10 10
(1.391, ∞) 8 10
100 100

ISYE 6739 — Goldsman 3/2/20 109 / 115


Goodness-of-Fit Tests: Honors Example

interval (âi−1 , âi ] Oi Ei = n/k


[0.000, 0.436] 8 10
(0.436, 0.550] 12 10
(0.550, 0.644] 6 10
(0.644, 0.733] 9 10
(0.733, 0.823] 12 10
(0.823, 0.920] 8 10
(0.920, 1.032] 13 10
(1.032, 1.174] 14 10
(1.174, 1.391] 10 10
(1.391, ∞) 8 10
100 100
k
X
χ20 = (Oi − Ei )2 /Ei = 6.2
i=1

ISYE 6739 — Goldsman 3/2/20 109 / 115


Goodness-of-Fit Tests: Honors Example

interval (âi−1 , âi ] Oi Ei = n/k


[0.000, 0.436] 8 10
(0.436, 0.550] 12 10
(0.550, 0.644] 6 10
(0.644, 0.733] 9 10
(0.733, 0.823] 12 10
(0.823, 0.920] 8 10
(0.920, 1.032] 13 10
(1.032, 1.174] 14 10
(1.174, 1.391] 10 10
(1.391, ∞) 8 10
100 100
k
X
χ20 = (Oi − Ei )2 /Ei = 6.2 and χ2α,k−1−s = χ20.05,7 = 14.07.
i=1

ISYE 6739 — Goldsman 3/2/20 109 / 115


Goodness-of-Fit Tests: Honors Example

interval (âi−1 , âi ] Oi Ei = n/k


[0.000, 0.436] 8 10
(0.436, 0.550] 12 10
(0.550, 0.644] 6 10
(0.644, 0.733] 9 10
(0.733, 0.823] 12 10
(0.823, 0.920] 8 10
(0.920, 1.032] 13 10
(1.032, 1.174] 14 10
(1.174, 1.391] 10 10
(1.391, ∞) 8 10
100 100
k
X
χ20 = (Oi − Ei )2 /Ei = 6.2 and χ2α,k−1−s = χ20.05,7 = 14.07.
i=1
So fail to reject H0 . These may indeed be gamma!

ISYE 6739 — Goldsman 3/2/20 109 / 115


Goodness-of-Fit Tests: Honors Example

Weibull: The Weibull distribution has cdf F (x) = 1 − exp − (λx)r , for
 

x ≥ 0.

ISYE 6739 — Goldsman 3/2/20 110 / 115


Goodness-of-Fit Tests: Honors Example

Weibull: The Weibull distribution has cdf F (x) = 1 − exp − (λx)r , for
 

x ≥ 0. Note that r = 1 yields the Exp(λ) as a special case.

ISYE 6739 — Goldsman 3/2/20 110 / 115


Goodness-of-Fit Tests: Honors Example

Weibull: The Weibull distribution has cdf F (x) = 1 − exp − (λx)r , for
 

x ≥ 0. Note that r = 1 yields the Exp(λ) as a special case.

Let’s get MLEs for the s = 2 unknown parameters (r and λ).

ISYE 6739 — Goldsman 3/2/20 110 / 115


Goodness-of-Fit Tests: Honors Example

Weibull: The Weibull distribution has cdf F (x) = 1 − exp − (λx)r , for
 

x ≥ 0. Note that r = 1 yields the Exp(λ) as a special case.

Let’s get MLEs for the s = 2 unknown parameters (r and λ). After a little
algebra (a couple of chain rules), the pdf is

ISYE 6739 — Goldsman 3/2/20 110 / 115


Goodness-of-Fit Tests: Honors Example

Weibull: The Weibull distribution has cdf F (x) = 1 − exp − (λx)r , for
 

x ≥ 0. Note that r = 1 yields the Exp(λ) as a special case.

Let’s get MLEs for the s = 2 unknown parameters (r and λ). After a little
algebra (a couple of chain rules), the pdf is
r
f (x) = λr(λx)r−1 e−(λx) , x ≥ 0.

ISYE 6739 — Goldsman 3/2/20 110 / 115


Goodness-of-Fit Tests: Honors Example

Weibull: The Weibull distribution has cdf F (x) = 1 − exp − (λx)r , for
 

x ≥ 0. Note that r = 1 yields the Exp(λ) as a special case.

Let’s get MLEs for the s = 2 unknown parameters (r and λ). After a little
algebra (a couple of chain rules), the pdf is
r
f (x) = λr(λx)r−1 e−(λx) , x ≥ 0.

So the likelihood function for an iid sample of size n is

ISYE 6739 — Goldsman 3/2/20 110 / 115


Goodness-of-Fit Tests: Honors Example

Weibull: The Weibull distribution has cdf F (x) = 1 − exp − (λx)r , for
 

x ≥ 0. Note that r = 1 yields the Exp(λ) as a special case.

Let’s get MLEs for the s = 2 unknown parameters (r and λ). After a little
algebra (a couple of chain rules), the pdf is
r
f (x) = λr(λx)r−1 e−(λx) , x ≥ 0.

So the likelihood function for an iid sample of size n is


n
Y
L(r, λ) = f (xi )
i=1

ISYE 6739 — Goldsman 3/2/20 110 / 115


Goodness-of-Fit Tests: Honors Example

Weibull: The Weibull distribution has cdf F (x) = 1 − exp − (λx)r , for
 

x ≥ 0. Note that r = 1 yields the Exp(λ) as a special case.

Let’s get MLEs for the s = 2 unknown parameters (r and λ). After a little
algebra (a couple of chain rules), the pdf is
r
f (x) = λr(λx)r−1 e−(λx) , x ≥ 0.

So the likelihood function for an iid sample of size n is


n
Y n
Y r−1 h n
X i
L(r, λ) = f (xi ) = λnr rn xi exp − λr xri .
i=1 i=1 i=1

ISYE 6739 — Goldsman 3/2/20 110 / 115


Goodness-of-Fit Tests: Honors Example

Weibull: The Weibull distribution has cdf F (x) = 1 − exp − (λx)r , for
 

x ≥ 0. Note that r = 1 yields the Exp(λ) as a special case.

Let’s get MLEs for the s = 2 unknown parameters (r and λ). After a little
algebra (a couple of chain rules), the pdf is
r
f (x) = λr(λx)r−1 e−(λx) , x ≥ 0.

So the likelihood function for an iid sample of size n is


n
Y n
Y r−1 h n
X i
L(r, λ) = f (xi ) = λnr rn xi exp − λr xri .
i=1 i=1 i=1

n
Y  n
X
r
`n(L) = nr `n(λ) + n `n(r) + (r − 1) `n xi − λ xri .
i=1 i=1

ISYE 6739 — Goldsman 3/2/20 110 / 115


Goodness-of-Fit Tests: Honors Example

At this point, maximize with respect to r and λ by setting

∂ ∂
`n(L) = 0 and `n(L) = 0.
∂r ∂λ

ISYE 6739 — Goldsman 3/2/20 111 / 115


Goodness-of-Fit Tests: Honors Example

At this point, maximize with respect to r and λ by setting

∂ ∂
`n(L) = 0 and `n(L) = 0.
∂r ∂λ

d x
After more algebra — including the fact that dx c = cx `n(c) — we get the
simultaneous equations

ISYE 6739 — Goldsman 3/2/20 111 / 115


Goodness-of-Fit Tests: Honors Example

At this point, maximize with respect to r and λ by setting

∂ ∂
`n(L) = 0 and `n(L) = 0.
∂r ∂λ

d x
After more algebra — including the fact that dx c = cx `n(c) — we get the
simultaneous equations
n
1 X −1/r
λ = xri and
n
i=1

ISYE 6739 — Goldsman 3/2/20 111 / 115


Goodness-of-Fit Tests: Honors Example

At this point, maximize with respect to r and λ by setting

∂ ∂
`n(L) = 0 and `n(L) = 0.
∂r ∂λ

d x
After more algebra — including the fact that dx c = cx `n(c) — we get the
simultaneous equations
n
1 X −1/r
λ = xri and
n
i=1

n  n P xr `n(x )
n Y
i i i
g(r) = + `n xi − P r = 0.
r x
i i
i=1

ISYE 6739 — Goldsman 3/2/20 111 / 115


Goodness-of-Fit Tests: Honors Example

The equation for λ looks easy enough, if only we could solve for r!

ISYE 6739 — Goldsman 3/2/20 112 / 115


Goodness-of-Fit Tests: Honors Example

The equation for λ looks easy enough, if only we could solve for r!

But we can! Let’s use Newton’s method. It’s usually a lot faster than
bisection.

ISYE 6739 — Goldsman 3/2/20 112 / 115


Goodness-of-Fit Tests: Honors Example

The equation for λ looks easy enough, if only we could solve for r!

But we can! Let’s use Newton’s method. It’s usually a lot faster than
bisection. Here’s a reasonable implementation of Newton.

ISYE 6739 — Goldsman 3/2/20 112 / 115


Goodness-of-Fit Tests: Honors Example

The equation for λ looks easy enough, if only we could solve for r!

But we can! Let’s use Newton’s method. It’s usually a lot faster than
bisection. Here’s a reasonable implementation of Newton.
1 Initialize r0 = X̄/S, where X̄ is the sample mean and S 2 is the sample
variance. Set j ← 0.

ISYE 6739 — Goldsman 3/2/20 112 / 115


Goodness-of-Fit Tests: Honors Example

The equation for λ looks easy enough, if only we could solve for r!

But we can! Let’s use Newton’s method. It’s usually a lot faster than
bisection. Here’s a reasonable implementation of Newton.
1 Initialize r0 = X̄/S, where X̄ is the sample mean and S 2 is the sample
variance. Set j ← 0.
2 Update rj+1 ← rj − g(rj )/g 0 (rj ).

ISYE 6739 — Goldsman 3/2/20 112 / 115


Goodness-of-Fit Tests: Honors Example

The equation for λ looks easy enough, if only we could solve for r!

But we can! Let’s use Newton’s method. It’s usually a lot faster than
bisection. Here’s a reasonable implementation of Newton.
1 Initialize r0 = X̄/S, where X̄ is the sample mean and S 2 is the sample
variance. Set j ← 0.
2 Update rj+1 ← rj − g(rj )/g 0 (rj ).
3 If |g(rj+1 )| or |rj+1 − rj | or your budget is suitably small, then STOP
and set the MLE r̂ ← rj+1 .

ISYE 6739 — Goldsman 3/2/20 112 / 115


Goodness-of-Fit Tests: Honors Example

The equation for λ looks easy enough, if only we could solve for r!

But we can! Let’s use Newton’s method. It’s usually a lot faster than
bisection. Here’s a reasonable implementation of Newton.
1 Initialize r0 = X̄/S, where X̄ is the sample mean and S 2 is the sample
variance. Set j ← 0.
2 Update rj+1 ← rj − g(rj )/g 0 (rj ).
3 If |g(rj+1 )| or |rj+1 − rj | or your budget is suitably small, then STOP
and set the MLE r̂ ← rj+1 . Otherwise, let j ← j + 1 and goto Step 2.

ISYE 6739 — Goldsman 3/2/20 112 / 115


Goodness-of-Fit Tests: Honors Example

The equation for λ looks easy enough, if only we could solve for r!

But we can! Let’s use Newton’s method. It’s usually a lot faster than
bisection. Here’s a reasonable implementation of Newton.
1 Initialize r0 = X̄/S, where X̄ is the sample mean and S 2 is the sample
variance. Set j ← 0.
2 Update rj+1 ← rj − g(rj )/g 0 (rj ).
3 If |g(rj+1 )| or |rj+1 − rj | or your budget is suitably small, then STOP
and set the MLE r̂ ← rj+1 . Otherwise, let j ← j + 1 and goto Step 2.

To use Newton, we need (after yet more algebra)


P r
2
xri [`n(xi )]2
P
0 n n iP n i xi
`n(xi )
g (r) = − 2 − r +  P r 2 .
r i xi x
i i

ISYE 6739 — Goldsman 3/2/20 112 / 115


Goodness-of-Fit Tests: Honors Example

Let’s try Newton on our dataset of n = 100 observations, where


r0 = X̄/S = 0.8778/0.3347 = 2.6227. This results in. . . .

ISYE 6739 — Goldsman 3/2/20 113 / 115


Goodness-of-Fit Tests: Honors Example

Let’s try Newton on our dataset of n = 100 observations, where


r0 = X̄/S = 0.8778/0.3347 = 2.6227. This results in. . . .

step ri g(ri ) g 0 (ri )

ISYE 6739 — Goldsman 3/2/20 113 / 115


Goodness-of-Fit Tests: Honors Example

Let’s try Newton on our dataset of n = 100 observations, where


r0 = X̄/S = 0.8778/0.3347 = 2.6227. This results in. . . .

step ri g(ri ) g 0 (ri )


0 2.6227 5.0896 −25.0848

ISYE 6739 — Goldsman 3/2/20 113 / 115


Goodness-of-Fit Tests: Honors Example

Let’s try Newton on our dataset of n = 100 observations, where


r0 = X̄/S = 0.8778/0.3347 = 2.6227. This results in. . . .

step ri g(ri ) g 0 (ri )


0 2.6227 5.0896 −25.0848
1 2.8224 0.7748 −23.8654

ISYE 6739 — Goldsman 3/2/20 113 / 115


Goodness-of-Fit Tests: Honors Example

Let’s try Newton on our dataset of n = 100 observations, where


r0 = X̄/S = 0.8778/0.3347 = 2.6227. This results in. . . .

step ri g(ri ) g 0 (ri )


0 2.6227 5.0896 −25.0848
1 2.8224 0.7748 −23.8654
2 2.8549 0.1170 −23.6493
3 2.8598 0.0178 −23.6174
4 2.8606 0.0027 −23.6126
5 2.8607

ISYE 6739 — Goldsman 3/2/20 113 / 115


Goodness-of-Fit Tests: Honors Example

Let’s try Newton on our dataset of n = 100 observations, where


r0 = X̄/S = 0.8778/0.3347 = 2.6227. This results in. . . .

step ri g(ri ) g 0 (ri )


0 2.6227 5.0896 −25.0848
1 2.8224 0.7748 −23.8654
2 2.8549 0.1170 −23.6493
3 2.8598 0.0178 −23.6174
4 2.8606 0.0027 −23.6126
5 2.8607

Hence, r̂ = r5 = 2.8607, and thus,


n
1 X −1/r̂
λ
b = xr̂i = 1.0148.
n
i=1

ISYE 6739 — Goldsman 3/2/20 113 / 115


Goodness-of-Fit Tests: Honors Example

Again do a χ2 g-o-f test with equal-probability intervals.

ISYE 6739 — Goldsman 3/2/20 114 / 115


Goodness-of-Fit Tests: Honors Example

Again do a χ2 g-o-f test with equal-probability intervals. To get the endpoints,


we note that F (ai ) = i/k; and then some algebra fun + the MLE Invariance
Property yield

ISYE 6739 — Goldsman 3/2/20 114 / 115


Goodness-of-Fit Tests: Honors Example

Again do a χ2 g-o-f test with equal-probability intervals. To get the endpoints,


we note that F (ai ) = i/k; and then some algebra fun + the MLE Invariance
Property yield

i  1/r̂
 
1 
âi = −`n 1 −
λ
b k
= 0.9854 [−`n(1 − 0.1 i)]0.3496 , i = 0, 1, 2, . . . , 10.

ISYE 6739 — Goldsman 3/2/20 114 / 115


Goodness-of-Fit Tests: Honors Example

Again do a χ2 g-o-f test with equal-probability intervals. To get the endpoints,


we note that F (ai ) = i/k; and then some algebra fun + the MLE Invariance
Property yield

i  1/r̂
 
1 
âi = −`n 1 −
λ
b k
= 0.9854 [−`n(1 − 0.1 i)]0.3496 , i = 0, 1, 2, . . . , 10.

Moreover, it turns out (see the next table) that


k
X
χ20 = (Oi − Ei )2 /Ei = 5.0
i=1

ISYE 6739 — Goldsman 3/2/20 114 / 115


Goodness-of-Fit Tests: Honors Example

Again do a χ2 g-o-f test with equal-probability intervals. To get the endpoints,


we note that F (ai ) = i/k; and then some algebra fun + the MLE Invariance
Property yield

i  1/r̂
 
1 
âi = −`n 1 −
λ
b k
= 0.9854 [−`n(1 − 0.1 i)]0.3496 , i = 0, 1, 2, . . . , 10.

Moreover, it turns out (see the next table) that


k
X
χ20 = (Oi − Ei )2 /Ei = 5.0 and χ2α,k−1−s = χ20.05,7 = 14.07.
i=1

ISYE 6739 — Goldsman 3/2/20 114 / 115


Goodness-of-Fit Tests: Honors Example

Again do a χ2 g-o-f test with equal-probability intervals. To get the endpoints,


we note that F (ai ) = i/k; and then some algebra fun + the MLE Invariance
Property yield

i  1/r̂
 
1 
âi = −`n 1 −
λ
b k
= 0.9854 [−`n(1 − 0.1 i)]0.3496 , i = 0, 1, 2, . . . , 10.

Moreover, it turns out (see the next table) that


k
X
χ20 = (Oi − Ei )2 /Ei = 5.0 and χ2α,k−1−s = χ20.05,7 = 14.07.
i=1

So we fail to reject H0 , and we’ll grudgingly pretend that these observations


are Weibull. 2

ISYE 6739 — Goldsman 3/2/20 114 / 115


Goodness-of-Fit Tests: Honors Example

interval (âi−1 , âi ] Oi Ei = n/k


[0, 0.4487] 8 10
(0.4487, 0.5833] 15 10
(0.5833, 0.6872] 9 10
(0.6872, 0.7792] 11 10
(0.7792, 0.8669] 8 10
(0.8669, 0.9557] 7 10
(0.9557, 1.0514] 10 10
(1.0514, 1.1637] 12 10
(1.1637, 1.3189] 11 10
(1.3189, ∞] 9 10
100 100

ISYE 6739 — Goldsman 3/2/20 115 / 115


Goodness-of-Fit Tests: Honors Example

interval (âi−1 , âi ] Oi Ei = n/k


[0, 0.4487] 8 10
(0.4487, 0.5833] 15 10
(0.5833, 0.6872] 9 10
(0.6872, 0.7792] 11 10
(0.7792, 0.8669] 8 10
(0.8669, 0.9557] 7 10
(0.9557, 1.0514] 10 10
(1.0514, 1.1637] 12 10
(1.1637, 1.3189] 11 10
(1.3189, ∞] 9 10
100 100

The Big Reveal: I actually generated the observations from a Weibull


distribution with parameters r = 3 and λ = 1. So we did pretty well!

ISYE 6739 — Goldsman 3/2/20 115 / 115

You might also like