0% found this document useful (0 votes)
9 views24 pages

Module 08 TwoSampleMeans

The document outlines biostatistical methods for inference concerning two-sample means, focusing on both independent and paired samples. It details how to construct confidence intervals, conduct hypothesis tests for mean differences, and test for equality of variances. Additionally, it provides examples and assumptions related to paired t-tests and independent t-tests, along with methods for calculating test statistics and confidence intervals.

Uploaded by

Shiwei Chen
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views24 pages

Module 08 TwoSampleMeans

The document outlines biostatistical methods for inference concerning two-sample means, focusing on both independent and paired samples. It details how to construct confidence intervals, conduct hypothesis tests for mean differences, and test for equality of variances. Additionally, it provides examples and assumptions related to paired t-tests and independent t-tests, along with methods for calculating test statistics and confidence intervals.

Uploaded by

Shiwei Chen
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

P8130: Biostatistical Methods I

Methods of Inference: Two-Sample Means

Instructor: Vahe Khachadourian, MD, MPH, PhD


Methods of Inference: Two-Sample Means
This module focuses on inferential methods concerning two-sample
means (independent and paired samples).
You will learn how to:
• Construct a confidence interval to estimate the population mean
difference.

• Conduct a hypothesis test to compare the two population means.


• Conduct a hypothesis test for the equality of variances.
Two-Sample Inference
• Thus far we were only interested in one parameter from a single
population (one sample)
• What if we want to compare parameters in more than one population?
• In a two-sample setting, we want to make inferences about the
parameters of two populations (both values unknown)
• First, we need to decide if the two samples are Independent or Paired
The Paired t-test
Example: You are testing a new blood pressure medication on a sample of n randomly
selected patients that came for regular consults at CUMC in 2020. Systolic blood
pressure (SBP) measurements were recorded at the first visit and 6 months later for all
subjects.
Data structure: paired samples
Visit 1 Visit 2 Differences
𝑋!! → 𝑋!" 𝑑! = 𝑋!! − 𝑋!"
𝑋"! → 𝑋"" 𝑑" = 𝑋"! − 𝑋""
⋮ ⋮ ⋮
𝑋#! → 𝑋#" 𝑑# = 𝑋#! − 𝑋#"
The Paired t-test
Assumptions:
Visit 1 Visit 2 Differences
SBP measurements are normally distributed with
mean 𝜇! and 𝜇", for visit 1 and 2, respectively. 𝑋!! → 𝑋!" 𝑑! = 𝑋!! − 𝑋!"
𝑋"! → 𝑋"" 𝑑" = 𝑋"! − 𝑋""
If follows that the differences 𝑑! ~𝑁 ∆, 𝜎"# , 𝑖 = 1,2, … , 𝑛.
⋮ ⋮
𝑋#! → 𝑋#" 𝑑# = 𝑋#! − 𝑋#"
The problem reduces to one-sample t-test based
on the differences 𝑑$ (variance unknown), where:

"
𝑑̅ = ∑#$%! 𝑑$ /𝑛 and 𝑠& = ∑#$%! ̅
𝑑$ − 𝑑 /(𝑛 − 1), n represents # of pairs
Two-Sided Paired t-test
Test for the mean of the differences with unknown variance:
𝐻! : 𝜇" − 𝜇# = 0 𝑜𝑟 Δ = 0
vs.
𝐻" : 𝜇" − 𝜇# ≠ 0 𝑜𝑟 Δ ≠ 0

With a pre-specified significance level α, compute the test statistic:


