0% found this document useful (0 votes)
27 views39 pages

Factorial ANOVA

Uploaded by

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

Factorial ANOVA

Uploaded by

aarya.raghav9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 39

Factorial Analysis of Variance

Instructor: Weikang Kao, Ph.D.


Names for different ANOVA designs

 ANOVAs are named by how many factors in the design


 One-way ANOVA: we have one factor (or IV)
 Two-way ANOVA: there are two factors (or IVs) in the design
 ANOVAs are also named in terms of how subjects receive factors, treatments,
and blocks: between/ within design.
 Between-group effects are the effects between treatment groups, which has no
commonality.
 Within-group effects are the effects that within subjects/groups/blocks, which have a
commonality across treatments.
 When to use a blocked ANOVA design?
Blocked Design  We have treatment (one predictor here) and participants. We recognize
the participants and then put them into subgroups (block).
Factorial ANOVA

 We talked about one-way ANOVA, meaning we have one predictor to be tested.


 What if we have more than one, which is very possible in practice?
 A factorial ANOVA is an Analysis of Variance test with more than one independent
variable. It can also refer to more than one Level of Independent Variable.
Factorial ANOVA

 One-Way ANOVA:
 Total = Treatment A + Error
 Factorial ANOVA:
 Total = Treatment A + Treatment B + Treatment C ….. + Error
 Total = Treatment A + Treatment B + Treatment A*B ….. + Error
 When to use it?
Factorial ANOVA  When we have TWO treatments/factors (we will use A and B to
represent them in the class). The treatments/ factors (A and B) with
2 or more levels for each treatment.
One-Way ANOVA

 When performing a one-


way ANOVA, we focus on
the main effect. That is, for
example, how the value
changes from different
points/groups.
A Factorial Design

 When we perform a
factorial design,
remember that we have
multiple effects now.
 For example, we will
have IV A and IV B,
which represented
different treatments.
 Effect A
A Factorial Design

 If we look at them
separately, we can
examine the main effects.
 Effect B
A Factorial Design
 When we perform a
factorial design,
remember that we have
multiple effects now.
 If the design is a two-
way ANOVA design, that
means we have two
predictors, and we will
have two main effects
and an interaction effects
(potentially).
Interaction Effect

 Interaction effects represent the combined effects of factors on the dependent


measure.
 Sometimes if we only look at main effects, we are not able to find out what
happened.
 One of the reasons we want to include interactions is that they can hide effects
that exist or make us believe in effects that don’t exist.
 For example, if we ran a study looking at the effects of two
drugs (both taken at a high or low level) and got the
following result. What do you think we would find if we
ignored the interaction?
 Drug 1s’ effect would be: (𝟑𝟎+𝟏𝟎)/𝟐−(𝟏𝟎+𝟑𝟎)/𝟐=𝟎
 Drug 2s’ effect would be: (𝟑𝟎+𝟏𝟎)/𝟐−(𝟏𝟎+𝟑𝟎)/𝟐=𝟎
Interaction Effect  Thus we would conclude neither drug has any effect at all.
But is that the real story here?
Interaction Effect

 For example, now we are running a test to see if soda and candy would have
impacts to individuals’ weights.
 IV A: Soda
 IV B: Candy
 DV: Weight
Interaction Effect

 First scenario, both soda


and candy work, but
there is no interaction
effect.
 What do we find here?
 “no interaction”
Interaction Effect

 Second scenario, both


soda and candy work,
and there is an
interaction effect.
 What do we find here?
 “Ordinal Interaction ”
Interaction Effect

 Third scenario, both soda


and candy work, and
there is an interaction
effect.
 What do we find here?
 “Disordinal Interaction”
Main Effect

 Main effect: the means across levels of treatment A are different, and to the same
degree for all levels of treatment B.
 Example: Eating candy (IVA) will increase individuals’ risk of death, with the
same degree for all individuals who are also drinking soda (IVB).
Interaction Effect

 An interaction effect implies that: the effects at a specific level of treatment A


across levels of treatment B is different than the effects (same) at another level of
treatment A across levels of treatment B.
 If there is an interaction effect, then we must look at the simple main effect rather
than the original main effect.
Simple Main Effect

 A simple main effect is a main effect of one factor at a given level of a second
factor, in other words, how the DV varies across levels of treatment A with a
specific level of treatment B.
 Example:
1. Eating candy (IVA) will increase individuals’ risk of death more, for those
individuals who drink soda (IVB1) than those individuals who don’t drink soda
(IVB2).
2. Drinking soda (IVB) will increase individuals’ risk of death more, for those
individuals who eat candy (IVA1) than those individuals who don’t eat candy
(IVA2).
SS in factorial design

Recall: when we do one-way ANOVA, what is the total SS?


Total SS = SSB + SSW = SStreatment effect + SSerror

Blocking:
Total SS = SSB + SSW = SStreatment effect + SSblock + SSerror

Factorial:
Total SS = SSB + SSW

= SSA + SSB + SSintercation+ SSerror


Assumptions

 Normality
 Observations are drawn from a normally distributed population.
 Independence of observations
 Observations are randomly sampled from the population , or subjects are randomly
