Discuss the hypothesis testing issues of Type I and Type II errors and how those can cause theresearcher to reach a wrong conclusion about rejecting the null hypothesis. What steps must researchers
take to avoid Type I and Type II errors?
Embed course material concepts, principles, and theories (which require supporting citations) in your
initial response along with at least 2 scholarly, peer-reviewed journal articles. Keep in mind that these
scholarly references can be found in the Saudi Digital Library by conducting an advanced search specific
to scholarly references. Use Saudi Electronic University academic writing standards and APA style
guidelines.
Chapter 8
Power and
Sample Size
Determination
Learning Objectives
• Provide examples demonstrating how the
margin of error, effect size, and variability of the
outcome affect sample size computations
• Compute the sample size required to estimate
population parameters with precision
• Interpret statistical power in tests of hypothesis
• Compute the sample size required to ensure
high power in tests of hypothesis
Sample Size Determination
• Adequate sample size is needed to
ensure precision in analysis.
• Sample size determined based on type of
planned analysis.
– Confidence interval estimate
– Test of hypothesis
Determining Sample Size for
Confidence Interval Estimates (1 of 2)
• Goal is to estimate an unknown
parameter using a confidence interval
estimate.
• Plan a study to sample individuals, collect
appropriate data and generate CI
estimate.
• How many individuals should we sample?
Determining Sample Size for
Confidence Interval Estimates (2 of 2)
• Confidence intervals
point estimate ± margin of error
• Determine n to ensure small margin of
error (precision).
• Must specify desired margin of error,
confidence level, and variability of
parameter.
Example 8.1. Find n for One
Sample, Continuous Outcome (1 of 2)
• Planning study to estimate mean systolic
blood pressure in children with
congenital heart disease.
• Want estimate within 5 units of true
mean
• Will use 95% confidence level; estimate
of standard deviation is 20.
Example 8.1. Find n for One
Sample, Continuous Outcome (2 of 2)
2
2
Zσ 1.96(20)
n=
=
= 61.5
5
E
• Need sample size of 62 children with
congenital heart disease
Example 8.3. Find n for One
Sample, Dichotomous Outcome (1 of 2)
• Planning study to estimate proportion of
freshmen who currently smoke
• Want estimate within 5% of the true
proportion; will use 95% confidence level
Example 8.3. Find n for One
Sample, Dichotomous Outcome (2 of 2)
2
2
Z
1.96
n = p(1 − p) = 0.5(1 − 0.5)
= 384.2
E
0.05
• Formula requires estimate of proportion,
p. If unknown, use p = 0.5 to produce
largest n (most conservative).
• Need sample size of 385 freshmen
Example 8.5. Find n for Two Independent
Samples, Continuous Outcome (1 of 5)
• Planning a study to assess the efficacy of
a new drug to raise HDL cholesterol
• Participants will be randomized to receive
either the new drug or placebo and
followed for 12 weeks.
• Goal is to estimate the difference in mean
HDL between groups (m1 – m2).
Example 8.5. Find n for Two Independent
Samples, Continuous Outcome (2 of 5)
• Want estimate of the difference to be no
more than 3 units
• We will use a 95% confidence interval.
• The estimate of the (common) standard
deviation in HDL is 17.1.
• We expect 10% attrition over 12 weeks.
Example 8.5. Find n for Two Independent
Samples, Continuous Outcome (3 of 5)
2
2
Zσ
1.96(17.1)
n i = 2
= 2
= 249.6
3
E
• Need n1 = 250 and n2 = 250 with
complete outcome data
Example 8.5. Find n for Two Independent
Samples, Continuous Outcome (4 of 5)
• Need n1 = 250 and n2 = 250 with
complete outcome data (at end of study)
• Need to account for 10% attrition
• How many subjects must be enrolled?
Example 8.5. Find n for Two Independent
Samples, Continuous Outcome (5 of 5)
• Need n1 = 250 and n2 = 250 with complete
outcome data
• Account for 10% attrition:
Participants
enrolled N = ?
90%
10%
Complete study
(500)
Lost to follow-up
N (to enroll)*(% retained) = 500
Need to enroll 500/0.90 = 556
Example 8.7. Find n for Two Matched
Samples, Continuous Outcome (1 of 5)
• Planning study to estimate the mean
difference in weight lost between two
diets (low-fat versus low-carb) over 8
weeks
• A crossover trial is planned where each
participant follows each diet for 8 weeks
and weight loss is measured.
• Goal is to estimate the mean difference in
weight lost (md).
Example 8.7. Find n for Two Matched
Samples, Continuous Outcome (2 of 5)
Zσ d
n =
E
2
• Need to specify the margin of error (E), decide
on the confidence level, and estimate the
variability in the difference in weight lost
between diets
Example 8.7. Find n for Two Matched
Samples, Continuous Outcome (3 of 5)
• Want estimate of the difference in weight
lost to be within 3 pounds of the true
difference
• We will use a 95% confidence interval.
• The standard deviation of the difference in
weight lost is estimated at 9.1.
• Expect 30% attrition over 16 weeks.
Example 8.7. Find n for Two Matched
Samples, Continuous Outcome (4 of 5)
2
2
Zσ d 1.96(9.1)
n =
=
= 35.3
3
E
• Need n = 36 with complete outcome data
Example 8.7. Find n for Two Matched
Samples, Continuous Outcome (5 of 5)
• Need n = 36 with complete outcome data
• Account for 30% attrition:
Participants
enrolled N = ?
70%
30%
Complete study
(36)
Lost to follow-up
N (to enroll)*(% retained) = 36
Need to enroll 36/0.70 = 52
Example 8.8. Find n for Two Independent
Samples, Dichotomous Outcome (1 of 2)
• Planning study to estimate the difference
in proportions of premature deliveries in
mothers who smoke compared to those
who do not
• Want estimate within 4% of the true
difference, will use 95% confidence level
and assume that 12% of infants are born
prematurely
Example 8.8. Find n for Two Independent
Samples, Dichotomous Outcome (1 of 2)
Z
n i = [p1 (1 − p1 ) + p 2 (1 – p 2 )]
E
2
2
1.96
= [0.12(1 − 0.12) + 0.12(1 − 0.12)]
= 507.1
0.04
• Need n1 = 508 women who smoke during
pregnancy and n2 = 508 who do not, with
complete outcome data
Determining Sample Size for
Hypothesis Testing (1 of 2)
a = P(Type I error) = P(Reject H0|H0 true)
b = P(Type II error)
= P(Do not reject H0|H0 false)
• Power = 1 – b = P(Reject H0|H0 false)
Determining Sample Size for
Hypothesis Testing (2 of 2)
b and power are related to the sample
size, level of significance (a), and the
effect size (difference in parameter of
interest under H0 versus H1).
a, b, and Power
Determining Sample Size for
Hypothesis Testing
b and power are related to the sample
size, level of significance (a), and the
effect size (difference in parameter of
interest under H0 versus H1).
– Power is higher with larger a.
– Power is higher with larger effect size.
– Power is higher with larger sample size.
Example 8.11.
Find n to Test H0: m = m0 (1 of 2)
• Planning study to test
H0: m = $3302 vs.
H1: m ≠ $3302 at a = 0.05
• Determine n to ensure 80% power to
detect a difference of $150 in mean
expenditures on health care and
prescription drugs (assume standard
deviation is $890).
Example 8.11.
Find n to Test H0: m = m0 (2 of 2)
ES =
μ1 – μ 0
σ
150
=
= 0.17
890
Z1-α/2 + Z1-β 1.96 + 0.84
=
n =
= 271.3
ES
0.17
2
• Need sample size of 272
2
Example 8.12.
Find n to Test H0: p = p0 (1 of 2)
• Planning study to test
H0: p = 0.26 vs.
H1: p ≠ 0.26 at a = 0.05
• Determine n to ensure 90% power to
detect a difference of 5% in the
proportion of patients with elevated LDL
cholesterol.
Example 8.12.
Find n to Test H0: p = p0 (2 of 2)
p1 – p 0
0.05
ES =
=
= 0.11
p 0 (1 – p 0 )
0.26(1 – 0.26 )
Z1-α/2 + Z1-β 1.96 + 1.282
=
n =
= 868.6
ES
0.11
2
• Need sample size of 869
2
Example 8.14.
Find n1, n2 to Test H0: m1 = m2 (1 of 2)
• Planning study to test
H0: m1 = m2 vs.
H1: m1 ≠ m2 at a = 0.05
• Determine n1 and n2 to ensure 80% power
to detect a difference of 5 units in means
(assume standard deviation is 19.0).
• Expect 10% attrition.
Example 8.14.
Find n1, n2 to Test H0: m1 = m2 (2 of 2)
ES =
μ1 – μ 2
σ
5
=
= 0.26
19.0
2
Z1-α/2 + Z1-β
1.96 + 0.84
= 2
n = 2
= 232.0
ES
0.26
2
• Need samples of size n1 = 232 and n2 = 232
• Account for 10% attrition:
N (to enroll)*(% retained) = 464
Need to enroll 464/0.90 = 516
Example 8.16.
Find n to Test H0: md = 0 (1 of 2)
• Planning study to test
H0: md = 0 vs.
H1: md ≠ 0 at a = 0.05
• Determine n to ensure 80% power to
detect a 3-pound difference between diets
(assume standard deviation of differences
is 9.1).
Example 8.16.
Find n to Test H0: md = 0 (2 of 2)
μd
3
ES =
=
= 0.33
σ d 9.1
Z1-α/2 + Z1-β 1.96 + 0.84
=
n =
= 72.0
ES
0.33
2
• Need sample of size n = 72
2
Example 8.18.
Find n1, n2 to Test H0: p1 = p2 (1 of 2)
• Planning study to test
H0: p1 = p2 vs.
H1: p1 ≠ p2 at a = 0.05
• Determine n1 and n2 to ensure 80% power
to detect a difference in proportions of
hypertensives on the order of 24% versus
30% in the new drug and placebo
treatments.
Example 8.18.
Find n1, n2 to Test H0: p1 = p2 (2 of 2)
p1 – p 2
0.06
ES =
=
= 0.135
p(1 – p)
0.27(1 – 0.27)
Z1-α/2 + Z1-β
1.96 + 0.84
= 2
n = 2
= 860.4
ES
0.135
2
2
• Need samples of size n1 = 861 and n2 = 861
Chapter 7
Hypothesis
Testing
Procedures
Learning Objectives (1 of 3)
• Define null and research hypothesis, test
statistic, level of significance, and decision
rule
• Distinguish between Type I and Type II
errors and discuss the implications of each
• Explain the difference between one- and
two-sided tests of hypothesis
• Estimate and interpret p-values
Learning Objectives (2 of 3)
• Explain the relationship between
confidence interval estimates and pvalues in drawing inferences
• Perform analysis of variance by hand
• Appropriately interpret the results of
analysis of variance tests
• Distinguish between one- and two-factor
analysis of variance tests
Learning Objectives (3 of 3)
• Perform chi-square tests by hand
• Appropriately interpret the results of chisquare tests
• Identify the appropriate hypothesis testing
procedures based on type of outcome
variable and number of samples
Hypothesis Testing
• Research hypothesis is generated about
unknown population parameter.
• Sample data are analyzed and
determined to support or refute the
research hypothesis.
Hypothesis Testing Procedures
Step 1
• Null hypothesis (H0):
– No difference, no change
• Research hypothesis (H1):
– What investigator believes to be true
Hypothesis Testing Procedures
Step 2
• Collect sample data and determine
whether sample data support research
hypothesis or not.
• For example, in test for m, evaluate X .
Hypothesis Testing Procedures
Step 3
• Set up decision rule to decide when to
believe null versus research hypothesis.
• Depends on level of significance, a =
P(Reject H0|H0 is true)
Hypothesis Testing Procedures
Steps 4 and 5
• Summarize sample information in test
statistic (e.g., Z value).
• Draw conclusion by comparing test
statistic to decision rule.
• Provide final assessment as to whether
H1 is likely true given the observed data.
p-values
• p-values represent the exact
significance of the data.
• Estimate p-values when rejecting H0 to
summarize significance of the data
(can approximate with statistical tables,
can get exact value with statistical
computing package).
• p-value is the smallest a where we still
reject H0.
Hypothesis Testing Procedures
1. Set up null and research hypotheses,
select a.
2. Select test statistic.
2. Set up decision rule.
3. Compute test statistic.
4. Draw conclusion and summarize
significance.
Errors in Hypothesis Tests
Hypothesis Testing for m
• Continuous outcome
• One sample
H0: m = m0
H1: m > m0, m < m0, m ≠ m0
Test statistic:
n ≥ 30
n < 30
Z=
t=
X – μ0
s/ n
X – μ0
s/ n
(Find critical
value in Table 1C,
Table 2, df = n – 1)
Example 7.2.
Hypothesis Testing for m (1 of 4)
• The National Center for Health Statistics
(NCHS) reports the mean total cholesterol for
adults is 203. Is the mean total cholesterol in
Framingham Heart Study participants
significantly different?
• In 3310 participants the mean is 200.3 with a
standard deviation of 36.8.
Example 7.2.
Hypothesis Testing for m (2 of 4)
1. H0: m = 203
H1: m ≠ 203
a = 0.05
2. Test statistic:
Z=
X – μ0
s/ n
3. Decision rule:
Reject H0 if z ≥ 1.96 or if z ≤ –1.96
Example 7.2.
Hypothesis Testing for m (3 of 4)
4. Compute test statistic:
X – μ0
200.3 − 203
Z=
=
= −4.22
s/ n 36.8 / 3310
5. Conclusion. Reject H0 because –4.22 < –1.96. We
have statistically significant evidence at a = 0.05 to
show that the mean total cholesterol is different in
Framingham Heart Study participants.
Example 7.2.
Hypothesis Testing for m (4 of 4)
• Significance of the findings: Z = –4.22
Table 1C. Critical Values for Two-Sided Tests
a
Z
0.20
1.282
0.10
1.645
0.05
1.960
0.010
2.576
0.001
3.291
0.0001
3.819
p p0, p < p0, p ≠ p0
Test statistic:
min[np 0 , n(1 − p0 )] 5
Z =
p̂ – p 0
p 0 (1 – p 0 )
n
(Find critical value in Table 1C)
Example 7.4.
Hypothesis Testing for p (1 of 3)
• The NCHS reports that the prevalence of
cigarette smoking among adults in 2002 is
21.1%. Is the prevalence of smoking
lower among participants in the
Framingham Heart Study?
• In 3536 participants, 482 reported
smoking.
Example 7.4.
Hypothesis Testing for p (2 of 3)
1. H0: p = 0.211
H1: p < 0.211
2. Test statistic:
a = 0.05
Z =
p̂ – p 0
p 0 (1 – p 0 )
n
3. Decision rule:
Reject H0 if z ≤ –1.645
Example 7.4.
Hypothesis Testing for p (3 of 3)
4. Compute test statistic:
Z =
p̂ – p 0
=
p 0 (1 – p 0 )
n
0.136 – 0.211
= -10.93
0.211(1- 0.211)
3536
5. Conclusion. Reject H0 because –10.93 < –
1.645. We have statistically significant evidence
at a = 0.05 to show that the prevalence of
smoking is lower among the Framingham Heart
Study participants. (p Critical value from Table 3
Example 7.6.
c2 Goodness-of-Fit Test (1 of 4)
• A university survey reveals that 60% of students
get no regular exercise, 25% exercise
sporadically and 15% exercise regularly. The
university institutes a health promotion
campaign and re-evaluates exercise 1 year
later.
Number of students
None
255
Sporadic
125
Regular
90
Example 7.6.
c2 Goodness-of-Fit Test (2 of 4)
1. H0: p1 = 0.60, p2 = 0.25, p3 = 0.15
H1: H0 is false
a = 0.05
2. Test statistic:
2
(O
E)
χ2 =
E
3. Decision rule: df = k – 1 = 3 – 1 = 2
Reject H0 if c2 ≥ 5.99
Example 7.6.
c2 Goodness-of-Fit Test (3 of 4)
2
(O
E)
2
4. Compute test statistic: χ =
E
None
Sporadic
Regular
Total
No. students (O)
Expected
(E)
255
282
125
117.5
90
70.5
(O – E)2/E
2.59
0.48
5.39
c2 = 8.46
470
470
Example 7.6.
c2 Goodness-of-Fit Test (4 of 4)
5. Conclusion. Reject H0 because 8.46 > 5.99. We
have statistically significant evidence at a =
0.05 to show that the distribution of exercise is
not 60%, 25%, 15%.
Using Table 3, the p-value is p m2, m1 m2, m1 < m2, m1 ≠ m2
Test statistic:
n1 ≥ 30 and
n2 ≥ 30
n1 < 30 or
Z=
X1 – X 2
1
1
Sp
+
n1 n 2
X1 – X 2
t=
Sp
n2 < 30
1
1
+
n1 n 2
(Find critical value
in Table 1C,
Table 2,
df = n1 + n2 – 2)
Pooled Estimate of Common
Standard Deviation, Sp
• Previous formulas assume equal variances (s12
= s22).
• If 0.5 ≤ s12/s22 ≤ 2, assumption is reasonable.
Sp =
(n 1 − 1)s + (n 2 − 1)s
n1 + n 2 − 2
2
1
2
2
Example 7.9.
Hypothesis Testing for (m1 − m2) (1 of 3)
• A clinical trial is run to assess the effectiveness
of a new drug in lowering cholesterol. Patients
are randomized to receive the new drug or
placebo and total cholesterol is measured after
6 weeks on the assigned treatment.
• Is there evidence of a statistically significant
reduction in cholesterol for patients on the new
drug?
Example 7.9.
Hypothesis Testing for (m1 − m2) (2 of 3)
New drug
Placebo
Sample Size
15
15
Mean
195.9
227.4
Std Dev
28.7
30.3
Example 7.9.
Hypothesis Testing for (m1 − m2) (3 of 3)
1. H0: m1 = m2
H1: m1 < m2
2. Test statistic: t =
a = 0.05
X1 – X 2
1
1
Sp
+
n1 n 2
3. Decision rule:
df = n1 + n2 – 2 = 28
Reject H0 if t ≤ –1.701
Assess Equality of Variances
•
Ratio of sample variances: 28.72/30.32 = 0.90
Sp =
Sp =
(n 1 − 1)s 12 + (n 2 − 1)s 22
n1 + n 2 − 2
(15 − 1)28.7 2 + (15 − 1)30.32
15 + 15 − 2
= 870.89 = 29.5
Example 7.9.
Hypothesis Testing for (m1 − m2)
4. Compute test statistic:
t=
X1 – X 2
195.9 − 227.4
=
= −2.92
1 1
1 1
Sp
+
29.5
+
n1 n 2
15 15
5. Conclusion. Reject H0 because –2.92 < –1.701.
We have statistically significant evidence at a =
0.05 to show that the mean cholesterol level is
lower in patients on treatment as compared to
placebo. (p 0, md < 0, md ≠ 0
Test statistic:
X -μ
n ≥ 30
n < 30
Z=
t=
d
d
sd
n
Xd – μd
sd
n
(Find critical value
in Table 1C,
Table 2, df = n – 1)
Example 7.10.
Hypothesis Testing for md (1 of 3)
• Is there a statistically significant difference in
mean systolic blood pressures (SBPs)
measured at exams 6 and 7 (approximately 4
years apart) in the Framingham Offspring
Study?
• Among n = 15 randomly selected participants,
the mean difference was –5.3 units and the
standard deviation was 12.8 units. Differences
were computed by subtracting the exam 6 value
from the exam 7 value.
Example 7.10.
Hypothesis Testing for md (2 of 3)
1. H0: md = 0
H1: md ≠ 0
a = 0.05
2. Test statistic:
Xd – μd
t=
sd
n
3. Decision rule: df = n – 1 = 14
Reject H0 if t ≥ 2.145 or if z ≤ –2.145
Example 7.10.
Hypothesis Testing for md (3 of 3)
4. Compute test statistic:
Xd – μ d
− 5.3 − 0
t=
=
= −1.60
s d n 12.8 / 15
5. Conclusion. Do not reject H0 because –2.145 <
–1.60 p2, p1< p2, p1 ≠ p2
Test statistic:
min[n 1p̂1 , n1 (1 − p̂1 ), n 2 p̂2 , n 2 (1 − p̂2 )] 5
Z=
p̂1 – p̂ 2
1 1
p̂(1 – p̂) +
n1 n 2
(Find critical value
in Table 1C)
Example 7.12.
Hypothesis Testing for (p1 – p2) (1 of 4)
•
Is the prevalence of CVD different in smokers as
compared to nonsmokers in the Framingham Offspring
Study?
Free of
CVD
2757
History of
CVD
298
3055
Current smoker
663
81
744
Total
3420
379
3799
Nonsmoker
Total
Example 7.12.
Hypothesis Testing for (p1 – p2) (2 of 4)
1. H0: p1 = p2
H1: p1 ≠ p2
2. Test statistic: Z =
a = 0.05
p̂1 – p̂ 2
1
1
p̂(1 – p̂) +
n1 n 2
3. Decision rule:
Reject H0 if Z ≤ –1.96 or if Z ≥ 1.96
Example 7.12.
Hypothesis Testing for (p1 – p2) (3 of 4)
4. Compute test statistic:
Z=
Z=
p̂1 – p̂ 2
1
1
p̂(1 – p̂) +
n1 n 2
p̂1 =
81
298
= 0.1089, p̂ 2 =
= 0.0975
744
3055
0.1089 – 0.0975
1
1
0.0988(1 – 0.0988)
+
744 3055
p̂ =
81 + 298
= 0.0988
744 + 3055
= 0.927
Example 7.12.
Hypothesis Testing for (p1 – p2) (4 of 4)
5. Conclusion. Do not reject H0 because –1.96 < 0.927
2
H0: m1 = m2 = m3 … = mk
H1: Means are not all equal
Test statistic:
Σn j (X j − X) 2 /(k − 1)
F=
ΣΣ(X − X j ) 2 /(N − k)
(Find critical value in Table 4)
*Analysis of variance
Test Statistic: F Statistic
• Comparison of two estimates of variability
in data
– Between treatment variation, is based on the
assumption that H0 is true (i.e., population
means are equal).
– Within treatment, residual or error variation,
is independent of H0 (i.e., we do not assume
that the population means are equal and we
treat each sample separately).
F Statistic (1 of 2)
Difference between each
group mean and overall mean
Σn j (X j − X) /(k − 1)
2
F=
ΣΣ(X − X j ) /(N − k)
2
Difference between each
observation and its group
mean (within group variation—
error)
F Statistic (2 of 2)
F = MSB/MSE
MS = Mean Square
• What values of F indicate H0 is likely true?
Decision Rule
Reject H0 if F ≥ critical value of F with
df1 = k – 1 and df2 = N – k
from Table 4
k = Number of comparison groups
N = Total sample size
ANOVA Table
Source of
Variation
Sums of
Squares
df
Between
2
treatments SSB = Σ n j (X j – X )
MSB/MSE
Error
Total
SSE = Σ Σ (X – X j)
SST = Σ Σ (X – X )
Mean
Squares
k – 1 SSB/k – 1
2
N – k SSE/N – k
2
N–1
F
Example 7.14.
ANOVA (1 of 12)
•
Is there a significant difference in mean weight
loss among four different diet programs?
(Data are pounds lost over 8 weeks)
Low-Cal
8
9
6
7
3
Low-Fat
2
4
3
5
1
Low-Carb
3
5
4
2
3
Control
2
2
-1
0
3
Example 7.14.
ANOVA (2 of 12)
1. H0: m1 = m2 = m3 = m4
H1: Means are not all equal
2. Test statistic:
F=
Σn j (X j − X) 2 /(k − 1)
ΣΣ(X − X j ) 2 /(N − k)
a = 0.05
Example 7.14.
ANOVA (3 of 12)
3. Decision rule:
df1 = k – 1 = 4 – 1 = 3
df2 = N – k = 20 – 4 =16
Reject H0 if F ≥ 3.24
Example 7.14.
ANOVA (4 of 12)
Summary Statistics on Weight Loss by Treatment
Low-Cal
N
5
Mean
6.6
Low-Fat
5
3.0
Overall Mean = 3.6
Low-Carb Control
5
5
3.4
1.2
Example 7.14.
ANOVA (5 of 12)
SSB = Σ n j (X j – X )
2
= 5(6.6 – 3.6)2 + 5(3.0 – 3.6)2 + 5(3.4 – 3.6)2 + 5(1.2 – 3.6)2
= 75.8
Example 7.14.
ANOVA (6 of 12)
SSE = Σ Σ (X – X j)
2
Example 7.14.
ANOVA (7 of 12)
SSE = Σ Σ (X – X j)
2
Example 7.14.
ANOVA (8 of 12)
2
SSE = Σ Σ (X – X j)
Example 7.14.
ANOVA (9 of 12)
SSE = Σ Σ (X – X j)
2
Example 7.14.
ANOVA (10 of 12)
SSE = Σ Σ (X – X j)
2
= 21.4 + 10.0 + 5.4 + 10.6 = 47.4
Example 7.14.
ANOVA (11 of 12)
Source of
Variation
Sums of
Squares
df
Mean
Squares
F
Between
Treatments
Error
75.8
3
25.3
8.43
47.4
16
3.0
Total
123.2
19
Example 7.14.
ANOVA (12 of 12)
4. Compute test statistic:
F = 8.43
5. Conclusion. Reject H0 because 8.43 > 3.24. We
have statistically significant evidence at a =
0.05 to show that there is a difference in mean
weight loss among four different diet programs.
Two-Factor ANOVA
• Compare means of a continuous outcome
across two grouping variables or factors
– Overall test—is there a difference in cell
means?
– Factor A—marginal means
– Factor B—marginal means
– Interaction—difference in means across
levels of Factor B for each level of Factor A?
Interaction
Cell Means
Factor A
Factor B
1
2
1
45
65
2
58
55
3
70
38
75
70
65
60
A1
A2
55
50
45
40
35
1
2
3
No Interaction
Cell Means
Factor A
Factor B
1
2
1
45
38
2
58
55
3
70
65
75
70
65
60
A1
A2
55
50
45
40
35
1
2
3
Example 7.16.
Two-Factor ANOVA (1 of 3)
• Clinical trial to compare time to pain relief of
three competing drugs for joint pain.
Investigators hypothesize that there may be a
differential effect in men versus women.
• Design: N = 30 participants (15 men and 15
women) are assigned to three treatments (A,
B, C)
Example 7.16.
Two-Factor ANOVA (2 of 3)
• Mean times to pain relief by treatment and sex
• Is there a difference in mean times to pain
relief? Are differences due to treatment? Sex?
Or both?
Example 7.16.
Two-Factor ANOVA (3 of 3)
Source
of Variation
Sums of
Squares
df
Mean
Square
F
20.7
34.8
33.5
0.1
Model
Treatment
Sex
Treatment*Sex
967.0
651.5
313.6
1.9
5
2
1
2
193.4
325.7
313.6
0.9
Error
224.4
24
9.4
Total
1191.4
29
p-value
0.0001
0.0001
0.0001
0.9054
Hypothesis Testing for Categorical
or Ordinal Outcomes*
• Categorical or ordinal outcome
• Two or more samples
H0: The distribution of the outcome is
independent of the groups
H1: H0 is false
2
(O
E)
2
χ
=
Test statistic:
E
(Find critical value in Table 3: df = (r – 1)(c – 1))
* c2 test of independence
Chi-Square Test of Independence
• Outcome is categorical or ordinal (2+ levels)
and there are two or more independent
comparison groups (e.g., treatments).
H0: Treatment and outcome are independent
distributions of outcome are the same across
treatments)
Example 7.17.
c2 Test of Independence (1 of 6)
• Is there a relationship between students’ living
arrangement and exercise status?
Dormitory
On-campus apt.
Off-campus apt.
At home
Total
Exercise Status
None
Sporadic Regular
32
30
28
74
64
42
110
25
15
39
6
5
255
125
90
Total
90
180
150
50
470
Example 7.17.
c2 Test of Independence (2 of 6)
1. H0: Living arrangement and exercise status are
independent
H1: H0 is false
a = 0.05
2
(O
E)
2. Test statistic: χ 2 =
E
3. Decision rule: df = (r – 1)(c – 1) = 3(2) = 6
Reject H0 if c2 ≥ 12.59
Example 7.17.
c2 Test of Independence (3 of 6)
4. Compute test statistic:
2
(O
E)
χ2 =
E
O = Observed frequency
E = Expected frequency
E = (row total)*(column total)/N
Example 7.17.
c2 Test of Independence (4 of 6)
4. Compute test statistic:
Table entries are Observed (Expected) frequencies
None
Total
Dormitory
32
(90*255/470 = 48.8)
On-campus apt.
74
(97.7)
Off-campus apt.
110
(81.4)
At home
39
(27.1)
Total
255
Exercise Status
Sporadic
Regular
30
(23.9)
64
(47.9)
25
(39.9)
6
(13.3)
125
28
(17.2)
42
(34.5)
15
(28.7)
5
(9.6)
90
90
180
150
50
470
Example 7.17.
c2 Test of Independence (5 of 6)
4. Compute test statistic:
2
2
2
2
(32
−
48.8)
(30
−
23.9)
(28
−
17.2)
(5
−
9.6)
χ2 =
+
+
+ … +
48.8
23.9
17.2
9.6
χ 2 = 60.5
Example 7.17.
c2 Test of Independence (6 of 6)
5. Conclusion. Reject H0 because 60.5 > 12.59.
We have statistically significant evidence at a =
0.05 to show that living arrangement and
exercise status are not independent. (P <
0.005)