You are on page 1of 66

Chapter 8: Test of Hypotheses

Course Name: PROBABILITY & STATISTICS

Lecturer: Dr. Nguyen Kieu Linh

Hanoi, 2021

1 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
Content

1 Hypothesis Testing

2 Test of Hypotheses for a Single Sample


2.1 Hypothesis Tests on the Mean
2.2 Tests on a Population Proportion

3 Statistical Inference for Two Samples


3.1 Inference on the Difference in Means of Two Normal
Distributions, Variance Known
3.2 Inference on the Difference in Means of Two Normal
Distributions, Variance Unknown
3.3 Inference on the Two Proportions

2 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
Content

1 Hypothesis Testing

2 Test of Hypotheses for a Single Sample


2.1 Hypothesis Tests on the Mean
2.2 Tests on a Population Proportion

3 Statistical Inference for Two Samples


3.1 Inference on the Difference in Means of Two Normal
Distributions, Variance Known
3.2 Inference on the Difference in Means of Two Normal
Distributions, Variance Unknown
3.3 Inference on the Two Proportions

3 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
1. Hypothesis Testing

Statistical Hypothesis
A statistical hypothesis is a statement about the parameters of one
or more populations.
For a statistical hypothesis: null hypothesis H0 and alternative
hypothesis H1 .

Example
A cereal company claims that the mean weight of the cereal in its
packets is 14.2 oz.
Null hypothesis H0 : µ = 14.2
Alternative hypothesis H1 : µ 6= 14.2.
This is a two-sided alternative hypothesis.

4 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
1.2 Tests of Statistical Hypotheses
We have 2 form on the alternative hypothesis:
(1) two-sided alternative hypothesis

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

(2) one-sided alternative hypothesis

H0 : µ = µ0 H1 : µ > µ0 or
H0 : µ = µ0 H1 : µ < µ0 .

Example
The owner of a football team claims that the average attendance at
games is over 45,000. Express the null hypothesis and the alternative
hypothesis in symbolic form.

H0 : µ = 45000 H1 : µ > 45000.


5 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
1.2 Tests of Statistical Hypotheses

Example
A researcher claims that less than 63% of voters favor gun control.
Express the null hypothesis and the alternative hypothesis in symbolic
form.

6 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
1.2 Tests of Statistical Hypotheses

Example
A researcher claims that less than 63% of voters favor gun control.
Express the null hypothesis and the alternative hypothesis in symbolic
form.
Answer: H0 : p = 0.63 H1 : p < 0.63.

Example
A school manager claims that the grade point averages for high school
students has a standard deviation exceed 0.98. Express the null
hypothesis and the alternative hypothesis in symbolic form.

6 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
1.2 Tests of Statistical Hypotheses

Example
A researcher claims that less than 63% of voters favor gun control.
Express the null hypothesis and the alternative hypothesis in symbolic
form.
Answer: H0 : p = 0.63 H1 : p < 0.63.

Example
A school manager claims that the grade point averages for high school
students has a standard deviation exceed 0.98. Express the null
hypothesis and the alternative hypothesis in symbolic form.
Answer: H0 : σ = 0.98 H1 : σ > 0.98

6 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
1.2 Tests of Statistical Hypotheses
Suppose we wish to test

H0 : µ = 50 H1 : µ 6= 50.

We shall take a sample of size n: x̄.


If 48.5 ≤ x̄ ≤ 51.5, not reject H0 .
If either x̄ < 48.5 or x̄ > 51.5, reject H0 .

Definition
The critical region for the test: (x̄ < 48.5 or x̄ > 51.5) is the
region that rejects H0 .
The acceptance region for the test: (48.5 ≤ x̄ ≤ 51.5) is the
region that fails to reject H0 .
The critical values: (48.5 and 51.5) are the boundaries between
the critical regions and the acceptance region.
7 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
1.2 Tests of Statistical Hypotheses
Test of a Hypothesis
Rejecting the null hypothesis H0 when it is true is defined as a
type I error.
Failing to reject the null hypothesis when it is false is defined as a
type II error.

Probability of Type I Error


α = P (type I error) = P (reject H0 when H0 is true).

Sometimes the type I error probability is called the significance level,


