You are on page 1of 38

10

Statistical Inference
for Two Samples
CHAPTER OUTLINE

1
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
10.1. Inference on the Difference
in Means of Two Normal
Distributions, Variance Known
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.
Tests on the Difference in Means, Var(X) known

X1  X 2  0
Z0 
 12  22

n1 n2
σ2 known TEST 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?
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
 12   22  82 ; n1  n2  10; x1  121; x2  112; z  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   0 121  112
z0    2.52
2 2 2 2
  8 8

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 of type II error β for a two-sided test
   
   
   0     0 
    z /2       z /2 
2 2 2 2 
   2     2 

1
  
1
 
 n 1 n 2   n 1 n 2 

20/07/22
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
  
2
z /2  z  12   22
n
  0 
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
z  z  12   22
n
 0
2
  
20/07/22
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
10.2 Inference on the Difference in
Means of Two Normal Distributions,
Variance Unknown
Tests on the Difference in Means, Var(X) Unknown
2 2 2

Case 1: 1   2  
Tests on the Difference in Means, Var(X) Unknown

X1  X 2  0
T0 
1 1
sp 
n1 n2
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


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  /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:
 n  1 s 2
  n  1 s 2
7  2.392  7  2.982
2 1 1 2 2
sp    7.3
n1  n2  2 882

x1  x2   0 92.255  92.733
t0    0.35
sp 1/ n1  1/ n2 7.3 1/ 8  1/ 8
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.
2 2
Case 2:  1   2

If H0: μ1 - μ2 = Δ0 is true, the statistic

* X1  X 2  0
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
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.
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
2 2 2 2
s / n1  s / n2
1 2 7.63 /10  15.3 /10
2
s
2
s 
2
 7.632 15.32 
   
1 2
n n  
 1 2   10 10 
v   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

  0.05  t  t0.025,13  2.16


,v
2

4. Conclusion: Because |t0 |= 2.77 > 2.16, => reject H0.


Confidence Interval on the Difference in Means,
Variances Unknown
Confidence Interval on the Difference in Means,
Variances Unknown
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.
10.6. Inference on Two Population
Proportions
Test Statistic for the Difference of Two Population Proportions
Null hypothesis: H0: p1 = p2
1  P
2
Z0 
P   x1  x2
,P
n1  n2
 1 1
Test statistic: 
P 1  P


n
 1 n

2 

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α
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.
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 
  
n
 1 n

2 
0.23 1  0.23   
 100 100 

4. Because z0 < z0.05 , the P-value is P = 1 - Φ(1.34) = 0.09, so, we


cannot reject the null hypothesis.
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.
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 
  
n
 1 n

2 
0.511  0.51   
 200 5100 

4. Because z0 > z0.05 , the P-value is P = 1 - Φ(2.9) = 0.002, so, we


can reject the null hypothesis.
Type II Error and Choice of Sample Size
Two-sided test z pq 1/ n1  1/ n2    p1  p2  
  
 /2

  p  p 
 1 2 
 z pq 1/ n  1/ n    p  p  
 
 /2 1 2 1 2

  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 
 p  p  
1 2 n1 n2
Type II Error and Choice of Sample Size
One-sided test: p1 > p2

 z pq 1/ n  1/ n    p  p  
  
 1 2 1 2

  p  p 
 1 2 

One-sided test: p1 < p2

  z pq 1/ n  1/ n    p  p  
  1   
 1 2 1 2

  p  p 
 1 2 
Sample Size Formulas
Two-sided test
2
 z / 2  p1  p2  q1  q2  / 2  z p1q1  p2 q2 
n  
 p1  p2 
2

where q1=1 – p1 and q2 = 1-p2.


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.
Confidence Interval on the Difference in Population
Proportions

You might also like