Two-sample t

advertisement
Module 17: Two-Sample t-tests, with
equal variances for the two
populations
This module describes one of the most utilized
statistical tests, the two-sample t-test conducted
under the assumption that the two populations from
which the two samples were selected have the same
variance.
Reviewed 11 May 05 /MODULE 17
17 - 1
The General Situation
Up to this point, the focus has been on a single population,
for which the observations had a normal distribution with a
population mean  and standard deviation . From this
population, a random sample of size n provided the sample
statistics x and s as estimates of  and , respectively.
We created confidence intervals and tested hypotheses
concerning the population mean , using the normal
distribution when we had available the value of  and using
the t distribution when we did not and thus used the
estimate s from the sample. This circumstance is often
described as the one sample situation.
17 - 2
Clearly, we are often faced with making judgments
for circumstances that involve more than one
population and sample. For the moment, we will
focus on the so-called two sample situation. That is,
we consider two populations.
City A
City B
Mean
µA
µB
SD
A
B
Question:
Do you believe the two populations have the same
mean?
17 - 3
Two Sample Hypotheses
H0: A = B versus H1: A  B
or equivalently
H0: Δ = A - B = 0 versus H1: Δ = A - B  0.
17 -
Parameters vs. Estimates
Population 1
Parameter
Estimate
Population 2
Parameter
Estimate
2
x2
σ22
σ2
s2 2
s2
Populations of individual values
1
σ1 2
σ1
x1
s1 2
s1
Populations of means, samples of size n1 and n2
1
σ12/n1
σ1/√n1
x1
s12/n1
s1/√n1
2
σ22/n2
σ2/√n2
x2
s22/n2
s2/√n2
17 - 4
We are interested in
d  x1  x2
Δ = µ1 - µ2
If the samples are independent, then
Var ( x1  x2 )  Var ( x1 )  Var ( x2 )
Var ( x1  x2 ) 
 12
n1

 22
n2
When
12
  22 ,
2
1
1 
Var ( x1  x2 )     
 n1 n2 
17 - 5
Estimating σ2
When 12   22   2 ,
we have two estimates of σ2 , one from sample 1,
namely s12 and one from sample 2, namely s22. How
can we best use these two estimates of the same thing.
One obvious answer is to use the average of the two;
however, it may be desirable to somehow take into
account that the two samples may not the same size. If
they are not the same size, then we may want the
larger one to count more.
17 - 6
Pooled Average
Hence, we use the weighted average of the two sample
variances, with the weighting done according to
sample size. This weighted average is called the
pooled estimate:
s
2
p

n1  1s  n2  1s

n1  1  n2  1
2
1
2
2
17 - 7
Estimate of Var( x1  x2)
To estimate Var( x1  x2), we can use


1
1
2
s p   
 n1 n2 
17 - 8
Example 1: Blood Pressures of Children
To investigate the question of whether the children of city A
and city B have the same systolic blood pressure, a random
sample of n = 10 children was selected from each city and
their blood pressures measured. These samples provided
the following data:
Statistic
N
x (mmHg)
s2(mmHg)2
s (mmHg)
City A
10
105.8
78.62
8.87
City B
10
97.2
22.40
4.73
17 - 9
We are interested in the difference:
Δ = A -  B
and we have x A as an estimate of A and x B as an
estimate of B; hence it is reasonable to use:
d=
x A - xB = 105.8 - 97.2 = 8.6 (mm Hg)
as an estimate of Δ = A - B.
17 - 10
We then can ask whether this observed difference of 8.6
mm Hg is sufficiently large for us to question whether the
two population means could be the same, that is, A = B.
Clearly, if the two population means are truly equal, that is,
if A = B is true, then we would expect the two sample
means also to be equal, that is x A = x B , except for the
random error that occurs as a consequence of using random
samples to represent the entire populations. The question
before us is whether this observed difference of 8.6 mm Hg
is larger than could be reasonably attributed to this random
error and thus reflects true differences between the
population means.
17 - 11
Confidence Interval for A- B, using sp