or the α-error, or the size of the test.
8 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
1.2 Tests of Statistical Hypotheses

Probability of Type II Error


β = P (type II error) = P (fail to reject H0 when H0 is false)

P -value
The P -value is the smallest level of significance that would lead to
rejection of the null hypothesis H0 with the given data.

9 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
1.2 Tests of Statistical Hypotheses

Example
The owner of a football team claims that the average attendance at
games is over 45,000. Determine the type I error and the type II error.

10 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
1.2 Tests of Statistical Hypotheses

Example
The owner of a football team claims that the average attendance at
games is over 45,000. Determine the type I error and the type II error.
Answer: We have H0 : µ = 45000 H1 : µ > 45000. Hence
Type I error: The error of rejecting the claim that the mean
attendance is at most 45000, when it really is at most 45000.
Type II error: The error of failing to reject the claim that the mean
attendance is at most 45000, when it really is more than 45000.

10 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
Content

1 Hypothesis Testing

2 Test of Hypotheses for a Single Sample


2.1 Hypothesis Tests on the Mean
2.2 Tests on a Population Proportion

3 Statistical Inference for Two Samples


3.1 Inference on the Difference in Means of Two Normal
Distributions, Variance Known
3.2 Inference on the Difference in Means of Two Normal
Distributions, Variance Unknown
3.3 Inference on the Two Proportions

11 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
2.1 Hypothesis Tests on the Mean

1. In this section, we consider hypothesis testing about the mean µ of


a single normal population where the variance of the population
σ 2 is known.
2. We will assume that a random sample X1 , X2 , . . . , Xn has been
taken from the population. Based on our previous discussion, the
sample mean X is an unbiased point estimator of µ with
variance σ 2 /n.

12 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
2.1 Hypothesis Tests on the Mean

Suppose that we wish to test the hypotheses

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

Test Statistic
X − µ0
Z0 = √
σ/ n
The two- sided alternative hypothesis, the P -value is

P = 2[1 − Φ(|z0 |)]

1. Reject H0 if the observed value of the test statistic z0 is either


z0 > zα/2 or z0 < −zα/2 .
2. Fail to reject H0 if −zα/2 < z0 < zα/2 .

13 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
2.1 Hypothesis Tests on the Mean

14 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
2.1.1 Summary of Tests on the Mean, Variance
Known

Summary of Tests on the Mean, Variance Known


Null hypothesis : H0 : µ = µ0

Test statistic value: z0 = (x̄ − µ0 )/(σ/ n).
Alternative P -value Critical values Reject H0
hypothesis

H1 : µ 6= µ0 2[1 − Φ(z0 )] zα/2 , −zα/2 z0 > zα/2 or z0 < −zα/2

H1 : µ > µ0 1 − Φ(z0 ) zα z0 > zα

H1 : µ < µ0 Φ(z0 ) −zα z0 < −zα

15 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
2.1.1 Summary of Tests on the Mean, Variance
Known

Example
Suppose you want to test the claim that µ 6= 8. Given a sample size of
n = 82 and a level of significance of α = 0.02. When should you reject
H0 ?

16 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
2.1.1 Summary of Tests on the Mean, Variance
Known

Example
Suppose you want to test the claim that µ 6= 8. Given a sample size of
n = 82 and a level of significance of α = 0.02. When should you reject
H0 ?
Answer: We should reject H0 if the test statistic value
x̄ − 8
z0 = √
σ/ 82

is either bigger than z0.01 = 2.33 or less than −z0.01 = −2.33.

16 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
2.1.1 Summary of Tests on the Mean, Variance
Known

Example
Suppose you want to test the claim that µ 6= 8. Given a sample size of
n = 82 and a level of significance of α = 0.02. When should you reject
H0 ?
Answer: We should reject H0 if the test statistic value
x̄ − 8
z0 = √
σ/ 82

is either bigger than z0.01 = 2.33 or less than −z0.01 = −2.33.

Note. When σ is unknown and the sample size n ≥ 30, we can use the
test statistic
X̄ − µ0
Z0 = √ .
s/ n
16 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
2.1.1 Summary of Tests on the Mean, Variance
Known

