18
$\begingroup$

Can I get help completing this tentative (in progress) attempt at getting my bearings on ANOVA's and REGRESSION equivalents? I have been trying to reconcile the concepts, nomenclature and syntax of these two methodologies. There are many posts on this site about their commonality, for instance this or this, but it's still good to have a quick "you are here" map when getting started.

I plan on updating this post, and hope to get help correcting mistakes.

One-way ANOVA:

Structure:   DV is continuous; IV is ONE FACTOR with different LEVELS.
Scenario:    miles-per-gal. vs cylinders
             Note that Income vs Gender (M, F) is a t-test.
Syntax:      fit <- aov(mpg ~ as.factor(cyl), data = mtcars); summary(fit); TukeyHSD(fit)
Regression:  fit <- lm(mpg ~ as.factor(cyl), mtcars) 
             # with F dummy coded;
             summary(fit); anova(fit)

Two-way ANOVA:

Structure:   DV is continuous; IV is > 1 FACTORS with different LEVELS.
Scenario:    mpg ~ cylinders & carburators
Syntax:      fit <- aov(mpg ~ as.factor(cyl) + as.factor(carb), mtcars); 
             summary(fit); TukeyHSD(fit)
Regression:  fit <- lm(mpg ~ as.factor(cyl) + as.factor(carb), mtcars) 
             # with F dummy coded; 
             summary(fit); anova(fit)

Two-way Factorial ANOVA:

Structure:   All possible COMBINATIONS of LEVELS are considered.
Scenario:    mpg ~ cylinders + carburetors + (4cyl/1,...8cyl/4)
Syntax:      fit <- aov(mpg ~ as.factor(cyl) * as.factor(carb), mtcars); 
             summary(fit); TukeyHSD(fit)
Regression:  fit <- lm(mpg ~ as.factor(cyl) * as.factor(carb), mtcars) 
             # with F dummy coded; 
             summary(fit); anova(fit)

ANCOVA:

Structure:   DV continuous ~ Factor and continuous COVARIATE.
Scenario:    mpg ~ cylinders + weight
Syntax:      fit <- aov(mpg ~ as.factor(cyl) + wt, mtcars); summary(fit)
Regression:  fit <- lm(mpg ~ as.factor(cyl) + wt, mtcars) 
             # with F dummy coded; 
             summary(fit); anova(fit)

MANOVA:

Structure:   > 1 DVs continuous ~ 1 FACTOR ("One-way") or 2 FACTORS ("Two-way MANOVA").
Scenario:    mpg and wt ~ cylinders
Syntax:      fit <- manova(cbind(mpg,wt) ~ as.factor(cyl), mtcars); summary(fit)
Regression:  N/A

MANCOVA:

Structure:   > 1 DVs continuous ~ 1 FACTOR + 1 continuous (covariate) DV.
Scenario:    mpg and wt ~ cyl + displacement (cubic inches)
Syntax:      fit <- manova(cbind(mpg,wt) ~ as.factor(cyl) + disp, mtcars); summary(fit)
Regression:  N/A

WITHIN FACTOR (or SUBJECT) ANOVA: (code here)

Structure:   DV continuous ~ FACTOR with each level * with subject (repeated observations).
             Extension paired t-test. Each subject measured at each level multiple times. 
Scenario:    Memory rate ~ Emotional value of words for Subjects @ Times
Syntax:      fit <- aov(Recall_Rate ~ Emtl_Value * Time + Error(Subject/Time), data); 
             summary(fit); print(model.tables(fit, "means"), digits=3);
             boxplot(Recall_Rate ~ Emtl_Value, data=data)
             with(data, interaction.plot(Time, Emtl_Value, Recall_Rate))
             with(data, interaction.plot(Subject, Emtl_Value, Recall_Rate))
             NOTE: Data should be in the LONG FORMAT (same subject in multiple rows)
Regression:  Mixed Effects
             require(lme4); require(lmerTest)
             fit <- lmer(Recall_Rate ~ Emtl_Value * Time + (1|Subject/Time), data); 
             anova(fit); summary(fit); coefficients(fit); confint(fit) 
or
             require(nlme)
             fit <- lme(Recall_Rate ~ Emtl_Value * Time, random = ~1|Subject/Time, data)
             summary(fit); anova(fit); coefficients(fit); confint(fit)

SPLIT-PLOT: (code here)

Structure:   DV continuous ~ FACTOR/-S with RANDOM EFFECTS and pseudoreplication.
Scenario:    Harvest yield ~ Factors = Irrigation / Density of seeds / Fertilizer 
                 & RANDOM EFFECTS (Blocks and plots of land): 
Syntax:      fit <- aov(yield ~ irrigation * density * fertilizer + 
                 Error(block/irrigation/density), data); summary(fit)
Regression:  Mixed Effects
             require(lme4); require(lmerTest); 
             fit <- lmer(yield ~ irrigation * fertilizer + 
             (1|block/irrigation/density), data = splityield); 
             anova(fit); summary(fit); coefficients(fit); confint(fit)