1
1
1
1 
C  (x A  xB )  t0.975 s p

  A   B  (x A  xB )  t0.975 s p

  0.95
nA nB
nA nB 

df  (nA  1)  (nB  1)
x A  xB  8.6
s 2p 
t0.975 = 2.1009
df  18
(nA  1) s A2  (nB  1) sB2
9(78.62)  9(22.4)

 50.51
(nA  1)  (nB  1)
18
17 - 12
S p  50.51  7.11

1 1
1 1
C  8.6  2.1009(7.11)
   A   B  8.6  2.1009(7.11)
   0.95
10 10
10 10 

C  1.92   A  B  15.27  0.95
17 - 13
Example 2: AJPH, April 1994; 84:p644
n  31
n  223
17 - 14
Example 2 (contd.)
1
OCCP Prog
31
2
Non OCCP Prog
223
mean
4.1
3.4
SD
1.2
1.5
S2
1.44
2.25
n
17 - 15
Example 2 (contd.)
1. The hypothesis:
H0 : 1  2 vs. H1: 1  2
2. The assumptions: Independent random samples from
2
2
2
normal distributions,  1   2  
3. The  level:
 = 0.05
x1  x2
4. The test statistic: t 
sp
1
1

n1
n2
5. The critical region: Reject H0 if t is not between
t0.975 (252)  1.97
17 - 16
6. Test result:
2
2
(
n

1)
s

(
n

1)
s
1
2
2
s 2p  1
(n1  1)  (n2  1)
s 2p
542.7

 2.154
252
1
1


n1 n2
s 2p
30(1.44)  222(2.25)

30  222
s p  2.154  1.47
1
1

 0.19
31 223
4.1  3.4
t
 2.5
1.47  0.19 
7. The Conclusion:
Reject H0 since t = 2.5 is not between
± 1.97; 0.01 < p < 0.02
17 - 17
Example 3: AJPH July 1994; 89:1068
17 - 18
Example 3 (contd.)
Mainland
Puerto Ricans
1,383
Cuban
Americans
357
mean
3.3
2.4
SE
0.2
0.7
n
s  SE n
s2
(0.2) 1383  7.44
55.35
(0.7) 357  13.23
175.03
Source: AJPH, July 1994; 89:1068
17 - 19
1. The hypothesis:
H0 : µ1 = µ2 vs. H1: µ1 ≠ µ2
2. The assumptions: Independent random samples
from normal distributions
2
2
2
1   2  
3. The  level:
4. The test statistic:
 = 0.05
x1  x2
t
sp
1
1

n1
n2
17 - 20
5. The critical region:
Reject if t is not between
 t0.975(1738) =1.96
6. The Result:
1382(55.35)  356(175.03)
s 
1382  356
2
p
s p  79.86  8.94
1
1

 0.059
1383 357
3.3  2.4
0.90
t

 1.71
8.94(0.059) (0.527)
7. Conclusion:
Accept H0: 1 = 2, since p >
0.05 ; 0.05 < p < 0.10
17 - 21
Example 4: AJPH July 1994; 89:1068
17 - 22
1. The hypothesis:
H0: SSS = NHS vs. H1: SSS ≠ NHS
2. The  level:
 = 0.05
3. The assumptions: Independent Samples, Normal
2
2
  NHS
Distribution,  SSS
4. The test statistic:
t
X SSS  X NHS
Sp
1
nSSS

1
nNHS
5. The critical region: Reject if t is not between ± 2.1315
17 - 23
6. The result :
2
2
(
n

1)
s

(
n

1)
s
SSS
NHS
NHS
s 2  SSS
p
(nSSS  1)  (nNHS  1)
6(142.5)2  9(334.1)2

 75, 096
69
s p  274.0
t
1427.6  1057.5
1 1
274.0

7 10
370.1

 2.75