Example
You wish to test the claim that µ ≥ 45 at a level of significance of
α = 0.025 and are given sample statistics n = 44, s = 5, x̄ = 45.8.
Compute the value of the test statistic.

17 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
2.1.1 Summary of Tests on the Mean, Variance
Known

Example
You wish to test the claim that µ ≥ 45 at a level of significance of
α = 0.025 and are given sample statistics n = 44, s = 5, x̄ = 45.8.
Compute the value of the test statistic.
Answer: Test statistic value
x̄ − µ0 45.8 − 45
z0 = √ = √ = 1.061
s/ n 5/ 44

17 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
2.1.1 Summary of Tests on the Mean, Variance
Known

Example
Assume that the data has a normal distribution and the number of
observations is greater than forty five. Find the critical z value used to
test a null hypothesis.
α = 0.02 for a left-tailed test (H1 : µ < µ0 ).

18 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
2.1.1 Summary of Tests on the Mean, Variance
Known

Example
Assume that the data has a normal distribution and the number of
observations is greater than forty five. Find the critical z value used to
test a null hypothesis.
α = 0.02 for a left-tailed test (H1 : µ < µ0 ).
Answer. The critical z value is −z0.02 = −2.05

18 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
2.1.1 Summary of Tests on the Mean, Variance
Known

Example
Output from a software package is given below:
One-Sample Z: Test of H0 : µ = 14.5 vs H1 : µ > 14.5
The assumed standard deviation 1.1
Variable N Mean StDev SE Mean Z P
x 16 15.016 1.015 ? ? ?
Fill in the missing items.

19 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
2.1.1 Summary of Tests on the Mean, Variance
Known

Example
Output from a software package is given below:
One-Sample Z: Test of H0 : µ = 14.5 vs H1 : µ > 14.5
The assumed standard deviation 1.1
Variable N Mean StDev SE Mean Z P
x 16 15.016 1.015 ? ? ?
Fill in the missing items.
Answer:

SE Mean = StDev/ 16 = 0.25375
Z = (M ean − 14.5)/SE Mean = (15.016 − 14.5)/0.25375 = 2.0335
P = 1 − Φ(Z) = 1 − Φ(2.0335) = 1 − 0.979 = 0.021

19 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
2.1.2 Tests on the Mean of a Normal
Distribution, Variance Unknown
Null hypothesis: H0 : µ = µ0
Test statistic:
X̄ − µ0

T0 =
S/ n
has t-distribution with n − 1 degrees of freedom.

Test statistic value: t0 = (x̄ − µ0 )/(s/ n).
Alternative P -value Critical values Reject H0
hypothesis

H1 : µ 6= µ0 2P (Tn−1 > |t0 |) tα/2,n−1 , −tα/2,n−1 t0 > tα/2,n−1 or


t0 < −tα/2,n−1

H1 : µ > µ0 P (Tn−1 > t0 ) tα,n−1 t0 > tα,n−1

H1 : µ < µ0 P (Tn−1 < −t0 ) −tα,n−1 t0 < −tα,n−1


20 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
2.1.2 Tests on the Mean of a Normal
Distribution, Variance Unknown

Summary for the One- Sample t-Test

21 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
2.1.2 Tests on the Mean of a Normal
Distribution, Variance Unknown

Example
Find the test statistic t0 for a sample with n = 9, x̄ = 5.6, s = 0.88 and
if H1 : µ > 5.7.

22 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
2.1.2 Tests on the Mean of a Normal
Distribution, Variance Unknown

Example
Find the test statistic t0 for a sample with n = 9, x̄ = 5.6, s = 0.88 and
if H1 : µ > 5.7.
Answer: We have n = 9, x̄ = 5.6, s = 0.88, µ0 = 5.7. Hence
x̄ − µ0 5.6 − 5.7
t0 = √ = √ = −0.341
s/ n 0.88/ 9

22 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
2.1.2 Tests on the Mean of a Normal
Distribution, Variance Unknown

Example
Find the critical values for a sample with n = 10, x̄ = 7.9, s = 1.2 if
H1 : µ < 8.2 and the level of significance α = 0.05. Let
t0.05,9 = 1.833, t0.025,9 = 2.262

23 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
2.1.2 Tests on the Mean of a Normal
Distribution, Variance Unknown