or
             library(nlme)
             fit <- lme(yield ~ irrigation * variety, random=~1|field, irrigation)
             summary(fit); anova(fit)

NESTED DESIGN: (code here)

Structure:   DV continuous ~ FACTOR/-S with pseudoreplication.
Scenario:    [Glycogen] ~ Factors = Treatment & RANDOM EFFECTS with Russian-doll effect: 
             Six rats (6 Livers)-> 3 Microscopic Slides/Liver-> 2 Readings/Slide). 
Syntax:      fit <- aov(Glycogen ~ Treatment + Error(Rat/Liver), data); summary(fit)
Regression:  Mixed Effects
             require(lme4); require(lmerTest)
             fit <- lmer(Glycogen ~ Treatment + (1|Rat/Liver), rats); 
             anova(fit); summary(fit); coefficients(fit); confint(fit)
or
             require(nlme)
             fit<-lme(Glycogen ~ Treatment, random=~1|Rat/Liver, rats)
             summary(fit); anova(fit); VarCorr(fit)

USEFUL SITES:

  1. RExRepos
  2. Personality Project
  3. Quick-R
  4. R-Bloggers
  5. Nested Analysis and Split-Plot by M. Crawley
  6. Models with Multiple Random Effects
  7. Split Plot Models
  8. The R Book by M. Crawley
  9. Within Groups & Repeated Measures
  10. Repeat Measures in R
  11. GLMM FAQ
$\endgroup$
  • $\begingroup$ One note: for your 2-way ANOVA examples (straight-up and factorial) your scenario/syntax is cyl + hp. Horespower is continuous, so doesn't work here. carb, the number of carburetors would be a better choice. $\endgroup$ – Gregor Aug 28 '15 at 20:07
  • $\begingroup$ Thank you! Careless mistake. Thanks to your note I also detected cyl treated as continuous, so I changed it to as.factor. And, I included TukeyHSD. $\endgroup$ – Antoni Parellada Aug 28 '15 at 21:44
  • 1
    $\begingroup$ I think you should drop 'Survival' from the title as that is a very specific area of statistics completely unrelated to what you are (very nicely) summarizing. $\endgroup$ – Bryan Hanson Aug 28 '15 at 22:07
  • $\begingroup$ Nice summary Antoni! Maybe you could also add the glmmFAQs by Ben Bolker and perhaps some simple binomial and Poisson examples (GLM and GLMM). But I understand that this may complicate things too much and takes away from this nice and concise summary. Alternatively you could link to examples on this site. For a complete simple Poisson/negative binomial example this may work: stats.stackexchange.com/questions/325334/… $\endgroup$ – Stefan Mar 24 '18 at 21:31
2
$\begingroup$

Nice list, Antoni. Here are some minor suggestions:

One-Way ANOVA: IV is a FACTOR with 3 or more levels. You could also add an Example Data: mtcars to this entry. (Similarly, you could add *Example Data" statements to all of your entries, to make it clearer what data sets you are using.)

Two-Way Anova: Why not use IV1 and IV2 and state that the two independent variables should be factors with at least two levels each? The way you have this stated currently suggests a two-way anova could include more than 2 independent variables (or factors), which is non-sensical.

For Two-Way Anova, I would differentiate between these two sub-cases: 1. Two-Way Anova with Main Effects for IV1 and IV2 and 2. Two-Way Anova with an Interaction between IV1 and IV2. This second item is what you are referring two as a factorial two-way anova.) A better way of describing these two sub-cases would be: 1. Effect of IV1 on DV is independent of effect of IV2 and 2. Effect of IV1 on DV depends on IV2. You could also make it clearer that it is the independent variables IV1 and IV2 which are dummy coded in the regression setting.

For ANCOVA, you could clarify that you are considering only one-way ANCOVA in your current example. For completeness, you could add a two-way ANCOVA example with no interactions between IV1 and IV2, and one with interaction between these two variables.

For all of the above, you could also add an item called Purpose, which describes when these analyses are useful. For example:

Purpose (of one-way anova): Investigate whether the mean values of the DV are different across levels of the IV.

For MANOVA, can you clarify that one would need (a) two or more DVs and (2) one or more IVs which are factors? I guess you can differentiate between one-way MANOVA (with 1 factor) and two-way MANOVA? Same thing for MANCOVA.

The WITHIN-FACTOR ANOVA is also known an REPEATED MEASURES ANOVA, so maybe you can add this terminology to your list for those who are familiar with it. It would also be helpful to clarify that mixed effects modeling provides an alternative way to modeling repeated measures data. Otherwise, readers might not appreciate the difference between the two approaches.

$\endgroup$
  • $\begingroup$ It's easier for me to provide suggestions rather than make edits.🤗 $\endgroup$ – Isabella Ghement Mar 24 '18 at 20:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.