274.0(0.49)
7. The conclusion: Reject H0: SSS = NHS ; 0.01< p < 0.02
17 - 24
Independent Random Samples from Two
Populations of Serum Uric Acid Values
Sample
Sum
Mean
1
1.2
0.8
1.1
0.7
0.9
1.1
1.5
0.8
1.6
0.9
10.6
1.06
2
1.7
1.5
2.0
2.1
1.1
0.9
2.2
1.8
1.3
1.5
16.1
1.61
17 - 25
Serum Acid Worksheet
Sample 1
x
x2
1.2
1.44
0.8
0.64
1.1
1.21
0.7
0.49
0.9
0.81
1.1
1.21
1.5
2.25
0.8
0.64
1.6
2.56
0.9
0.81
Sum
10.6
12.06
Mean
1.06
Sum2/n
1 1.236
SS
0.824
Variance
0.092
SD
0.303
Sample 2
x
x2
1.7
2.89
1.5
2.25
2.0
4.00
2.1
4.41
1.1
1.21
0.9
0.81
2.2
4.84
1.8
3.24
1.3
1.69
1.5
2.25
16.1
27.59
1.61
25.921
1.669
0.185
0.431
17 - 26
s12 = 0.09, s22 = 0.19
(n1  1) s  (n2  1) s
s 
(n1  1)  (n2  1)
2
p
2
1
2
2
(9)(0.09)  (9)(0.19)
s 
99
2
p
0.81  1.71
s 
 0.14 s p  0.37
,
18
2
p
17 - 27
Testing the Hypothesis That The Two Serum Uric
Acid Populations Have The Same Mean
1. The hypothesis:
H0: μ1 = μ2 vs. H1: μ1 ≠ μ2
2. The -level:
 = 0.05
3. The assumptions: Independent Random Samples
Normal Distribution,  12   22
4. The test statistic: t 
x1  x2
1
1
sp

n1 n2
17 - 28
5. The reject region: Reject H0: μ1 = μ2 if t is not
between ± t0.975(18) = 2.1009
6. The result:
1.06  1.61
0.55
t

 3.3
0.37(0.45)
1
1
0.37

10 10
7. The conclusion: Reject H0: μ1 = μ2 , since t is not
between ± 2.1009
17 - 29
Serum Uric Acid Values Before And
After a Special Meal
Sum
Mean
Before
1.2
0.8
1.1
0.7
0.9
1.1
1.5
0.8
1.6
0.9
10.6
1.06
After
1.7
1.5
2.0
2.1
1.1
0.9
2.2
1.8
1.3
1.5
6.1
1.61
17 - 30
Serum Uric Acid Values Before And After A
Special Meal
Worksheet
Person
1
2
3
4
5
6
7
8
9
10
Sum
Mean
Before
1.2
0.8
1.1
0.7
0.9
1.1
1.5
0.8
1.6
0.9
10.6
1.06
After
1.7
1.5
2.0
2.1
1.1
0.9
2.2
1.8
1.3
1.5
16.1
1.61
Sum2/n
SS
Variance
SD
da
0.5
0.7
0.9
1.4
0.2
-0.2
0.7
1.0
-0.3
0.6
5.5
0.55
d2
0.25
0.49
0.81
1.96
0.04
0.04
0.49
1.00
0.09
0.36
5.53
3.025
2.505
0.278
0.528
da = After - Before
17 - 31
Testing the Hypothesis That The Serum Uric Acid Levels
Before and After A Special Meal Are The Same
1. The hypothesis:
H0: Δ = 0 vs. H1: Δ ≠ 0,
where Δ = μAfter - μBefore
2. The -level:
 = 0.05
3. The assumptions: Random Sample of Differences,
Normal Distribution
4. The test statistic:
d x After  xBefore
t 
sd
sd n
17 - 32
Reject H0: Δ = 0, if t is not
between ± t0.975(9) = 2.26
5. The rejection region:
6. The result:
t
7. The conclusion:
0.55
0.528
0.55

 3.29
10 0.528 /(3.16)
Reject H0: Δ = 0 since t is not
between ± 2.26
17 - 33
Download