Example
Find the critical values for a sample with n = 10, x̄ = 7.9, s = 1.2 if
H1 : µ < 8.2 and the level of significance α = 0.05. Let
t0.05,9 = 1.833, t0.025,9 = 2.262
Answer: This is a one-sided alternative hypothesis H1 : µ < 8.2 on
mean with unknown variance. The critical value is
−tα,n−1 = −t0.05,9 = −1.833.

23 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
2.1.2 Tests on the Mean of a Normal
Distribution, Variance Unknown

Example
Given a sample with n = 10, x̄ = 7.9, s = 1.2 and alternative hypothesis
H1 : µ 6= 8.2 and the level of significance α = 0.05. Let
t0.05,9 = 1.833, t0.025,9 = 2.262. Should we reject H0 ?

24 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
2.1.2 Tests on the Mean of a Normal
Distribution, Variance Unknown

Example
Given a sample with n = 10, x̄ = 7.9, s = 1.2 and alternative hypothesis
H1 : µ 6= 8.2 and the level of significance α = 0.05. Let
t0.05,9 = 1.833, t0.025,9 = 2.262. Should we reject H0 ?
Answer: This is a two-sided alternative hypothesis on population
mean with unknown variance. Test statistic value
x̄ − µ0 7.9 − 8.2
t0 = √ = √ = −0.79
s/ n 1.2/ 10

The critical values 2.262, −2.262. Since −2.262 < −0.79 < 2.262, we
should not reject H0 .

24 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
2.2 Tests on a Population Proportion
Let X be the number of observations in a random sample of size n that
belongs to the class associated with p. Then, if the null hypothesis
H0 : p = p0 is true, we have X ≈ N [np0 , np0 (1 − p0 )].
Null hypothesis : H0 : p = p0
Test statistic :
X − np0
Z0 = p
np0 (1 − p0 )
Alternative P -value Critical values Reject H0
hypothesis

H1 : p 6= p0 2[1 − Φ(z0 )] zα/2 , −zα/2 z0 > zα/2 or z0 < −zα/2

H1 : p > p0 1 − Φ(z0 ) zα z0 > zα

H1 : p < p0 Φ(z0 ) −zα z0 < −zα


25 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
Example
A random sample of 200 circuits generated 9 defectives. Use the data
to test H0 : p = 0.05 versus H1 : p 6= 0.05. Use α = 0.05. Let
z0.05 = 1.65, z0.025 = 1.96.
(a) Find the critical values for this test.
(b) Should we reject H0 ?

26 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
Example
A random sample of 200 circuits generated 9 defectives. Use the data
to test H0 : p = 0.05 versus H1 : p 6= 0.05. Use α = 0.05. Let
z0.05 = 1.65, z0.025 = 1.96.
(a) Find the critical values for this test.
(b) Should we reject H0 ?
Answer: This is a two-tail alternative hypothesis on proportion
population p0 = 0.05. The sample has n = 200, X = 9 and the level of
significance α = 0.05
(a) The critical values: zα/2 = 1.96, −zα/2 = −1.96
(b) Test statistic value

X − np0 9 − 200 ∗ 0.05


z0 = p =p = −0.324
np0 (1 − p0 ) 200 ∗ 0.05 ∗ (1 − 0.05)

We see that −z0.025 < z0 < z0.025 , hence we fail to reject H0 .

26 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
Example
Suppose that 500 parts are tested in manufacturing and 10 are
rejected. Find the P -value for test the hypothesis H0 : p = 0.03 against
H1 : p < 0.03.

27 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
Example
Suppose that 500 parts are tested in manufacturing and 10 are
rejected. Find the P -value for test the hypothesis H0 : p = 0.03 against
H1 : p < 0.03.
Answer: n = 500, X = 10, p0 = 0.03. The test statistic value
10 − 500 ∗ 0.03
z0 = p = −1.311
500 ∗ 0.03 ∗ (1 − 0.03)

Hence the P -value is

Φ(z0 ) = Φ(−1.311) = 0.095

27 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
Content

1 Hypothesis Testing

2 Test of Hypotheses for a Single Sample


2.1 Hypothesis Tests on the Mean
2.2 Tests on a Population Proportion

