Transcript chapter15
Chapter 15
Analysis of Variance
The
articleto“Could
Mean
be a
In order
compare
thePlatelet
means, Volume
the
Predictive
Marker
foruse
Acute
Myocardial
researchers
must
a procedure
called a
Infarction?”
(Medical
Science
Monitor,
single factor
analysis
of variance
or 2005)
described
ANOVA.an experiment in which four groups of
patients seeking treatment for chest pain were
compared with respect of mean platelet volume
experiment,
the factor
is the
(MPV). In
Thethis
purpose
of the study
was to
diagnosis.
four groups
determineclinical
is mean
MPV was The
different
for the
were
noncardiac
pain,attack
(2)
four groups,
in (1)
particular
for chest
the heart
angina
unstable
group. Ifstable
so, then
MPVpectoris,
could be (3)
used
as an
(4) myocardial
indicator ofangina
heart pectoris,
attack risk.
infarction
(heartor
attack).
Researchers
need
to compare
the
means from
When
two or more
populations
treatments
fourcompared,
treatmentthe
groups
to determine
arethe
being
characteristic
thatif m1
= m2 = m3 = m
if at least or
onetreatments
of the means
distinguishes
the
populations
4 or
differ
from the rest.
from one another
is called
factor.
Whether the null
(ofthat
equal
In hypothesis
Group A, notice
themeans)
three
In Group
B, notice
that the comes
three samples
The phrase
“analysis
of
variance”
from
thehave
should
be
rejected
depends
how
substantially
samples
seem toon
have
very
different
the
same means
as Group
A.
However,
due to
idea
of
analyzing
variability
in
the
data
to
see
means
and
very
little
variability
in each
the samples
from
the
different
populations
or
the
large
amount
of
variability
in
each
sample
how much differ
can
be attributed
to
differences
in the
sample.
This one
would
lead
us toConsider
doubt
treatments
from
another.
andhow
the much
fact that
the
samples
overlap,
it is
m’s and
isclaim
due
to
variability
in
the
that
m
=
m
=
m
.
1
2 come
3 from
the following
example.
plausible
that
the
samples
could
individual populations.
populations with equal means.
Mean of
Sample 1
Mean of
Sample 2
Mean of
Sample 3
Mean of
Sample 1
Mean of
Sample 2
Mean of
Sample 3
Graph A
Graph B
ANOVA Notation
k = the number of populations or treatments being
compared
N n1 n2 ... nk
The total number of observations
T n1x1 n2x2 ... nk xk
T
x
N
Grand Mean
Grand Total
ANOVA Notation Continued . . .
A measure of differences among the sample means is the
treatment sum of squares, denoted by SSTr and given by
SSTr n1 x1 x
2 n2 x2 x 2 ... nk xk x 2
The number of error degrees of freedom comes from
A measure
variation
the k samples,
calledassociated
error sum
adding of
the
numberwithin
of degrees
of freedom
of squares andwith
denoted
is sample variances:
eachSSE,
of the
(n1 – 1)2+ (n2 – 1) + …2(nk – 1) = N - k 2
SSE n1 1s1 n2 1s2 ... n k 1sk
Each sum of squares has an associated df:
treatment df = k – 1 error df = N – k
A mean square is a sum of squares divided by its df.
SSTr
MSTr
k 1
SSE
MSE
N k
The Single Factor ANOVA F test
Null hypothesis: H0: m1 = m2 = … = mk
Alternative hypothesis: Ha: at least two m’s are
different
MSTr
Test Statistic: F
MSE
When H0 is true,
with df1 = k – 1 and df2 = N – k mMSTr = mMSE
P-value: the area under the appropriate
F curve
When H0 is
false,
to the right of the calculated F value
mMSTr > mMSE
The Single Factor ANOVA F Test
Continued . . .
Assumptions:
1. Each of the k population or treatment response
distributions is normal.
2. The k normal distributions have identical standard
deviations.
(ssizes
= … large,
= sk) individual boxplots or
If sample
1 = s2 are
probability
plots
for each
can be one
3. Thenormal
observations
in the
sample
fromsample
any particular
used to or
check
for normality.
of the k populations
treatments
are independent of
the sample
are small,
then a combined
While
theresizes
is a formal
procedure
to check for
one If
another.
normal equal
probability
plotdeviations,
should be used
to is
check
standard
itskuse
not
4. When comparing
population
means, the
random
for normality.
Firstdue
findtothe
recommended
its deviations
sensitivityfrom
to any
samples
are
selected mean
independently
of each
other.
the
respective
in each The
sample,
Then
departure
from normality.
ANOVA
F test
When
comparing
treatment
are
combine
deviations
to
the normal
canthe
safely
be usedmeans,
if create
the treatments
largest
sample
assigned
at random
to subjects
or
objects.
probability
plot
standard
deviation
is not
more
than twice the
smallest sample standard deviation.
Heart Attack Risk Continued . . .
Here are the summary statistics for the four groups:
Group Description
1
Noncardiac chest pain
2
Stable angina pectoris
3
Unstable angina pectoris
4
Myocardial Infarction
Sample Sample Sample standard
sizesubjects
mean were
deviation
The
randomly
selected
from groups0.69
of
35
10.89
individuals
who had been
35
11.25
0.74
diagnosed with the four
35
11.37
0.91
conditions.
35
11.75
H0: m1 = m2 = m3 = m4
1.07
State
theassumptions.
hypotheses.
Verify
H : at least two m’s are different
a
To verify the equality of the standard
deviations, notice that
the
largest
sample
The
four
boxplots
are
deviation (group 4) isapproximately
less than twice that
symmetrical
with
no
of the smallest standard
deviation
(group
1).outliers, so the
assumption of normality
is plausible.
Heart Attack Risk Continued . . .
Here is the summary statistics for the four groups:
Sample
size
Group Description
Sample Sample standard
mean
deviation
1
Noncardiac chest pain
35
10.89
0.69
2
Stable angina pectoris
35
11.25
0.74
3
Unstable angina pectoris
35
11.37
0.91
4
Myocardial Infarction
35
11.75
1.07
x 11.315
Calculate
the the
sum Foftest
squares
terms.
Calculate
statistic.
SSTr 35(10.89 11.315)2 35(11.25 11.315)2 35(11.37 11.315)2 35(11.75 11.315)2 13.199
SSE 34(.069)2 34(0.74)2 34(0.91)2 34(1.07)2 101.888
13.199
4.400
3
101.88
MSE
0.749
136
MSTr
4.400
F
5.87
0.749
Heart Attack Risk Continued . . .
H0: m1 = m2 = m3 = m4
Ha: at least two m’s are different
Test Statistic:
4.400
F
5.87
0.749
with df1 = 3 and df2 = 136
P-value < .001
a = .05
Since the P-value < a, we reject H0. There is
convincing evidence to conclude that mean MPV is
not the same for all four patient populations.
Summarizing an ANOVA
ANOVA calculations are often summarized in a tabular
format called an ANOVA table. To understand such a
table, we need one more sum of squares term.
Total sum of squares, denoted by SSTo, is given by
x x
This is the fundamental identity for
SSTo
with df = N – 1.
2
all N obs.
single-factor ANOVA.
The relationship between the three sum of squares is:
SSTo = SSTr + SSE
The General Format for a SingleFactor ANOVA Table
Source of
Variation
Sum of
Mean
df Squares Square
F
P-value
SSTr
MSTr
Treatment k – 1
SSTr
k-1
MSE
SSE
When
the
analysis is done by
Error
N–k
SSE
N -software,
k
statistical
then the
Total
N-1
SSToP-value appears here.
Heart Attack Risk Continued . . .
This is the ANOVA table for this data set.
Source
Treatment
Error
df
3
136
SS
13.199
101.888
Total
139
115.087
MS
4.400
0.749
F
5.87
P-value
0.000
Now we know that at least two of the means are
different – but which two? To answer the
question in this study we need to know if the
mean MPV for the heart attack group is the
mean that is different.
Tukey-Kramer
(T-K)
Multiple
What do we do now that we
Comparison Procedure
know that at least two of the
population or treatment
means
are
different?
• This procedure is based on calculating
confidence intervals for the difference
between each possible pair of m’s.
• If the interval contains the value zero, then
there is no significant difference between
We need to use a multiple
theHow
means
can involved.
we tell which of the
comparison
procedure,
which
• If, however,
the
interval
does
NOT
contain
mean(s) is/are different?
is a method of identifying
the value zero, then the two means are
differences between m’s.
significantly different.
Tukey-Kramer (T-K) Multiple
Comparison Procedure
When there
are sample
k populations
or are
treatments
If the
sizes are
thebased
same, on
webeing
can use
T-K intervals
probability
compare, the number
of confidence
intervals
necessary
is
distributions
called
studentized
range
MSE
given by
q
k (k 1)
distributions.
n
2
For mi – mj:
x
i
xj
MSE 1
1
q
2 ni n j
where q is the relevant Studentized range critical value
The two means are judged to differ significantly if the
interval does not contain 0.
Heart Attack Risk Revisited . . .
Sample
size
Group Description
Sample Sample standard
mean
deviation
1
Noncardiac chest pain
35
10.89
0.69
2
Stable angina pectoris
35
11.25
0.74
so 11.37
there is not0.91
a
Sample
sizes
are
the
same
in
is the Infarction
critical
value 35
for
95%
confidence
4 This
Myocardial
11.75
1.07
significant
difference
in the
mean
MVP
each
treatment.
when
k
=
4
and
df
=
120
(closest df
in the
between patients with noncardiac
chest
pain
tablewith
to 136).
4(4 1)
and patients
stable angina.
6
3
Unstable
angina pectoris
This interval
contains 35
0,
Number of confidence intervals to compute:
For m1 – m2:
2
How many confidence intervals
will we need to compute?
0.749
(10.89 11.25) 3.68
(.898, .178)
35
Heart Attack Risk Revisited . . .
For
m1 – m2
m1 – m3
m1 – m4
m2 – m3
m2 – m4
m3 – m4
95% Confidence Interval
(-0.898, 0.178)
(-1.018, 0.058)
(-1.398, -0.322)
(-0.658, .0418)
(-1.038, 0.038)
(-0.918, 0.158)
The only interval that does not contain 0 is
for the difference
in mean
MPV between
The remaining
confidence
patients
with noncardiac
chestin
pain
intervals
are calculated
theand
patients
with heart
attacks.
same manner.
They
are . . .
Summarizing the Results of the
Tukey-Kramer Procedure
1. List the sample means in increasing order, identifying
population just above each x
Population If the3 sample
2 means
1 for 4
5
populations
3, 2,
and 1 are
then
Sample Mean
x3 notx2significantly
x1
x4different,
x5
draw a line under them.
2. Use the T-K intervals to determine the group of means
that do not differ significantly from the first in the list.
Draw a horizontal line extending from the smallest mean
to the last mean in the group identified,
Population
Sample Mean
3
x3
2
x2
1
x1
4
x4
5
x5
Summarizing the Results of the
Tukey-Kramer Procedure
If the sample means for population 2 is not
3. Use the T-K
intervals different
to determine
the
group
significantly
from
1 and
4, of
butmeans
is
that are not
significantly
from
the
second
different
from 5,different
then draw
a line
under
2,
smallest in the list. If this
1, entire
and 4. group of means is not
underscored, draw a horizontal line extending from the
smallest mean to the last mean in the new group,
Population
Sample Mean
3
x3
2
x2
1
x1
4
x4
4. Continue considering the means in the order
listed, adding new lines as needed.
5
x5
Heart
...
BasedAttack
on theseRisk
data,Revisited
we have evidence
that the mean
MPV is not the same for the noncardiac chest pain
For group and
95%
Confidence
Interval
the
heart attack
group. But since
the mean
Should
in (-0.898,
means is 0.178)
small compared toMPV
the be
m1 – mdifference
2
variability among the individuals in each group,
it would
used
as a
0.058)
mstill
1 – mbe
3 difficult to (-1.018,
distinguish the two groups based on
predictor
of
an
individual
MPV
value.
And
we
don’t
have
evidence
(-1.398, -0.322)
m1 – m4
heart
that
the
mean
is
different
for
the
heart
attack
group
(-0.658, 0.418)
m2 – m3
attacks?
and the two angina groups. So, MPV is probably
not
0.038)
m2 – m4 useful as a(-1.038,
predictor
of heart attack.
(-0.918, 0.158)
m3 – m4
Population:
1
2
3
4
SampleLet’s summarize these T-K intervals.
10.89 11.25 11.37 11.75
Mean: