ĐẠI HỌC FPT CẦN THƠ
Chapter 10
Statistical Inference for Two Samples
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
Chapter 10: Statistical Inference for Two Samples
LEARNING OBJECTIVES
10.1 Inference on the Difference in Means of Two
Normal Distributions, Variance Known
10.2 Inference on the Difference in Means of Two
Normal Distributions, Variance Unknown
10.6 Inference on the Two Proportions
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
10.1. Inference on the Difference
in Means of Two Normal
Distributions, Variance Known
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
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.
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
Tests on the Difference in Means, Var(X) known
Null hypothesis: H0: μ1 - μ2 = Δ0
X1 - X 2 - D0
Test statistic: Z 0 =
s 12 s 22
+
n1 n2
Alternative Rejection criteria for
hypothesis P-Value Fixed-Level Tests
H1: μ1 - μ2 ≠ Δ0 P = 2[1 - Φ(|z0|)] |z0|> zα/2
H1: μ1 - μ2 > Δ0 P = 1 - Φ(z0) z0 > zα
H1: μ1 - μ2 < Δ0 P = Φ(z0) z0 < - zα
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
σ2 knownTEST ON THE μ OF NORMDIST: σ2 KNOWN
Example 2
A product developer is interested in reducing the drying time of a
primer paint. Two formulations of the paint are tested; formulation 1
is the standard chemistry, and formulation 2 has a new drying
ingredient that should reduce the drying time. From experience, it is
known that the standard deviation of drying time is 8 minutes, and
this inherent variability should be unaffected by the addition of the
new ingredient. Ten specimens are painted with formulation 1, and
another 10 specimens are painted with formulation 2; the 20
specimens are painted in random order. The two sample average
drying times are x1 = 121 minutes and x2 = 112 minutes, respectively.
What conclusions can the product developer draw about the
effectiveness of the new ingredient, using α = 0.05?
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
Example 2 σ2 known
1. Parameter of interest: The quantity of interest is the difference in
mean drying times, μ1 - μ2, and Δ0 = 0. We have
s 12 = s 22 = 82 ; n1 = n2 = 10; x1 = 121; x2 = 112; za = 1.645
2. Null hypothesis: H0: μ1 - μ2 = 0, or H0: μ1 = μ2.
Alternative hypothesis: H1: μ1 > μ2. We want to reject H0 if the new
ingredient reduces mean drying time.
3. Test statistic: The test statistic is
x1 - x2 - D 0 121 - 112
z0 = = = 2.52
s 2
s 2 2
8 8 2
1
+ 2
+
n1 n2 10 10
4. Conclusion: Because z0 = 2.52 > 1.645, the P-value is
P = 1 - Φ(2.52) = 0.0059, so we reject H0 at the α = 0.05 level.
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
Probability of type II error β for a two-sided test
æ ö æ ö
ç ÷ ç ÷
ç D - D0 ÷ ç D - D0 ÷
b = F ç za /2 - ÷ - F ç - za /2 -
2 ÷
ç s 2
s 2
2 ÷ ç s 2
s 2 ÷
ç
1
+ ÷ ç
1
+ ÷
è n 1 n 2 ø è n 1 n 2 ø
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
Sample Siz for a two-sided test
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
( a /2 b ) ( 1 2 )
2
z + z s 2
+ s 2
n
( D - D0 )
2
Sample Siz for a One-sided test
For a one-sided alternative hypothesis with significance level α, the
sample size n1 = n2 = n required to detect a true difference in means
of Δ(≠ Δ0) with power at least 1 - β is
( )( )
2
za + zb s 12 + s 22
n
( 0)
2
D - D
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
Exercise
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 x1 = 4.7 and x2 = 7.8 . 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) for a true difference in
means of 3?
(d) Assume that sample sizes are equal. What sample size should be
used to obtain β =0.05 if the true difference in means is 3? Assume
that α = 0.05
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
10.2 Inference on the Difference in
Means of Two Normal Distributions,
Variance Unknown
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
Tests on the Difference in Means, Var(X) Unknown
s
Case 1: 1
2
= s 2
2 = s 2
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
Tests on the Difference in Means, Var(X) Unknown
Null hypothesis: H0: μ1 - μ2 = Δ0
X1 - X 2 - D0
Test statistic: T0 =
1 1
sp +
n1 n2
Alternative Rejection criteria for
hypothesis P-Value Fixed-Level Tests
H1: μ1 - μ2 ≠ Δ0 P = 2[1 - Φ(|t0|)] |t0|> tα/2; n1+n2-2
H1: μ1 - μ2 > Δ0 P = 1 - Φ(t0) t0 > tα; n1+n2-2
H1: μ1 - μ2 < Δ0 P = Φ(t0) t0 < - tα; n1+n2-2
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
Example
Two catalysts are being analyzed to determine how they affect the
mean yield of a chemical process. Specifically, catalyst 1 is currently
used; but catalyst 2 is acceptable. Because catalyst 2 is cheaper, it
should be adopted, if it does not change the process yield. A test is run
in the pilot plant and results in the data shown in Table 10.1. Is there
any difference in the mean yields? Use α = 0.05, and assume equal
variances.
Observation 1 2 3 4 5 6 7 8
Number
Catalyst 1 91.50 94.18 92.18 95.39 91.79 89.07 94.72 89.21
Catalyst 2 89.19 90.95 90.46 93.21 97.19 97.04 91.07 92.75
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
1. Parameter of interest: The parameters of interest are μ1 and μ2, the
mean process yield using catalysts 1 and 2, respectively, and we want
to know if μ1 - μ2 = 0. We have
n1 = n2 = 8; x1 = 92.255; s1 = 2.39; x2 = 92.733; s2 = 2.98; t a /2;n1 + n2 -2 = 2.145
2. Null hypothesis: H0: μ1 - μ2 = 0, or H0: μ1 = μ2.
Alternative hypothesis: H1: μ1 ≠ μ2.
3. Test statistic:
(
s2 = 1
n - 1) s1
2
+ ( n2 - 1) s 2
2
=
7 ´ 2.392 + 7 ´ 2.982
= 7.3
p
n1 + n2 - 2 8+8-2
x1 - x2 - D 0 92.255 - 92.733
t0 = = = -0.35
s p 1/ n1 + 1/ n2 7.3 1/ 8 + 1/ 8
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
4. Conclusion: Because |t0| = 0.35 < 2.145, the P-value is
P = 2(1 - Φ(0.35)) = 0.7269. Therefore, because the P-value exceeds α
= 0.05, the null hypothesis cannot be rejected H0.
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
Case 2: s 12 ¹ s 22
If H0: μ1 - μ2 = Δ0 is true, the statistic
X1 - X 2 - D0
T =
0
*
s12 s22
+
n1 n2
is distributed approximately as t with degrees of freedom given by
2
æs 2
s ö 2
ç + ÷
1 2
è n1 n2 ø
v=
( s1 / n1 ) + ( s2 / n2 )
2 2 2 2
n1 - 1 n2 - 1
If v is not an integer, round down to the nearest integer
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
Example
Arsenic concentration in
public drinking water
supplies is a potential health
risk. An article in the
Arizona Republic (May 27,
2001) reported drinking
water arsenic concentrations
in parts per billion (ppb) for
10 metropolitan Phoenix
communities and 10
communities in rural
Arizona. The data follow:
We wish to determine whether any difference exists in mean arsenic
concentrations for metropolitan Phoenix communities and for
communities in rural Arizona.
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
1. Parameter of interest: The parameters of interest are the mean
arsenic concentrations for the two geographic regions, say, μ1 and μ2,
and we are interested in determining whether μ1 - μ2 = 0. We have
n1 = n2 = 10; x1 = 12.5; s1 = 7.63; x2 = 27.5; s2 = 15.3
2. Null hypothesis: H0: μ1 - μ2 = 0, or H0: μ1 = μ2.
Alternative hypothesis: H1: μ1 ≠ μ2.
3. Test statistic:
x1 - x2 12.5 - 27.5
t =
*
0 = = -2.77
s / n1 + s / n2
2
1
2
2 7.63 /10 + 15.3 /10
2 2
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
2
æs
2
s ö
2
æ 7.632 15.32 ö
ç + ÷ +
1 2
n n ç ÷
è 2 ø è 10 10 ø
v= 1
= = 13.2 13
( 1 1) + ( 2 2 ) ( ) + ( /10 )
2 2 2 2 2 2 2 2
s / n s / n 7.63 /10 15.3
n1 - 1 n2 - 1 9 9
a = 0.05 Þ ta = t0.025,13 = 2.16
,v
2
4. Conclusion: Because |t0 |= 2.77 > 2.16, => reject H0.
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
Confidence Interval on the Difference in Means,
Variances Unknown
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
Confidence Interval on the Difference in Means,
Variances Unknown
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
EXAMPLE.
An article in the journal Hazardous Waste and Hazardous Materials
(1989, Vol. 6) reported the results of an analysis of the weight of
calcium in standard cement and cement doped with lead. Reduced
levels of calcium would indicate that the hydration mechanism in the
cement is blocked and would allow water to attack various locations
in the cement structure. Ten samples of standard cement had an
average weight percent calcium of x1 = 90 with a sample standard
deviation of s1 = 5.0, and 15 samples of the lead-doped cement had an
average weight percent calcium of x 2 = 87 with a sample standard
deviation of s2 = 4.0.
Assume that weight percent calcium is normally distributed and find
a 95% confidence interval on the difference in means, μ1 - μ2, for the
two types of cement. Furthermore, we assume that both normal
populations have the same standard deviation.
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
10.6. Inference on Two Population
Proportions
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
Test Statistic for the Difference of Two Population Proportions
Null hypothesis: H0: p1 = p2
1 - P
2
Z0 =
P = x1 + x2
,P
Test statistic: n1 + n2
(
)
æ1 1ö
P 1- P ç + ÷
è n1 n2 ø
Alternative P-Value Rejection criteria
hypothesis
H1: p1 ≠ p2 P = 2[1 - Φ(|z0|)] |z0| > zα/2
H1: p1 > p2 P = 1 - Φ(z0) z0 > zα
H1: p1 < p2 P = Φ(z0) z0 < - zα
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
Example
Extracts of St. John’s Wort are widely used to treat depression. An
article in the April 18, 2001, issue of the Journal of the American
Medical Association (“Effectiveness of St. John’s Wort on Major
Depression: A Randomized Controlled Trial”) compared the efficacy
of a standard extract of St. John’s Wort with a placebo in 200
outpatients diagnosed with major depression. Patients were randomly
assigned to two groups; one group received the St. John’s Wort, and
the other received the placebo. After 8 weeks, 19 of the placebo-
treated patients showed improvement, and 27 of those treated with
St. John’s Wort improved. Is there any reason to believe that St.
John’s Wort is effective in treating major depression? Use α = 0.05.
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
1. Parameter of interest: The parameters of interest are p1 and p2,
the proportion of patients who improve following treatment with St.
John’s Wort (p1) or the placebo (p2). We have
27 19 x1 + x2 27 + 19
n1 = n2 = 100, p1 = = 0.27, p 2 = = 0.19; p = = = 0.23
100 100 n1 + n2 100 + 100
2. Null hypothesis: H0: p1 = p2
Alternative hypothesis: H1: p1 > p2
3. Test statistic:
p1 - p 2 0.27 - 0.19
z0 = = = 1.34
( )
p 1 - p æ 1 + 1 ö æ 1 1 ö
ç ÷ 0.23 (1 - 0.23) ç + ÷
n
è 1 n2 ø è 100 100 ø
4. Because z0 < z0.05 , the P-value is P = 1 - Φ(1.34) = 0.09, so, we
cannot reject the null hypothesis.
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
Example
A vote is to be taken among the residents of a town and the
surrounding county to determine whether a proposed chemical plant
should be constructed. The construction site is within the town
limits, and for this reason many voters in the county believe that the
proposal will pass because of the large proportion of town voters
who favor the construction. To determine if there is a significant
difference in the proportions of town voters and county voters
favoring the proposal, a poll is taken. If 120 of 200 town voters favor
the proposal and 240 of 500 county residents favor it, would you
agree that the proportion of town voters favoring the proposal is
higher than the proportion of county voters? Use an α = 0.05 level of
significance.
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
1. Parameter of interest: Let p1 and p2 be the true proportions of
voters in the town and county, respectively, favoring the proposal.
We have
120 240 x1 + x2 120 + 240
n1 = 200, n2 = 500, p1 = = 0.6, p 2 = = 0.48; p = = = 0.51
200 500 n1 + n2 200 + 500
2. Null hypothesis: H0: p1 = p2
Alternative hypothesis: H1: p1 > p2
3. Test statistic:
p1 - p 2 0.6 - 0.48
z0 = = = 2.9
( )
p 1 - p æ 1 + 1 ö æ 1 1 ö
ç ÷ 0.51(1 - 0.51) ç + ÷
n
è 1 n2 ø è 200 5100 ø
4. Because z0 > z0.05 , the P-value is P = 1 - Φ(2.9) = 0.002, so, we
can reject the null hypothesis.
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
Type II Error and Choice of Sample Size
Two-sided test éz pq (1/ n1 + 1/ n2 ) - ( p1 - p2 ) ù
b =Fê ú
a /2
ê s p - p ú
ë 1 2 û
é -z pq (1/ n + 1/ n ) - ( p - p ) ù
-Fê ú
a /2 1 2 1 2
ê s p - p ú
ë 1 2 û
where n1 p1 + n2 p2 n1 (1 - p1 ) + n2 (1 - p2 )
p= ,q =
n1 + n2 n1 + n2
and
p1 (1 - p1 ) p2 (1 - p2 )
s p - p = +
1 2 n1 n2
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
Type II Error and Choice of Sample Size
One-sided test: p1 > p2
é z pq (1/ n + 1/ n ) - ( p - p ) ù
b =Fê ú
a 1 2 1 2
ê s p - p ú
ë 1 2 û
One-sided test: p1 < p2
é - z pq (1/ n + 1/ n ) - ( p - p ) ù
b = 1- F ê ú
a 1 2 1 2
ê s p - p ú
ë 1 2 û
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
Sample Size Formulas
Two-sided test
2
é za /2 ( p1 + p2 )( q1 + q2 ) / 2 + zb p1q1 + p2 q2 ù
n= ë û
( p1 - p2 )
2
where q1=1 – p1 and q2 = 1-p2.
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
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, and 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) Suppose that p1 = 0.05 and p2 = 0.01. With the sample sizes given
here, what is the power of the test for this two-sided alternate?
(c) Suppose that p1 = 0.05 and p2 =0.01. Determine the sample size
needed to detect this difference with a probability of at least 0.9.
Probability & Statistics
ĐẠI HỌC FPT CẦN THƠ
Confidence Interval on the Difference in Population
Proportions
Probability & Statistics