Read data

data <- read_csv("../datasets/AdvertisingDataV2.csv")
## Parsed with column specification:
## cols(
##   adType = col_character(),
##   pageViews = col_double(),
##   phoneCalls = col_double(),
##   reservations = col_double(),
##   businessID = col_double(),
##   restaurantType = col_character()
## )
data$adType <- as.factor(data$adType)
head(data)
## # A tibble: 6 x 6
##   adType pageViews phoneCalls reservations businessID restaurantType
##   <fct>      <dbl>      <dbl>        <dbl>      <dbl> <chr>         
## 1 No Ads       643         44           39          1 chain         
## 2 No Ads       621         41           44          2 chain         
## 3 No Ads       581         40           38          3 chain         
## 4 No Ads       592         35           31          4 chain         
## 5 No Ads       648         45           46          5 chain         
## 6 No Ads       519         37           41          6 chain

One Way ANOVA

one_way_fit <- aov(data$reservations ~ data$adType)
summary(one_way_fit)
##                Df  Sum Sq Mean Sq F value Pr(>F)    
## data$adType     2  394228  197114    3885 <2e-16 ***
## Residuals   29997 1522018      51                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Two Way ANOVA

two_fay_fit <- aov(data$reservations ~ data$adType + data$restaurantType)
summary(two_fay_fit)
##                        Df Sum Sq Mean Sq F value Pr(>F)    
## data$adType             2 394228  197114    7654 <2e-16 ***
## data$restaurantType     1 749570  749570   29108 <2e-16 ***
## Residuals           29996 772449      26                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1