3 Statistical Inference for Two Samples


3.1 Inference on the Difference in Means of Two Normal
Distributions, Variance Known
3.2 Inference on the Difference in Means of Two Normal
Distributions, Variance Unknown
3.3 Inference on the Two Proportions

28 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
3.1 Inference on the Difference in Means of Two
Normal Distributions, Variance Known

In this section we consider statistical inferences on the difference in


means µ1 − µ2 of two normal distributions, where the variances σ12 and
σ22 are known. The assumptions for this section are summarized as
follows.
Assumptions for Two-Sample Inference
1. X11 , X12 , . . . , X1n1 is a random sample from population 1.
2. X21 , X22 , . . . , X2n2 is a random sample from population 2.
3. The two populations represented by X1 and X2 are independent.
4. Both populations are normal.

29 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
3.1 Inference on the Difference in Means of Two
Normal Distributions, Variance Known

Tests on the Difference in Means, Variances Known


Null hypothesis: H0 : µ1 − µ2 = ∆0
1 −X̄2 −∆0
Test statistic: Z0 = X̄r 2 2
σ1 σ
n1 + n2
2
Rejection Criterion For
Alternative Hyp. P -Value
for Fixed-Level Tests
H1 : µ1 − µ2 6= ∆0 Prob. above |z0 | z0 > zα/2 or z0 < −zα/2
and prob. below − |z0 | ,
P = 2 [1 − Φ (|z0 |)]
H1 : µ1 − µ2 > ∆0 Prob. above z0 , z0 > zα
P = 1 − Φ (z0 )
H1 : µ1 − µ2 < ∆0 Prob. below z0 , z0 < −zα
P = Φ (z0 )

30 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
3.1 Inference on the Difference in Means of Two
Normal Distributions, Variance Known

Sample Size for a Two-Sided Test on the Difference in


Means with n1 = n2 , Variances Known
The expression for the β -error for the two-sided alternative:
   
∆ − ∆0  ∆ − ∆0 
β = Φ zα/2 − q 2 2
− Φ −zα/2 − q 2
σ1 σ2 σ1 σ22
n1 + n2 n1 + n2

31 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
3.1 Inference on the Difference in Means of Two
Normal Distributions, Variance Known

Sample Size for a Two-Sided Test on the Difference in


Means with n1 = n2 , Variances Known
For the two-sided alternative hypothesis with significance level α, the
sample size n1 = n2 = n required to detect a true difference in means
of ∆ with power at least 1 − β is
2
σ12 + σ22

zα/2 + zβ
n'
(∆ − ∆0 )2

This approximation is valid when


√ q
 
Φ −zα/2 − (∆ − ∆0 ) n/ σ12 + σ22

is small compared to β.
32 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
3.1 Inference on the Difference in Means of Two
Normal Distributions, Variance Known

Sample Size for a One-Sided Test on the Difference in


Means with n1 = n2 , Variances Known
For a one-sided alternative hypothesis with significance level α, the
sample size n1 = n2 = n required to detect a true difference in means
of ∆ (6= ∆0 ) with power at least 1 − β is

(zα + zβ )2 σ12 + σ22



n=
(∆ − ∆0 )2

where ∆ is the true difference in means of interest

33 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
3.1 Inference on the Difference in Means of Two
Normal Distributions, Variance Known

Confidence Interval on the Difference in Means,


Variances Known
If x̄1 and x̄2 are the means of independent random samples of sizes n1
and n2 from two independent normal populations with known variances
σ12 and σ22 , respectively, a 100(1 − α)% confidence interval for µ1 − µ2 is
s s
σ12 σ22 σ12 σ22
x̄1 − x̄2 − zα/2 + ≤ µ1 − µ2 ≤ x̄1 − x̄2 + zα/2 +
n1 n2 n1 n2

where zα/2 is the upper α/2 percentage point of the standard normal
distribution.

34 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
3.1 Inference on the Difference in Means of Two
Normal Distributions, Variance Known

Sample Size for a Confidence Interval on the Difference


in Means, Variances Known
z 2
α/2
σ12 + σ22

n=
E
Remember to round up if n is not an integer. This will ensure that the
level of confidence does not drop below 100(1 − α)%.

