0% found this document useful (0 votes)
58 views1 page

Three Way Anova With R

This document provides a summary of performing a three-way ANOVA in R. It outlines how to generate a full factorial model with all possible interactions between three factors, then update the model by removing interactions that are not significant. It also describes how to generate diagnostic plots of residuals and use the model to make predictions on new data.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views1 page

Three Way Anova With R

This document provides a summary of performing a three-way ANOVA in R. It outlines how to generate a full factorial model with all possible interactions between three factors, then update the model by removing interactions that are not significant. It also describes how to generate diagnostic plots of residuals and use the model to make predictions on new data.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Three-way Anova with R Y : numeric continuous variable

Goal: Find which factors influence a quantitative


continuous variable, taking into account their possible
stats package - No install required A, B, C, … : factor (categorical) variables
interactions

Graphical exploration Write a formula in R

Full model
Plot the mean of Y for the different factors levels
Y ~ A * B * C
plot.design(Y ~ ., data = data) same as
Y ~ A + B + C + A:B + A:C + B:C + A:B:C
Plot the mean of Y for two-way combinations of factors Update a formula
interaction.plot(data$A, data$B, data$Y)
update(oldformula, newformula)
ex update(Y ~ A + B, . ~ . + C) #> Y ~ A + B + C
update( Y ~ A + B + C, . ~ . - C) #> Y ~ A + B
Model building

Generate the full model Diagnostics & Prediction


m1 <- aov(Y ~ A * B * C, data = data)
Update an Anova model Residual plots
m2 <- update(m1, . ~ . - A:B:C) #Remove interaction plot(m2)

Analysis of variance table Predict new values


summary(m1) predict(object = m2, newdata = newdata)

Comparison between nested models


anova(m1, m2)

[These are just the


first two rows!]

This cheat sheet part of Raccoon - Statistical models with R | CC by Quantide | Learn more at http://www.quantide.com/web-books-overview/ | [email protected] | Updated: 02/17

You might also like