You are on page 1of 34

HYPOTHESIS TESTING FOR

TWO MEANS

CHAPTER 15

Chapter 16. Hypothesis testing for two means 1


Recall INFERENCE:
Real challenge of statistics is to come up with reliable statement
about a population, based on sample information

A specific hypothesis is
generated about a population
parameter.

Population
Parameter: descriptive
statistic of a population

Inference
Sample statistics are used to
assess the likelihood that the
hypothesis is true.

Sample
Statistic: descriptive
statistic of a sample

Chapter 16. Hypothesis testing for two means 2


Hypothesis testing for two means
■ Comparing means between groups: testing whether the observed
difference (increase, decrease or difference) is statistically significant
or not.
■ Samples may be either independent (unpaired) or paired (dependent):
– Independent samples: no connection between any subject in group 1 and
any subject in group 2. (Example: males and females glucose level)
– Paired samples: connection between scores in one group and scores in
the other. (Example: glucose level tested before and after a treatment)

Chapter 16. Hypothesis testing for two means 3


Exercise: for each of the following scenarios, indicate
whether the groups are independent or dependent

■ Among FHS students, is the MCAT score higher among females


compared to males?
■ Is the cholesterol level of males higher among male Lebanese
adults than that of female Lebanese adults?
■ Is the stress level different among active adults (exposed) and
unemployed adults (unexposed)?
■ Is the cholesterol level reduced after a 6 months treatment
with medication X among patients who underwent the
treatment?

Chapter 16. Hypothesis testing for two means 4


HYPOTHESIS TESTING FOR TWO
INDEPENDENT SAMPLE MEANS

Chapter 16. Hypothesis testing for two means 5


Hypothesis testing:
Two independent sample means
■ The two comparison groups are independent or physically
separate.
■ The two groups might be determined by:
– a particular attribute (ex: gender, presence of a particular disease or
exposure)
– The investigator (ex: participants assigned to treatment or placebo group)

q For each sample: compute the sample size, mean and standard
deviation;
!1, s1
q Sample 1: n1, X
!2 , s1
q Sample 2: n2, X

Chapter 16. Hypothesis testing for two means 6


Test statistics for testing H0: 𝜇1 = 𝜇2

𝑋# − 𝑋$
n1 ≥ 30 and n2 ≥30 𝑧= Find critical value of z in Table
1 1
𝑆% +
𝑛# 𝑛$

𝑋# − 𝑋$ Find critical value of t in Table,


n1 < 30 and n2 <30 𝑡=
1 1
𝑆% + df = n1+n2 - 2
𝑛# 𝑛$

𝑛# − 1 𝑠#$ + (𝑛$ − 1)𝑠$$


𝑆% =
𝑛# + 𝑛$ − 2

Chapter 16. Hypothesis testing for two means 7


Hypothesis testing:
Two independent sample means
8

When n1≥30 and n2≥30


Assumptions: Samples are independent and
selected from normally distributed populations

Chapter 16. Hypothesis testing for two means 8


Hypothesis testing:
Two independent sample means
¨ (Example taken from Sullivan textbook, chap7, p.139)

¨ From the data collected during the 7th examination in the


Framingham Heart Study, we are interested in examining
whether there is a statistically significant difference in mean
systolic blood pressures (SBP) between men and woman using
a 5% level of significance.

SBP

Men Women
n 1623 1911
!
X 128.2 126.5
s 17.5 20.1

Chapter 16. Hypothesis testing for two means 9


Hypothesis testing:
Two independent sample means
■ Procedures for hypothesis testing
à Setting up hypothesis and determine level of significance
H0: µ1=µ2
H1: µ1≠µ2 à (two- tailed test is used)
α=0.05

à Depending on the research hypothesis formulation, H1 can be written as:

H1: µ1>µ2 (the 1st mean is larger than the 2nd)


H1: µ1<µ2 (the 1st mean is smaller than the 2nd)

Chapter 16. Hypothesis testing for two means 10


■ Procedures for hypothesis testing
à Selecting the appropriate test statistic
Since n1≥30 and n2≥30, à test statistic is

This standard error is the amount of error involved in