35 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
3.1 Inference on the Difference in Means of Two
Normal Distributions, Variance Known

One-sided confidence bounds on µ1 − µ2 may also be obtained.


One-sided confidence bounds
A 100(1 − α)% upper-confidence bound on µ1 − µ2 is
s
σ12 σ22
µ1 − µ2 ≤ x̄1 − x̄2 + zα +
n1 n2

and a 100(1 − α)% lower-confidence bound is


s
σ12 σ22
x̄1 − x̄2 − zα + ≤ µ1 − µ2
n1 n2

36 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
3.1 Inference on the Difference in Means of Two
Normal Distributions, Variance Known

One-sided confidence bounds on µ1 − µ2 may also be obtained.


Example
Consider the hypothesis test H0 : µ1 = µ2 against H1 : µ1 6= µ2 with
known variances σ1 = 10 and σ2 = 5. Suppose that sample sizes
n1 = 10 and n2 = 15 and that x̄1 = 4.7 and x̄2 = 7.8. Use α = 0.05.
(a) Test the hypothesis and find the P -value.
(b) Construct a 95% confidence interval for the difference in mean?
(c) What is the power of the test in part (a) for a true difference in
means of 3 ?
(d) Assuming equal sample sizes, what sample size should be used to
obtain β = 0.05 if the true difference in means is 3 ? Assume that
α = 0.05.

37 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
3.1 Inference on the Difference in Means of Two
Normal Distributions, Variance Known

One-sided confidence bounds on µ1 − µ2 may also be obtained.


Example
Consider the hypothesis test H0 : µ1 = µ2 against H1 : µ1 < µ2 with
known variances σ1 = 10 and σ2 = 5. Suppose that sample sizes
n1 = 10 and n2 = 15 and that x̄1 = 14.2 and x̄2 = 19.7. Use α = 0.05.
(a) Test the hypothesis and find the P -value.
(b) Explain how the test could be conducted with a confidence interval.
(c) What is the power of the test in part (a) if µ1 is 4 units less than
µ2 ?
(d) Assuming equal sample sizes, what sample size should be used to
obtain β = 0.05 if µ1 is 4 units less than µ2 ? Assume that α = 0.05.

38 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
3.1 Inference on the Difference in Means of Two
Normal Distributions, Variance Known

One-sided confidence bounds on µ1 − µ2 may also be obtained.


Example
Consider the hypothesis test H0 : µ1 = µ2 against H1 : µ1 > µ2 with
known variances σ1 = 10 and σ2 = 5. Suppose that sample sizes
n1 = 10 and n2 = 15 and that x̄1 = 24.5 and x̄2 = 21.3. Use α = 0.01.
(a) Test the hypothesis and find the P -value.
(b) Explain how the test could be conducted with a confidence interval.
(c) What is the power of the test in part (a) if µ1 is 2 units greater
than µ2 ?
(d) Assuming equal sample sizes, what sample size should be used to
obtain β = 0.05 if µ1 is 2 units greater than µ2 ? Assume that α = 0.05.

39 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
3.2 Inference on the Difference in Means of Two
Normal Distributions, Variance Unknown

* Case 1: σ12 = σ22 = σ 2

Pooled Estimator of Variance


The pooled estimator of σ 2 , denoted by Sp2 , is defined by

(n1 − 1) S12 + (n2 − 1) S22


Sp2 =
n1 + n2 − 2

Given the assumptions of this section, the quantity

X̄1 − X̄2 − (µ1 − µ2 )


T = q
Sp n11 + n12

has a t distribution with n1 + n2 − 2 degrees of freedom.


40 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
3.2 Inference on the Difference in Means of Two
Normal Distributions, Variance Unknown

Null hypothesis: H0 : µ1 − µ2 = ∆0

−X̄2 −∆0
X̄1q
Test statistic: T0 =
Sp n1 + n1
1 2
Rejection Criterion For
Alternative Hyp. P -Value
for Fixed-Level Tests
H1 : µ1 − µ2 6= ∆0 Prob. above |t0 | t0 > tα/2,n1 +n2 −2 or
and prob. below − |t0 | , t0 < −tα/2,n1 +n2 −2

