Professional Documents
Culture Documents
Outline:: Hypothesis Testing: Independent Two-Sample Inference-With Equal-Variances in The Normally Distributed Outcome
Outline:: Hypothesis Testing: Independent Two-Sample Inference-With Equal-Variances in The Normally Distributed Outcome
• Most clinical studies involve two samples (or groups) and 2 (or
more) treatments that need to be compared.
• Each group is assigned one of the two drugs and the mean of the
2 groups are compared.
1
Introduction to Two Samples
A subject can also be used as his/her own control (100% matching such
as follow up study design).
Use Paired t Test for comparing the means of the normally distributed
outcome in the matched paired samples (Discussed in Lecture 3)
2) Independent samples :
Data points in one sample are unrelated to data points in the second
sample.
Outcome being compared is normally distributed in the two groups.
2
Introduction to Two Samples
2) Independent samples : Testing for equality of variances
Before you conduct any t test you need first to test for normality of the outcome
being compared in the two groups using the test of normality (Shapiro test of
normality is an option).
After you confirm normality of the outcome in the two groups then before you
proceed with conducting the t test for independent groups you need first to test
for equality of variances in the outcome between the two groups.
You should do the test of equality of variances in the outcome in the two
independent groups to determine whether you should conduct the independent
t test with equal or unequal variances.
The test for equality of population variances of the normally distributed outcome
in the two independent groups is done using the F test also referred to as test
of Homogeneity. This test is based on a new distribution referred to as the F
distribution. In SPSS the test for equality of population variances of the
outcome in two independent groups is conducted using Levene’s test.
if F Fn 1, n 1,1
or F Fn 1, n 1,
then reject H 0
1 2 2 1 2 2
if Fn 1, n 1,
F Fn 1, n 1,1
then fail to reject H 0
1 2 2 1 2 2
at level of significance
EPHD310 Basic Biostat lect 4 Dr. Jaffa 6
3
Testing the Equality of Variances Between Two Independent
Samples: The F Test
In the F test for equality of variances the two critical values are
1
F and F
n1 1, n2 1,1 n1 1, n2 1, F
2 2
n2 1, n1 1,1
2
4
Testing the Equality of Variances Between Two Independent Samples:
The F Test
In SPSS Levene’s Test is used to test for the equality of variances in the
outcome in the two independent groups. If this test is not significant then we fail
to reject the null hypothesis of equal variances of the outcome in the
independent groups and we assume homogeneity. Otherwise, we proceed with
independent t test with equal variances.
10
EPHD310 Basic Biostat lect 4 Dr. Jaffa
5
Test of Equality of Variances: Levene’s Test
H o : 12 22 vs H1 : 12 22
P-value for the test of equality of variances i.e. P-value for Levene’s test =
0.077 > 0.05 then at α = 0.05 level of significance we fail to reject the null
hypothesis of equal variances and we deduce that the variances of the normally
distributed outcome in the two independent groups are equal.
Hence in this example we use the pooled variance method for testing the
equality of means in the outcome in the two independent groups. That is, we
report the results listed under the “Equal Variances Assumed” option (row 1).
P-value for the test of equality of variances i.e. P-value for Levene’s test =
0.01 < 0.05 then at α = 0.05 level of significance we reject the null hypothesis of
equal variances in the normally distributed outcome between the two
independent groups and we deduce that the variances of the outcome in the
two independent groups are not equal.
In this example we use “Satterthwaite’s method” for testing equality of means
of the outcome in the two independent groups. That is, we report the results
listed under the “Equal Variances Not Assumed” option (row 2).
6
Two-sample t Test for Independent Samples with Equal Variances
• Assumptions: X1 ~ N(μ1, σ2) and X2 ~ N(μ2, σ2)
1 1
X 1 X 2 N 1 2 , 2
n1 n2
s2
n1 1 s12 n2 1 s22
n1 n2 2 df for t distribution is
n1+n2-2
• Where s1 and s2 are the sample standard deviations of the outcome in
group 1 and group 2 respectively.
EPHD310 Basic Biostat lect 4 Dr. Jaffa 13
H o : 1 2 vs H1 : 1 2 equivalently
Hypotheses:
H o : 1 2 =0 vs H1 : 1 2 0
3 methods can be used
Critical value method: Compute t test statistic: to conduct the
independent t test to test
x1 x2
t the null hypothesis of
1 1 equality of the mean of
s the outcome in the two
n1 n2 groups: critical value, P-
value, and CI methods
with s being the square root of the pooled variance s2.
7
Two-sample t Test for Independent Samples with Equal Variances:
Critical Value Method
P-value method: H o : 1 2 =0 vs H1 : 1 2 0
Decision rules:
If p-value ≤ α then at α level of significance we reject H0 and deduce at that
the means of the outcome in the two independent groups are different.
Otherwise we deduce that the means of the outcome in the two independent
groups are not significantly different.
8
Two-sample t Test for Independent Samples with Equal Variances:
Confidence Interval Method
The 100(1-α)% CI for the underlying true mean difference (μ1-μ2) between two
independent groups is given by :
1 1
100% 1 CI for 1 2 = x1 x2 t s
n1 n2 2,1 n1 n2
2
Decision rules:
If the CI crosses zero then fail to reject H0 of equal means of the outcome in
the two independent groups.
If the CI does not cross zero then we reject H0 and deduce that the means of
the outcome in the two independent groups are different.
• What can be said about the underlying mean difference in SBP between
the two groups of OC users and non-OC users?
9
Two-sample t Test for Independent Samples with Equal Variances:
Illustration
Solution: This is the case of two independent study design, and we are
comparing the means of the SBP a normally distributed outcome in the two
independent groups of OC and non-OC users among females.
However, step 1 before the t-test, is to test if the variances of the SBP in the
two independent groups of OC and non-OC users are equal or not using the F
test as shown in the following slide.
10
Testing the Equality of Variances Between Two Independent Samples:
The F Test
The hypotheses: H o : 12 22 vs H1 : 12 22
F statistic=0.706
Critical Values are:
Fn 1, n 1,1 = F 0.05 F7,20,0.975 3.01
1 2 2 8 1,211,1
2
1 1 1
Fn 1, n 1,
F7,20,0.025 0.226
1 2 2 F20,7,0.975 F24,7,0.975 4.42
Since Fn 1,n F7,20,0.025 0.226 F 0.706 Fn 1,n F7,20,0.975 3.01
1 2 1, 2 1 2 1,1 2
21
H o : 1 2 =0 vs H1 : 1 2 0
s 2
1 307.18
n1 n2 2 27
So s 307.18 17.527
11
Two-sample t Test for Independent Samples with Equal Variances:
Illustration
H o : 1 2 =0 vs H1 : 1 2 0
Since |t|= 0.74 < 2.052 then we fail to reject the null hypothesis at α=0.05
level of significance.
H o : 1 2 =0 vs H1 : 1 2 0
Conclusion Critical value method
12
Two-sample t Test for Independent Samples with Equal Variances:
Illustration
H o : 1 2 =0 vs H1 : 1 2 0
P-value method:
To compute the P-value look at t distribution with df = 27 and locate where
the t statistic fall:
Note that t27, 0.75 = 0.684 < |t| = 0.74 < t27, 0.80 = 0.855 so
The 95% CI for the true underlying mean difference in SBP between the
population of 35- to 39- year-old OC users and non-OC users is given by:
1 1
100% 1 CI for 1 2 x1 x2 tn1 n2 2,1 2 s
n1 n2
1 1
95% CI for 1 2 132.86 127.44 2.052 *17.527
8 21
95% CI for 1 2 5.42 14.94
95% CI for 1 2 9.52,20.36
13
Two-sample t Test for Independent Samples with Equal Variances:
Illustration
Confidence interval method: H o : 1 2 =0 vs H1 : 1 2 0
Interpretation:
We are 95% confident that the true underlying mean difference in SBP
between the population of 35- to 39- year-old OC users and non-OC users
lies between -9.52 and 20.36.
Note that by just looking at the CI we can tell whether result is significant or
not.
Since this CI contains zero then this means that the result is not significant,
and at α=0.05 level of significance we fail to reject H0 and deduce that the
true population means of SBP in the OC and non-OC users are not
significantly different and that the SBP is not associated with OC in the
female population.
14
Two-sample t Test for Independent Samples with Equal Variances
SPSS Output Example: This is NOT the exact OC example
x1 x2
t
1 1
s1 s
n1 n2
s2
x1 x2 133.43 128.10
First check normality of the outcome in the two independent groups. If confirmed
then proceed to utilization of the independent t-test.
Check for the homogeneity in the population variances of the outcome in the two
independent groups using F test.
If F test is not significant then variances are equal then carry out independent t-test
for testing equality of means of the two independent groups assuming equal
variances and using the pooled variances method (lect 4).
If F test is significant then variances are not equal, then carry out independent t-test
for testing equality of means of the two independent groups assuming unequal
variances and using the Satterthwaite’s Method (lect 5).
30
EPHD310 Basic Biostat lect 4 Dr. Jaffa
15
Types of Study Design, outcome, and Appropriate Tests
First check normality of the outcome in the two dependent groups. If confirmed then
proceed to utilization of the dependent paired t-test as was discussed in lec 3.
31
EPHD310 Basic Biostat lect 4 Dr. Jaffa
By the end of this course, students are expected to be able to achieve the
following LOs:
16