ANOVA, single, and multiple factor experiments

Experimental Design in R

Joanne Xiong

Data Scientist

ANOVA

  • Used to compare 3+ groups
  • An omnibus test:
    • won't know which groups' means are different without additional post hoc testing
  • Two ways to implement in R:
#one
model_1 <- lm(y ~ x, data = dataset)
anova(model_1)

#two
aov(y ~ x, data = dataset)
Experimental Design in R

Single factor experiments

model_1 <- lm(y ~ x)
  • y = outcome variable
    • Tensile strength of different cotton fabrics
  • x = explanatory factor variable
    • Percent cotton in the fabric
Experimental Design in R

Multiple factor experiments

model2 <- lm(y ~ x + r + s + t)
  • y = outcome
    • ToothGrowth length
  • x, r, s, t = possible explanatory factor variables
    • How much vitamin C & delivery method
Experimental Design in R

Intro to Lending Club data

  • Lending Club is a U.S. based peer-to-peer loan company.
    • Data is openly available on Kaggle
  • Includes all loans issued from 2007-2015
  • Big!
    • 890k observations and 75 variables
Experimental Design in R

Let's practice!

Experimental Design in R

Preparing Video For Download...