Part 1: Read the data..
# reading external data and storing into a dataframe called "airline.df"
advt.df <- read.csv("AdvertisingDataV2.csv")
Part 2: Anova- One way
# Compute the analysis of variance
res.aov <- aov(reservations ~ adType, data = advt.df)
summary(res.aov)
## Df Sum Sq Mean Sq F value Pr(>F)
## 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: Anova- two way
# Compute the analysis of variance
fit <- aov(reservations ~ adType+restaurantType, data = advt.df)
fit2 <- aov(reservations ~ adType+restaurantType+adType:restaurantType, data = advt.df)
summary(fit)
## Df Sum Sq Mean Sq F value Pr(>F)
## adType 2 394228 197114 7654 <2e-16 ***
## restaurantType 1 749570 749570 29108 <2e-16 ***
## Residuals 29996 772449 26
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(fit2)
## Df Sum Sq Mean Sq F value Pr(>F)
## adType 2 394228 197114 7658.285 < 2e-16 ***
## restaurantType 1 749570 749570 29122.292 < 2e-16 ***
## adType:restaurantType 2 442 221 8.594 0.000186 ***
## Residuals 29994 772006 26
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1