H1 : µ1 − µ2 > ∆0 Prob. above t0 t0 > tα,n1 +n2 −2

H1 : µ1 − µ2 < ∆0 Prob. below t0 t0 < −tα,n1 +n2 −2

41 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
3.2 Inference on the Difference in Means of Two
Normal Distributions, Variance Unknown

Approximate Confidence Interval on the Difference in


Means, Variances Unknown and Equal
If x̄1 , x̄2 , s21 , and s22 are the sample means and variances of two random
samples of sizes n1 and n2 , respectively, from two independent normal
populations with unknown but equal variances, then a 100(1 − α)%
confidence interval on the difference in means µ1 − µ2 is
q
x̄1 − x̄2 − tα/2,n1 +n2 −2 sp n11 + n12
q
≤ µ1 − µ2 ≤ x̄1 − x̄2 + tα/2,n1 +n2 −2 sp n11 + n12

42 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
3.2 Inference on the Difference in Means of Two
Normal Distributions, Variance Unknown

One-sided confidence bounds on µ1 − µ2 may also be obtained.


Example
Consider the hypothesis test H0 : µ1 = µ2 against H1 : µ1 6= µ2 .
Suppose that sample sizes are n1 = 15 and n2 = 15, that x̄1 = 4.7 and
x̄2 = 7.8, and that s21 = 4 and s22 = 6.25. Assume that σ12 = σ22 and that
the data are drawn from normal distributions. Use α = 0.05.
(a) Test the hypothesis and find the P -value.
(b) Construct a 95% confidence interval for the difference in mean? (c)
What is the power of the test in part (a) for a true difference in means
of 3?
(d) Assuming equal sample sizes, what sample size should be used to
obtain β = 0.05 if the true difference in means is −2? Assume that
α = 0.05.
43 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
3.2 Inference on the Difference in Means of Two
Normal Distributions, Variance Unknown
* Case 2: σ12 6= σ22
Test Statistic for the Difference in Means, Variances
Unknown and Not Assumed Equal
If H0 : µ1 − µ2 = ∆0 is true, the statistic

X̄1 − X̄2 − ∆0
T0∗ = q 2
S1 S22
n1 + n2

is distributed approximately as t with degrees of freedom given by


2
s21 s22

n1 + n2
ν= 2 2
(s21 /n1 ) (s22 /n2 )
n1 −1 + n2 −1

If ν is not an 44
integer,
/ 53 round down to the nearest integer.
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
3.2 Inference on the Difference in Means of Two
Normal Distributions, Variance Unknown

* Case 2: σ12 6= σ22

Approximate Confidence Interval on the Difference in


