Title: P1251328620DFQUL
1CEP 933 Two-way ANOVA
We have spent considerable time discussing
one-way or one-factor ANOVA -- a technique
designed to analyze data where the primary
interest of the researcher is to look for and
test for differences among the means of groups of
subjects. In such cases our subjects were
classified into groups based on one factor such
as a personal characteristic (e.g., their age or
the school grade they are in) or based on
exposure to a single set of experiences (such as
treatments and a control condition). Next we
will consider analyses designed for situations
where our cases have been categorized according
to two or more factors or characteristics. The
general set of analyses is called factorial
ANOVAs. We'll begin with two-way ANOVA.
2CEP 933 Two-way ANOVA (Main effects)
In two-way ANOVA we have two factors, which we
will call "main effects". Each main effect
represents a factor that could be examined in a
one-way ANOVA. Essentially we ignore the second
factor in examining a main effect. Let's
consider an example that we'll use later in a
demonstration. One factor might be a treatment
factor (in our earlier example we had three kinds
of practice of a motor skill Physical practice,
mental practice and a control condition). Then
we add a second factor. This could be another
treatment regimen, or any other classification of
the subjects we want to study. Lets say our
second factor is gender.
3CEP 933 Two-way ANOVA (Interactions)
In two-way ANOVA we also will have a combination
of the two factors, which we will call the
"interaction effect". Interactions cannot be
examined in a one-way ANOVA. The interaction is
important because it tells us how the two factors
work together to impact the outcome. In our
example we'd have an interaction of "type of
exercise" with gender on the outcome motor
skills. Another way to think of the interaction
is that it represents whether the effect of one
factor depends on the second factor. In our case
we'd ask whether the effect of practice type
depends on gender. Another way to say the same
thing is to ask whether the size of the gender
difference in motor skills depends on the type of
exercise.
4CEP 933 Two-way ANOVA (Overview)
Our goal in the two-way ANOVA is to explain more
of the variation in outcome scores than we would
with a single factor. Also we may be able to
explain more than we could by examining each of
the two factors separately. We will obtain F
tests of each main effect and an F test of the
interaction effect. Also we will learn to use
graphs to help determine what kind of interaction
we have and to interpret the interaction if it is
significant. Finally we will also see that we
can do planned and post-hoc comparisons with
factorial ANOVAs just as we did in the one-way
case.
5CEP 933 Two-way ANOVA Notation
Yijk The score of the kth subject in group i of
factor A and group j of factor B. The mean for
subjects in group i of factor A and group j of
factor B. The mean score for group i of
factor A, i1, ..., a. The mean score for group
j of factor B, j1, ..., b. The grand mean, the
mean of all scores.
6CEP 933 Two-way ANOVA Notation
Also we need to refer to the sample
sizes nij The number of subjects in group i of
factor A and group j of factor B. ni. The
sample size for group i of factor A. n.j The
sample size for group j of factor B. n The total
sample size (some books call this n..).
7CEP 933 Two-way ANOVA Notation
We have formulas for means similar to the one-way
case. Sk Yijk / nij Cell mean for cell i j
Sj Sk Yijk / ni. Marginal means for levels
of factor A Si Sk Yijk /
n.j Marginal means for levels of factor B
Si Sj Sk Yijk / n.. The grand mean We will
use these to estimate components of the model.
8CEP 933 Two-way ANOVA Model
The model is Yijk m ai bj abij eijk
where m is the grand mean in the
population ai is the population factor A
treatment effect for group i bj is the
population factor B treatment effect for group
j abij is the interaction of factor A and B in
population cell i j and eijk is the residual (or
error) for person k in group ij As before we
assume the eijk are independent and normal with
common variance s2e
9CEP 933 Two-way ANOVA Model
Recall for a moment the one-way model. It
is Yijk m ai e'ijk But now Yijk
m ai bj abij eijk What was "error"
in the one-way model is now being explained by
the second factor (B) and the interaction. We
hope the addition of the second factor will allow
us to explain more (and get a larger Eta2). We
may still have some error but eijk is not the
same residual as for the one-way model (that's
why I renamed the one-way error term as e').
10CEP 933 Two-way ANOVA (Hypotheses)
We can test three null hypotheses in the two-way
ANOVA H0 for "A effect" H0 a1 a2 ...
aa 0 or H0 m1. m2. ... ma. H0 for
"B effect" H0 b1 b2 ... bb 0 or H0
m.1 m.2 ... m.b H0 for "interaction" H0
ab11 ab12 ... abab 0 (In words "there is
no interaction between A and B") Note that in
the two-way case having the dots after m (e.g.,
m1. or m.1) allows us to figure out what effect
each mean represents.
11CEP 933 Two-way ANOVA Model
The estimates of model components should be
familiar m is estimated by the sample grand
mean ai is estimated by ( - )
ai bj is estimated by ( - )
bj abij is estimated by
which equals - ai - bj
- Some interpret the interaction as what is left
after we "remove" the effects of the score scale
(i.e., the grand mean) and the main effects ai
and bj from the cell means. As before the
common variance s2e is estimated by MSW.
12CEP 933 Two-way ANOVA Sums of Squares
The estimates are used in getting the Sums of
Squares. The SST, SSA and SSB are the same as we
would compute in the one-way SSA Si ni. (
- )2 Si ni. ai2 SSB Sj n.j ( -
)2 Sj n.j bj2 SST (n..-1)SY2 Si Sj Sk
(Yijk - )2 SSW is similar to the one-way
SSW but the mean subtracted from each score is
the cell mean SSW Si Sj Sk (Yijk -
)2 The new one for us is the interaction
SS SSAB Si S j nij
2
13CEP 933 Two-way ANOVA Source Table
Here is the ANOVA table. Full formulas for the
SS are on the previous slide. Source
df SS MS F ------------------------------------
--------------------------------------------------
---------- A a-1 S ni. ai2 SSA/(a-1) MSA/MSW B
b-1 S n.j b.j 2 SSB/(b-1) MSB/MSW AB (a-1)(b-1)
SS njk abij2 SSAB/(a-1)(b-1)
MSAB/MSW Error n.. - ab SSS (Yijk-
)2 SSW/(n..-ab) --------------------------------
--------------------------------------------------
-------------- Total n..-1 SSS (Yijk - )2
14CEP 933 Two-way ANOVA Expected Mean Squares
Again as for the one-way the F tests get big when
the population treatment effects are nonzero and
the MSA, MSB and MSAB are larger than
MSW. For two-way ANOVA we will do three
tests, and it often makes sense to begin with the
interaction test. If the interaction is
significant, we may need to be especially
cautious in interpreting the main effects, as we
will learn below. In general we can examine the
interaction test then examine the cell means,
then go back to the other F tests. Tables of
means are acceptable but often plots of the means
show patterns very quickly patterns that may
not be apparent from simple tables of means. So
next we will look at some plots. These plots are
lacking one thing -- information about standard
errors. But they are cleaner than error bar
plots so we will start with these.
15CEP 933 Two-way ANOVA Plots of Means
By plotting the cell means we examine the data
for the presence of interactions. Here are plots
that show two situations (1) A and B
main effects (2) B main effect only no
interactions no A effect or
interaction Main effects are shown by lines at
different heights (for factor B shown as lines)
or lines that slant (for horizontal axis factor
A). When lines are parallel, there is no
interaction.
16CEP 933 Two-way ANOVA Plots of Means
Here are three more plots (3) Main
effect of A only (4) B main effect plus a
no B or interaction
disordinal AB interaction (5) Main
effect of A plus an ordinal AB interaction
17CEP 933 Two-way ANOVA Interactions
Plots only suggest the presence of interactions
the ANOVA F test tells us whether the suggested
interaction is significant or not. Ordinal
interactions happen when the size of the effect
(or mean difference) for one factor is not the
same at all levels of the second factor. So for
instance in the last plot, the means for the pink
line (B2) are always higher than the means for
B1, but at level A3 the B2 group has a much
higher mean. Disordinal interactions show means
that are dis-ordered. That is, the means for
levels of one factor (say B) are not in the same
order within each of the levels of A. This means
the lines will cross as they do in the 4th plot
where at level A3 the B1 mean is higher than the
B2 mean.
18CEP 933 Two-way ANOVA Interactions
If an interaction is significant, it can affect
what we can say about the main effects of the
factors that are interacting. The limits on what
we can say are determined by the nature of the
interaction. With ordinal interactions we can
sometimes interpret the nature of the two main
effects clearly. Considering plot 5, the means
for group B2 are always superior to B1, so we can
safely interpret the B effect. Also the mean for
level A1 is lower than the mean for A2, and those
are lower than the A3 mean. However, the mean
for group B2 in level A3 is very close to the A2
means. We can imagine a case with an ordinal
interaction but where the A factor does not show
a clear pattern of differences. So we need to be
cautious in interpreting significant main
effects, even for ordinal interactions.
19CEP 933 Two-way ANOVA Interactions
If a disordinal interaction is significant, we
typically cannot interpret both main effects
(even if they are both significant). In
disordinal interactions the direction of the mean
differences is reversed in some levels of the
other factor, so we would not want to say that
(for example) group B2 performs better than B1,
even though the overall B2 mean (averaged across
all levels of A) may be higher than the mean for
B1. Consider again the 4th plot where, at level
A3, the B1 mean is higher than the B2 mean. The
overall mean of the B1 group (across the 3 levels
of A) is 15 and the overall mean for B2 is 25.
This makes it seem that B2 is better than B1,
but we know that in level A3 the reverse is true.
So we cannot clearly interpret the significant B
effect.
20CEP 933 Fixed versus random effects
So far we have acted as though our study includes
every level of the factor that we might want to
generalize to. For factors with just a few levels
such as gender (where we only have male and
female), or school type (e.g., public, private
and religious) this is reasonable. We call these
fixed-effect factors and we implicitly assume
that we are studying all the levels we want to
make inferences about. If there are many levels
of a factor, but we can only study a few of them,
we may still really want to infer to ALL possible
levels. In such cases we ought to take a random
sample of the levels rather than just picking a
few. This would allow us to make inferences to
the full population of levels, not just the ones
we study. We call these random-effects factors.
21CEP 933 Fixed versus random effects
So we could sample differing amounts of practice
from a population of levels (i.e., amounts). Say
that we randomly sample 20 time intervals from
all possible times from 1 minute to 60 minutes.
The population of levels includes 60
possibilities 1min, 2m, 3m, 4m, , 59m, and 60
min intervals. Some other common factors that
may appear as random effects are teachers, class
rooms, schools, and districts. Random factors
are most appropriate in cases where we want to
generalize to a broader set of cases than the
ones we will study.
22CEP 933 Fixed versus random effects
The key to random effects is the
conceptualization of a population of levels, and
the practice of sampling from those levels. We
dont really have a true random-effects factor if
we dont sample randomly from the population we
want to infer to (convenience samples dont cut
it!). If we do have a true random factor, we
want to estimate variation among the means for
the population of levels, and our sample of
levels allows us to do that. The F tests and
the expected mean squares are slightly different
in fixed versus random cases, as we will see in
the next slide set.