Chapter 8: Test of Hypotheses: Course Name: Probability & Statistics
Chapter 8: Test of Hypotheses: Course Name: Probability & Statistics
Chapter 8: Test of Hypotheses: Course Name: Probability & Statistics
Hanoi, 2021
1 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
Content
1 Hypothesis Testing
2 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
Content
1 Hypothesis Testing
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
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.
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.
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.
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
11 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
2.1 Hypothesis Tests on the Mean
12 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
2.1 Hypothesis Tests on the Mean
H0 : µ = µ0 and H1 : µ 6= µ0
Test Statistic
X − µ0
Z0 = √
σ/ n
The two- sided alternative hypothesis, the P -value is
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
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
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
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
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
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
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)
27 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
Content
1 Hypothesis Testing
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
X̄1 − X̄2 − ∆0
T0∗ = q 2
S1 S22
n1 + n2
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
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
47 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
3.3 Inference on the Two Proportions
48 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
3.3 Inference on the Two Proportions
49 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
3.3 Inference on the Two Proportions
50 / 53
Dr. Nguyen Kieu Linh Chapter 8: Test of Hypotheses
3.3 Inference on the Two Proportions
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