Means, Variances Unknown Are Not Assumed Equal
If x̄1 , x̄2 , s21 , and s22 are the means and variances of two random samples
of sizes n1 and n2 , respectively, from two independent normal
populations with unknown and unequal variances, an approximate
100(1 − α)% confidence interval on the difference in means µ1 − µ2 is
s s
s1 2 s 2 s21 s2
x̄1 − x̄2 − tα/2,v + 2 ≤ µ1 − µ2 ≤ x̄1 − x̄2 + tα/2,v + 2 (10.
n1 n2 n1 n2

45 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
3.2 Inference on the Difference in Means of Two
Normal Distributions, Variance Unknown

Example
Two companies manufacture a rubber material intended for use in an automotive
application. The part will be subjected to abrasive wear in the field application, so
we decide to compare the material produced by each company in a test. Twenty-five
samples of material from each company are tested in an abrasion test, and the
amount of wear after 1000 cycles is observed. For company 1 , the sample mean and
standard deviation of wear are x̄1 = 20 milligrams /1000 cycles and s1 = 2
milligrams /1000 cycles, while for company 2 we obtain x̄2 = 15 milligrams /1000
cycles and s2 = 8 milligrams /1000 cycles.
(a) Do the data support the claim that the two companies produce material with
different mean wear? Use α = 0.05, and assume each population is normally
distributed but that their variances are not equal. What is the P -value for this test?
(b) Do the data support a claim that the material from company 1 has higher mean
wear than the material from company 2 ? Use the same assumptions as in part (a).
(c) Construct confidence intervals that will address the questions in parts (a) and
(b) above.

46 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
3.3 Inference on the Two Proportions

Approximate Tests on the Difference of Two Population


Proportions
Null hypothesis: H0 : p1 = p2
P̂1 −P̂2
Test statistic: Z0 = r  
1
P̂ (1−P̂ ) n1 + n1
2

Rejection Criterion For


Alternative Hyp. P -Value
for Fixed-Level Tests
H1 : p1 6= p2 Prob. above |z0 | z0 > zα/2 or z0 < −zα/2
and prob. below − |z0 | ,
P = 2 [1 − Φ (|z0 |)]
H1 : µ1 − µ2 > ∆0 Prob. above z0 , z0 > zα
P = 1 − Φ (z0 )
H1 : µ1 − µ2 < ∆0 Prob. below z0 , z0 < −zα
P = Φ (z0 )

47 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
3.3 Inference on the Two Proportions

Approximate Type II Error for a Two-Sided Test on the


Difference of Two Population Proportions
If the alternative hypothesis is two sided, the β -error is
" p #
zα/2 pq (1/n1 + 1/n2 ) − (p1 − p2 )
β =Φ
σP̂1 −P̂2
" p #
−zα/2 pq (1/n1 + 1/n2 ) − (p1 − p2 )
−Φ
σP̂1 −P̂2

48 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
3.3 Inference on the Two Proportions

Approximate Type II Error for a One-Sided Test on the


Difference of Two Population Proportions
If the alternative hypothesis is H1 : p1 > p2 ,
" p #
zα pq (1/n1 + 1/n2 ) − (p1 − p2 )
β=Φ
σP̂1 −P̂2

and if the alternative hypothesis is H1 : p1 < p2 ,


" p #
−zα pq (1/n1 + 1/n2 ) − (p1 − p2 )
β =1−Φ
σP̂1 −P̂2

49 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
3.3 Inference on the Two Proportions

Approximate Sample Size for a Two-Sided Test on the


Difference in Population Proportions
For the two-sided alternative, the common sample size is
h p √ i2
zα/2 (p1 + p2 ) (q1 + q2 ) /2 + zβ p1 q1 + p2 q2
n=
(p1 − p2 )2

where q1 = 1 − p1 and q2 = 1 − p2 . For a one-sided alternative, replace


zα/2 by zα .

50 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
3.3 Inference on the Two Proportions

Approximate Confidence Interval on the Difference in


Population Proportions
If p̂1 and p̂2 are the sample proportions of observations in two
independent random samples of sizes n1 and n2 that belong to a class
of interest, an approximate twosided 100(1 − α)% confidence interval
on the difference in the true proportions p1 − p2 is
s
p̂1 (1 − p̂1 ) p̂2 (1 − p̂2 )
p̂1 − p̂2 −zα/2 +
n1 n2
s
p̂1 (1 − p̂1 ) p̂2 (1 − p̂2 )
≤ p1 − p2 ≤ p̂1 − p̂2 + zα/2 +
n1 n2

where zα/2 is the upper α/2 percentage point of the standard normal
distribution.
51 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
3.3 Inference on the Two Proportions

Example
In the 2004 presidential election, exit polls from the critical state of
Ohio provided the following results: For respondents with college
degrees, 53% voted for Bush and 46% voted for Kerry. There were 2020
respondents.
(a) Is there a significant difference in these proportions? Use α = 0.05.
What is the P -value?
(b) Calculate a 95% confidence interval for the difference in the two
proportions and comment on the use of this interval to answer the
question in part (a).

52 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
3.3 Inference on the Two Proportions

Example
Two different types of injection-molding machines are used to form
plastic parts. A part is considered defective if it has excessive shrinkage
or is discolored. Two random samples, each of size 300 , are selected,
and 15 defective parts are found in the sample from machine 1 while 8
defective parts are found in the sample from machine 2.
(a) Is it reasonable to conclude that both machines produce the same
fraction of defective parts, using α = 0.05? Find the P -value for this
test.
(b) Construct a 95% confidence interval on the difference in the two
fractions defective.
(c) Suppose that p1 = 0.05 and p2 = 0.01. With the sample sizes given
here, what is the power of the test for this twosided alternate?

53 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses

You might also like