𝑑̅ − 0
𝑡=
𝑠$ / 𝑛
Reject 𝐻! : if 𝑡 > 𝑡%&","&(/#
Fail to reject 𝐻! : if |𝑡| ≤ 𝑡%&","&(/#

𝑡$%&,&%(/# is called the critical value and it can be found in tables or calculated using software.
Confidence Interval for Δ
A 100 1 − 𝛼 % confidence interval for the true mean difference (Δ) of two
paired samples is given by:

𝑠$ 𝑠$
𝑑̅ − 𝑡%&","&(/# ̅
≤ ∆≤ 𝑑 + 𝑡%&","&(/#
𝑛 𝑛
Where:
𝑑̅ is the point estimate of the mean difference;
*!
%
is the estimated standard error of the differences;

𝑡%&","&(/# is the percentile of the t-distribution with (n-1) degrees of freedom.


The Paired t-test: Example
Test if a new diet has an effect on lowering the Subject Before After Difference
LDL cholesterol levels. Use data from 12 randomly (X1) (X2) (After-Before)
selected subjects (time interval: 3 months).
1 201 200 -1
2 231 236 5
Assumption?
3 221 216 -5
4 260 233 -27
The observed LDL differences constitute a random
5 228 224 -4
sample from a normally distributed population of
6 237 216 -21
differences.
7 326 296 -30
8 235 195 -40
9 240 207 -33
10 267 247 -20
11 284 210 -74
12 201 209 8
Paired t-test: Example
Does new diet have an effect on lowering the LDL cholesterol levels? α=0.05
Paired t-test: Example
Construct a one-sided 95% CI for the mean LDL cholesterol levels:
Two-Sample Test for Independent Samples
• Consider that our two samples are independent (no relation/correlation
between the data points from the two groups) and that they are normally
distributed:

𝑋" ~𝑁(𝜇" , 𝜎"# ) and 𝑋# ~𝑁 𝜇# , 𝜎##

1. We can assume that the underlying variances of the two samples are equal:
𝜎"# =𝜎## =𝜎 #
2. We can assume that the underlying variances of the two samples are unequal:
𝜎"# ≠ 𝜎##
Two-Sample Test: Equal Variances
• If we know the two population variances, then:
𝜎"# 𝜎##
𝑋" − 𝑋# ~𝑁 𝜇" − 𝜇# , +
𝑛" 𝑛#
• Because 𝜎"# = 𝜎## = 𝜎 # , it follows that:
𝜎# 𝜎#
𝑋" − 𝑋# ~𝑁 𝜇" − 𝜇# , +
𝑛" 𝑛#

• Thus, for testing 𝐻! : 𝜇" = 𝜇# can use the test statistic:


+"&+#
𝑧= " "
~𝑁(0,1) under 𝐻!
, # $ -$
" #
Two-Sample Independent t-test: Equal Variances
• However, most of the times we do not know the common variance and we have
to find one estimator using the sample variances 𝑠"# and 𝑠## .

• The pooled estimate of the variance from two independent samples is given by:

# #
#
𝑛" − 1 𝑠" + (𝑛# − 1)𝑠#
𝑠 = (∗)
𝑛" + 𝑛# − 2

• Explain the denominator.


Two-Sample Independent t-test: Equal Variances
Given the hypotheses: 𝐻! : 𝜇" = 𝜇# vs 𝐻" : 𝜇" ≠ 𝜇# (two-sided)

With significance level α pre-specified, compute the test statistic:


+"&+#
𝑡= " "
, ~𝑡%"-%#&# under 𝐻!
* -
$" $#

Where 𝑠 is called the pooled sample standard deviation and is given in (*).

Reject 𝐻!: if 𝑡 > 𝑡"! #"" $%,'$(/%


Fail to reject 𝐻!: if |𝑡| ≤ 𝑡"! #"" $%,'$(/%
P-value = 2×P(𝑡"! #"" $% < 𝑡|𝐻! ), if 𝑡 < 0
= 2×P(𝑡"! #"" $% ≥ 𝑡|𝐻! ), if 𝑡 ≥ 0
Two-Sample Independent t-test: Unequal Variances
• If we know the two population variances, then:
𝜎"# 𝜎##
𝑋" − 𝑋# ~𝑁 𝜇" − 𝜇# , +
𝑛" 𝑛#
• For testing 𝐻! : 𝜇" = 𝜇# we can use the z-test statistic:
+"&+#
𝑧= ~𝑁(0,1) under 𝐻!
%# #
"-%#
$" $#

• Or (again) use 𝑠"# and 𝑠## to estimate the two population variances (if these
values are unknown).
Two-Sample Independent t-test: Unequal Variances
Given the hypotheses: 𝐻!: 𝜇' = 𝜇% vs 𝐻': 𝜇' ≠ 𝜇% (two-sided)

With significance level α pre-specified, compute the test statistic:


*! $*"
𝑡= ~𝑡+%% under 𝐻!
#" "
! # #"
$! $"

Compute the approximating degrees of freedom 𝑑, , and round down to the nearest
integer 𝑑,, :
#" # " "
!# "
$! $"
𝑑, = " " "
(∗∗)
#"
! #
$!
/("! $')# $" /("" $')
"
Two-Sample Independent t-test: Unequal Variances
Given the hypotheses: 𝐻!: 𝜇' = 𝜇% vs 𝐻': 𝜇' ≠ 𝜇% (two-sided)

With significance level α pre-specified, compute the test statistic:


*! $*"
𝑡= ~𝑡+%% under 𝐻!
#" "
! # #"
$! $"

Reject 𝐻!: if 𝑡 > 𝑡+%% ,'$(/%


Fail to reject 𝐻!: if |𝑡| ≤ 𝑡+%% ,'$(/%

Where 𝑑,, represents the nearest integer of 𝑑, (degrees of freedom) given in (∗∗).
Confidence Interval for Two Independent Samples
Two-sided 100 1 − 𝛼 % confidence interval (unknown variances):

• Two-independent samples (equal variance): 𝜇' − 𝜇% 𝜎'% = 𝜎%% = 𝜎 % :

(𝑋& − 𝑋' − 𝑡(! )(" *',&*,/' % 𝑠 % 1/𝑛& + 1/𝑛' , 𝑋' − 𝑋% + 𝑡"! #"" $%,'$(/% J 𝑠 J 1/𝑛' + 1/𝑛%)

• Two-independent samples (unequal variance): 𝜇' − 𝜇% 𝜎'% ≠ 𝜎%% :

(𝑋& − 𝑋' − 𝑡.## ,&*,/' 𝑠&' /𝑛& +𝑠'' /𝑛' , 𝑋& − 𝑋' + 𝑡.## ,&*,/' 𝑠&' /𝑛& +𝑠'' /𝑛' )

Where 𝑑 ** represents the nearest integer of 𝑑 * (degrees of freedom) given in (∗∗).


Test for Equality of Variances
Assume two independent random samples from 𝑁(𝜇', 𝜎'%) and 𝑁(𝜇%, 𝜎%%).

• Testing the equality of variances implies testing the hypotheses:

𝐻!: 𝜎'% = 𝜎%% vs 𝐻': 𝜎'% ≠ 𝜎%%

• With significance level α pre-specified, compute the test statistic:


𝑠'%
𝐹 = % ~ 𝐹"! $',"" $'
𝑠%
• The test statistic follows an F distribution with 𝑛' − 1 and 𝑛% − 1 degrees of freedom.
Test for Equality of Variances
Testing the hypotheses:
𝐻!: 𝜎'% = 𝜎%% vs 𝐻': 𝜎'% ≠ 𝜎%%

With significance level α pre-specified, compute the test statistic:


/!"
𝐹 = /" ~ 𝐹"! $',"" $' under 𝐻!
"

Reject 𝐻!: if 𝐹 > 𝐹"! $',"" $','$(/% or 𝐹 < 𝐹"! $',"" $',(/%

Fail to reject 𝐻!: if 𝐹"! $',"" $',(/% ≤ 𝐹 ≤ 𝐹"! $',"" $','$(/%

P-value = 2×P(𝐹"! $',"" $' > 𝐹|𝐻!), if 𝐹 ≥ 1


= 2×P 𝐹"! $',"" $' < 𝐹|𝐻! , if 𝐹 < 1
Two-Samples Independent t-test
Example: To assess the impact of oral contraceptive (OC) use on bone mineral density (BMD),
researchers in Canada carried out a study comparing BMD for women who had used oral contraceptives
(OC) for at least 3 months to BMD for women who had never used OC. Summary values for BMD are
given below:

n 𝑋0 s
Non OC users 10 1.08 0.16

OC users 10 1.00 0.14

a) Assuming that the BMD is normally distributed in both OC and non-OC users, is there enough
evidence to conclude that BMD levels differ between the two groups?
b) Construct a 95% CI for the population mean difference.
Two-Samples Independent t-test
Step 1: Test for equality of the variances.
Two-Samples Independent t-test
Step 2: Test for equality of the means.
Readings
• Rosner, Fundamentals of Biostatistics 8th edition:

• Chapter 8: Sections: 8.1 – 8.7

You might also like