X1 - X 2 using 2 sample means to estimate 2 populations
z= means.
1 1 We assume equal variances between the groups.
Sp +
n1 n2 Since two samples à must average the two samples’
variances
Sp is always between s1 & s2 because it’s the weighted
average of the Std Dev. in the sample

(n1 - 1) s12 + (n2 - 1) s22


Sp =
n1 + n2 - 2
Chapter 16. Hypothesis testing for two means 11
■ Procedures for hypothesis testing
1. Calculate pooled standard deviation

(n1 - 1) s12 + (n2 - 1) s22 (1623 - 1)(17.5) 2 + (1911 - 1)(20.1) 2


Sp = =
n1 + n2 - 2 1623 + 1911 - 2
= 359.12 = 19.0
SBP

Men Women
n 1623 1911
X 128.2 126.5
s 17.5 20.1

• Sp is a weighted average of the standard deviations in the comparison groups,


weighted by respective sample sizes.

• It falls between the std. dev. of the comparison groups (17.5 & 20.1) => closer to
20.1 as there is more women in the sample.
■ Procedures for hypothesis testing
2. Calculate z-test

X1 - X 2 128.2 - 126.5 1.7


z= = = = 2.66
1 1 1 1 0.64
Sp + 19.0 +
n1 n2 1623 1911

SBP

Men Women
n 1623 1911
X 128.2 126.5
s 17.5 20.1

Chapter 16. Hypothesis testing for two means 13


■ Procedures for hypothesis testing
à Statistical decision: (a) Critical value method

Z = 2.66 > 1.96

§ At α=0.05, critical Z value for two-tailed test is -1.96 (or +1.96)

Since 2.66 > 1.96; H0 is rejected.


à Statistical evidence at α=0.05 that there is a difference in
mean SBP between men and women.
■ Procedures for hypothesis testing
à Statistical decision: (b) p-value method

P(z>2.66) = 0.5 - 0.4961 = 0.0039

At α=0.05, p(Z>2.66)<0.05
à H0 is rejected.

à Statistical evidence at α=0.05 that there is a difference in mean


SBP between men and women.

Chapter 16. Hypothesis testing for two means 15


■ Procedures for hypothesis testing
à Statistical decision: (c) 95% confidence interval method

. .
#1 − X
95% CI for μ1-μ2= X #2 ± Z0.05 (Sp + )
/! /"

The 95% CI for the difference in the mean SBP is calculated as:

• 95% CI = 1.7 ± 1.96 * 0.64 = 1.7 ± 1.26 ;

• or (0.44, 2.96) à significant at 0.05 level as it does not contain the


null value of 0

• The CI provides an assessment of the magnitude of the difference


between means

• Whereas the test of hypothesis and p-value provides an


assessment of statistical significance of the difference.
Hypothesis testing:
Two independent sample means
17

(2) When n1<30 or n2 <30

Chapter 16. Hypothesis testing for two means 17


Hypothesis testing:
Two independent sample means
¨ (Example taken from Kuzma textbook, chap9, p.158)

¨ The pre-experiment blood pressure of 15 males and 15 females


is given in the table below:

Sample Standard
Mean
size deviation
Males 15 120.2 10.101
Females 15 108.2 10.483

à Is the pre-experiment blood pressure significantly


higher in males than that in females?

Chapter 16. Hypothesis testing for two means 18


Hypothesis testing for two means:
Two independent sample means

■ Procedures for hypothesis testing


à Setting up hypothesis and determine level of significance
H0: µ1=µ2
H1: µ1>µ2 à (upper- tailed test is used)
α=0.05

Chapter 16. Hypothesis testing for two means 19


Hypothesis testing:
Two independent sample means
■ Procedures for hypothesis testing
à Selecting the appropriate test statistic
Since n1<30 and n2<30, à test statistic is

X1 - X 2
t= Pooled sample standard deviation,
df= n1+n2-2
1 1
Sp +
n1 n2

(n1 - 1) s12 + (n2 - 1) s22


Sp =
n1 + n2 - 2

Chapter 16. Hypothesis testing for two means 20


■ Procedures for hypothesis testing
1. Calculate the pooled standard deviation

(n1 - 1) s12 + (n2 - 1) s22 (15 - 1)(10.101) 2 + (15 - 1)(10.483) 2


Sp = =
n1 + n2 - 2 15 + 15 - 2