assigned to treatment groups, so that all the observations in the within groups and the
between groups are independent.
 Equal variance
 The observations have equal variances across groups.
Application
Factorial Design: Procedure

1. Propose a research question(s) based on your questions.


2. Perform a (or more) hypotheses
3. Check the assumptions
4. Perform tests
5. Make conclusions based on the finding.
Application

 The data set from the first class contains another column that includes whether
the valuation was made for a product or gamble so we have data that we can
analyze using a factorial ANOVA.
 In our example we have a 3 X 2 design, so we need at least six observations
where each observation was randomly and independently generated under the
same circumstances.
 Use the ANOVAexample.
 Most of the time we are going to want to employ a factorial
design when we have more than one factor of interest.
 For example, if we are interested in the effects of Perspective
and Item Type and their potential interaction effects, we would
set up our experiment so that each factor is present at each
other factors levels

Application
Application

 In this case, we have two IVs:


model <- aov(V2 ~ Condition*ProductorGamble, data = ANOVAExample)
 Perspective and item type are significant, their interaction is not. Let’s plot the interaction
anyways.
interaction.plot(ANOVAExample$Condition, ANOVAExample$ProductorGamble,
ANOVAExample$V2)
 Note we can also make inferences about our main effects
 from this as well: Products > Gambles, Sellers > Buyers
Summary write up

A study was conducted to investigate whether, taken together, a person’s status and
product gamble form affected individuals’ valuation of the product. Observations from the study
were analyzed by conducting a two-way analysis of variance with the two independent variables
(condition and product or gamble) and the dependent variable (valuation) using R version 3.61.
First, all assumptions are met and there is no adjustment made. ANOVA analysis revealed
there is no statistically significant interaction effect (F(2, 234) = 2.698, p = .070). Results also
suggest that the valuations of an item’s worth was affected by the status of (as buyers, sellers, or
choosers) the participants (F(2, 234) = 23.45, p < .001) and product or gamble (F(1, 234) = 43.98,
p < .001).

Post hoc tests…….


Effect size ……
In Class Practice

 In a current study, we want to test if the two types of drugs with different levels,
will have impacts on individuals' stamina.
 Use the data “Week 4 Practice”.
 IVs?
 DV?
Three-Way Interaction
Understanding a 3 Way Interaction

 What if we get a significant 3-way interaction? How do we interpret it?


 More than two-way interactions can get confusing.
 The best way to understand them is to make plots as we did before, but to do so for each
level of our third factor (here I present data from a study looking at the effects of two
different drugs taken on full or empty stomachs).
Three-Way
Interaction

 Use two plots to


interpret your findings
To Interact or Not?

 Generally if you have a two-way (or greater) ANOVA you will want to see if your factors
interact.
 What if you fit the model with the interaction and it is not significant. Can you remove
it?
 Some say yes, if it is not significant you can safely ignore it and therefore should not
include it in your model (the same could be said for any non-significant predictor).
 Others would argue that even if not significant you should include it to control for any
effect that is present in the interaction (you'll likely have to report it in academics
anyways).
 I would base such decisions on the goals of your analysis (build a model vs. test a
hypothesis).
Blocking in Factorial Designs
Blocking in Factorial Designs

 Just like with one-way (one-factor) experiments with lots of levels running a factorial study can
also make it difficult to ensure all factorial combinations are sampled under the same conditions.
 To remedy this we can control for those potential confounds up front by blocking.
 Ideally will use a randomized complete block design – each factorial combination is present in
each block (equally often) and the assignment of those factorial combinations is random within
the block.
 We would also need to make sure we don’t have any interaction with that blocking factor.
Blocking in Factorial Designs: Application

 Check the basic assumptions.


 Check the additivity of interaction:
model <- aov(V2 ~ Condition*ProductorGamble*Session, data = ANOVAExample)
 We find no interactions with our blocking factor so we are good to go ahead and run the analysis
as such:
model <- aov(V2 ~ Condition*ProductorGamble + Session, data = ANOVAExample)
 In this case the effect of our blocking variable was very small so there is no notable difference
between the analysis including it and the one we preformed previously excluding it.
 Nevertheless, its always best to include these confounding factors as they can in some instances
mask effects or cause effects to be mis-interpreted.
Some Non-Parametric Tests
Non-Parametric

 As we discussed when we violate the assumptions of ANOVA one option is to


turn to non-parametric tests.
If we have a one-way ANOVA we can use the Kruskal Wallis test:
kruskal.test(y ~ X1, data = XXX)
If we have a one-way ANOVA with blocking we can use the Friedman test:
friedman.test(y, X1, Blocking Factor, data = XXX)
Non-Parametric

 When we are dealing with some variations of factorial ANOVA we can use the
Scheirer-Ray-Hare test:
scheirerRayHare(y ~ X1 x X2, data = XXX)
 Generally speaking, ANOVA will be robust to small violations of our standard
assumptions (non-normal data, unequal variances, etc.).
 Nevertheless, its always a good idea to double check your analyses to be sure.
1. Why must we include interactions in factorial
experiments?
Weekly Lab 2. If we find a higher order interaction is
significant but its lower order components are
not should we include the lower order
components?

You might also like