Transcript Slide 1
Inference for distributions:
Comparing two means
IPS chapter 7.2
© 2006 W.H. Freeman and Company
Objectives (IPS chapter 7.2)
Comparing two means
Two-samples & the Normal distribution Two independent samples & the
t
-distribution Two sample
t
-test Two-sample
t
-confidence interval Robustness Details of the two sample
t
procedures
Comparing two samples
(A)
Population 1 Population 2 Sample 2 Sample 1 Population
Which is it?
(B) We often compare two treatments used on
independent
samples.
Sample 2 Sample 1
Independent samples: Subjects in one samples are unrelated to subjects in the other sample.
Is the difference between treatments due only to random variation (B) or does it reflect a true difference in population means (A)?
Two-sample z distribution
We have
two independent SRSs
coming maybe from two distinct populations with ( 1 , 1 ) and ( 2 , 2 ). We use
x
1 and
x
to estimate the unknown values of 1 and 2 .
is also normal, with standard deviation : Then the
two-sample z statistic
has the standard normal
N(
0
,
1
)
sampling distribution.
1 2
n
1 2 2
n
2
z
(
x
1
x
2 ) 1 2 ( 1
n
1 2 2
n
2 2 )
x
1 −
x
2 )
Two independent samples t distribution
Of course, we are unlikely to know the values of 1 and 2 so it is more practical to consider the case where they must be estimated.
We have
two independent SRSs
(simple random samples) coming from two distinct Normal populations with ( 1 , 1 ) and ( 2 , 2 ) unknown.
x
1 ,
s
1 ) and (
x
2 ,
s
2 ) to estimate ( 1 , 1 ) and ( 2 , 2 ), respectively.
In theory, both populations should be normally distributed. However, in that the sample data contain no strong outliers.
The two-sample
t
statistic follows approximately the t=distribution with a standard error SE (spread) reflecting variation from both samples:
SE
s
1
n
1 2
s
2 2
n
2
Conservatively, the degrees of freedom is set equal to the smallest of (n 1 − 1 and
n
2 − 1).
df
s
1
n
1 2
s n
2 2 2 1 2
x
1
x
2
Two-sample t-test
The null hypothesis is that both population means 1 and 2 are equal, thus their difference is equal to zero.
H
0 :
1
=
2 <> 1
−
2 0 with either a one-sided or a two-sided alternative hypothesis.
We find how many standard errors (SE) away from ( 1 − 2
x
1 −
x
2 ) by standardizing with
t
: Because in this two-sample test
H
0 poses ( 1 − 2 ) 0, we simply use
With df = min(n 1 − 1, n 2 − 1)
t t
(
x
1
x
2 ) ( 1 2 )
SE
x
1
x
2
s
1
n
1 2
s
2 2
n
2
Does smoking damage the lungs of children exposed to parental smoking?
Forced vital capacity (FVC) is the volume (in milliliters) of air that an individual can exhale in 6 seconds.
FVC was obtained for a sample of children not exposed to parental smoking and a group of children exposed to parental smoking. Parental smoking FVC
x s
Yes No 75.5
88.2
9.3
15.1
n
30 30 We want to know whether parental smoking decreases children’s lung capacity as measured by the FVC test.
The mean FVC is lower in the sample of children exposed to parental smoking. Is the observed difference too large to be attributed to chance?
H
0 : smoke
H
a : smoke = no < no <=> ( smoke <=> ( moke − − no ) = 0 no ) < 0 (one sided)
t
Under our assumptions, the standardized difference in sample averages follows approximately the
t
distribution:
t
We calculate the
t
statistic:
x
2
s smoke n smoke smoke
2
s no n no
75 9 .
3 .
30 5 2 88 .
15 .
30 1 2 12 .
7 2 .
9 7 .
6 3 .
9
t
s
2
smoke n smoke
s
2
no n no
,
df
29 Parental smoking Yes No In table C, for df 29 we find: FVC
x
75.5
88.2
s 9.3
15.1
n 30 30 |
t
| > 3.659 =>
p
< 0.0005 (one sided) It’s a very significant difference, we reject
H
0 .
Lung capacity is significantly impaired in children of smoking parents.
Two sample t-confidence interval
Because we have two independent samples we use the difference
x
1 −
x
2 ) to estimate ( 1 − 2 ).
Practical use of t: t*
C
−
t
* and
t
We find
t
* in the line of Table C *.
for df = smallest (
n
1 −1;
n
2 −1) and the column for confidence level C.
The margin of error
m
is:
C SE
s
1
n
1 2
s
2 2
n
2
m
t
*
s
1 2
n
1
s n
2 2 2
t
*
SE
m
−
t
*
m t
*
Common mistake !!!
A common mistake is to calculate a one-sample confidence interval for 1 and then check whether 2 falls within that confidence interval, or vice-versa.
This is WRONG because the variability in the sampling distribution for two samples is more complex and must take into account variability coming from both samples. Hence the more complex formula for the standard error.
SE
s
1 2
n
1
s n
2 2 2
Can directed reading activities in the classroom help improve reading ability? A group of 21 third-graders participates in these activities for 8 weeks while a group of 23 third-graders follows the same curriculum without the activities. After 8 weeks, all children take a reading test (scores in table).
95% confidence interval for (
µ
1 −
µ
2 ), with df = 20
t
* = 2.086:
CI
: (
x
1
x
2 )
m
;
m
t
*
s
1 2
n
1
s n
2 2 2 2 .
086 * 4 .
31 8 .
99 With 95% confidence, (
µ
1 −
µ
2 ), falls within 9
.
96 ± 8.99 or 1.0 to 18.9.
Robustness
The assumption of Normality is always suspect. Both 1- and 2-sample tests are reasonably robust to deviations from that very restrictive assumption even for moderate sized samples. Random sampling is a useful fiction but in most situations it is nearly impossible to get them. If an appropriate collection of experimental units (subjects, trees or whatever) can be found, then the random assignment of treatments to the experimental units can be used in place of random sampling, e.g. we randomly assign 6 trees to receive treatment A and another 6 to receive treatment B.
Details of the two sample t procedures
The
true value of the degrees of freedom
for a two-sample
t
distribution is quite lengthy to calculate. That’s why we use an approximate value, df = smallest(
n
1 − 1,
n
2 − 1), which errors on the conservative side (often smaller than the exact).
Satterthwaite’s solution is implemented by some computer packages. It utilized the following calculation for df.
df
n
1 1 1
s
1 2
n
1
s
1 2
n
1 2
s
2
n
2 2 2
n
2 1 1
s
2 2
n
2 2
Pooled two-sample procedures
There are two versions of the two-sample
t
-test: one
assuming equal variance (“pooled 2-sample test”)
and one
not assuming equal variance
(
“unequal” variance ,
as we have studied) for the two populations. They have slightly different formulas and degrees of freedom.
The pooled (equal variance) two sample
t
-test was often used before computers because it has exactly the
t
distribution for degrees of freedom
n
1 +
n
2 − 2.
Two normally distributed populations with unequal variances
However, the assumption of equal variance is hard to check, and thus the unequal variance test is safer.
When both population have the
same
standard deviation, the
pooled estimator of
σ
2
is: The sampling distribution for (
x
1 −
x
2 ) has exactly the
t
distribution with
(n
1 + n 2 − 2) degrees of freedom
.
A level
C
confidence interval for
µ
1 −
µ
2 is (with area C between −
t*
and
t
*) To test the hypothesis
H
0 :
µ
1 =
µ
2 against a one-sided or a two-sided alternative, compute the pooled two-sample
t
statistic for the
t(n
1 +
n
2 − 2
)
distribution.
Which type of test? 1-sample, paired samples, 2-samples?
Comparing vitamin content of bread immediately after baking vs. 3 days later (the same loaves are used on day one and 3 days later).
Is blood pressure altered by use of an oral contraceptive? Comparing a group of women who do not take an oral contraceptive with a group who do take it.
Comparing vitamin content of bread immediately after baking vs. 3 days later (one set of loaves tested at 1-day, another set at 3-days).
Average fuel efficiency for a 2005 automotive model is 21 miles per gallon. Is average fuel efficiency higher in the 2006 model? Review insurance records for dollar amount paid after fire damage in houses equipped with a fire extinguisher vs. houses without one. Was there a difference in the average dollar amount paid?