Part 1: Read the data..
# reading external data and storing into a dataframe called "airline.df"
df <- read.csv("AdvertisingDataV2.csv")
Part 2: one way anova
# one-way ANOVA test
res.aov <- aov(df$reservations ~ df$adType, data = df)
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## df$adType 2 394228 197114 3885 <2e-16 ***
## Residuals 29997 1522018 51
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Part 3: two way anova
# two-way ANOVA test
res.aov2 <- aov(df$reservations ~ df$adType + df$restaurantType + df$restaurantType:df$adType,
data = df)
summary(res.aov2)
## Df Sum Sq Mean Sq F value Pr(>F)
## df$adType 2 394228 197114 7658.285 < 2e-16 ***
## df$restaurantType 1 749570 749570 29122.292 < 2e-16 ***
## df$adType:df$restaurantType 2 442 221 8.594 0.000186 ***
## Residuals 29994 772006 26
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1