= 10.29

Chapter 16. Hypothesis testing for two means 21


■ Procedures for hypothesis testing
2. Calculate t-test

X1 - X 2 120.2 - 108.2 12
t= = = = 3.19
1 1 1 1 3.757
Sp + 10.29 +
n1 n2 15 15

df = 28

Chapter 16. Hypothesis testing for two means 22


■ Procedures for hypothesis testing
à Statistical decision: (a) Critical value method

§ At α=0.05
§ Critical t value for df=28
for upper-tailed test is
1.701
§ Since 3.19 > 1.7
§ H0 is rejected

à There is a difference in
mean SBP between men and
women.
Hypothesis testing:
Two independent sample means
■ Procedures for hypothesis testing
à Statistical decision: (b) 95% confidence interval method
95% CI for µ1-µ2= x1 - x2 ± t0.05 (S p 1 + 1 )
n1 n2

• The 95% CI for the difference in the mean SBP is calculated as


12 ± 2.0484 (3.757); or (4.3, 19.7) à significant at 0.05 level as
it does not contain the null value

Chapter 16. Hypothesis testing for two means 24


HYPOTHESIS TESTING FOR TWO
DEPENDENT SAMPLE MEANS

Chapter 16. Hypothesis testing for two means 25


Hypothesis testing:
Two dependent sample means
■ Two samples are measured on the same items
■ Testing often generates appropriate comparisons, because
variability due to extraneous factors is reduced.

q Before performing statistical analysis, we have to decide


whether we look at pre-post test for the entire sample or divide
the analysis by attribute (ex: gender)
q The entire sample is chosen if the experimental conditions
would affect males and females equally.

Chapter 16. Hypothesis testing for two means 26


Hypothesis testing:
Two dependent sample means
27

(1) When n <30


Assumptions: matched pairs

Chapter 16. Hypothesis testing for two means 27


Chapter 16. Hypothesis testing for two means 28
Hypothesis testing:
Two dependent sample means
¨ (Example taken from Sullivan textbook, chap7, p.142)

¨ A new drug is proposed to lower cholesterol level and


a study is designed to evaluate the efficacy of the
drug in lowering cholesterol. 15 patients were asked
to take the drug for 6 weeks. Each patient’s
cholesterol level was measured before starting the
treatment and 6 weeks after treatment.

Chapter 16. Hypothesis testing for two means 29


N= 15
0d = 16.9
X
sd= 14.2

∑ 𝑑𝑖𝑓𝑓𝑒𝑟𝑒𝑛𝑐𝑒𝑠
𝑋& =
𝑛

254
= = 16.9
15

(∑ 𝐷𝑖𝑓𝑓𝑒𝑟𝑒𝑛𝑐𝑒𝑠)$
∑ 𝐷𝑖𝑓𝑓𝑒𝑟𝑒𝑛𝑐𝑒𝑠 $ −
𝑠& = 𝑛
Sum=254
𝑛−1
7110 - (254) 2 / 15
Is there a statistical evidence of reduction? sd =
15 - 1
Chapter 16. Hypothesis testing for two means = 200.64 = 14.2 30
Step 1:

■ Procedures for hypothesis testing


à Setting up hypothesis and determine level of
significance
H0: µd=0
H1: µ1>µ2 à (upper- tailed test is used)
α=0.05

Chapter 16. Hypothesis testing for two means 31


Step 2:

■ Procedures for hypothesis testing


à Selecting the appropriate test statistic
Since n<30, à test statistic is

# d − µd
X 16.9
t= = = 4.61 df=n-1
Sd/ n 14.21
15

Chapter 16. Hypothesis testing for two means 32


Step 3:
à Statistical decision:
(a) Critical value method

t = 4.61 > 1.761,

§ At α=0.05, critical ”t” value for df=14 for upper-tailed test is


1.761

§ If tobs>1.761 => H0 rejected


§ Since 4.61>1.761; H0 is rejected.

à Statistical evidence at α=0.05 that there is a statistically


significant reduction in cholesterol levels over 6 weeks

33
Hypothesis testing:
Two dependent sample means
34

2) When n>30

# d − µd
X
Z=
Sd/ n

Find critical value of z in table

Chapter 16. Hypothesis testing for two means 34

You might also like