A client has come to you. There in-house data scientist has gone crazy and fled to study the social habits of monkeys in the Amazon. Unfortunately, they had just run an important study trying to determine their new ad campaign and their data scientist left before analyzing the results. All they have is a piece of paper with a table on it (see below) and a glimmer of hope. Properly analyze the data showing your code. Then summarize the results.

Weekly_Lab_3=read.csv("C:/Users/jcolu/OneDrive/Documents/Harrisburg/Summer 2018/ANLY 510/Weekly Lab 3.csv")
Weekly_Lab_3

Determine Data Type in set

str(Weekly_Lab_3)
## 'data.frame':    18 obs. of  5 variables:
##  $ Time    : Factor w/ 3 levels "Afternoon","Evening",..: 1 3 3 1 2 2 3 3 1 1 ...
##  $ Audience: int  3 5 4 1 3 2 2 6 5 2 ...
##  $ Day     : int  1 2 2 1 1 1 1 2 2 1 ...
##  $ Ad      : int  1 2 1 2 2 1 2 3 3 3 ...
##  $ Rating  : int  9 9 10 5 2 8 9 9 8 8 ...

Convert Data to Categorical & Order Factors

Weekly_Lab_3$Day=replace(Weekly_Lab_3$Day,Weekly_Lab_3$Day==1,"Day 1")
Weekly_Lab_3$Day=replace(Weekly_Lab_3$Day,Weekly_Lab_3$Day==2,"Day 2")
Weekly_Lab_3$Day=factor(Weekly_Lab_3$Day,levels=unique(Weekly_Lab_3$Day))
levels(Weekly_Lab_3$Day)
## [1] "Day 1" "Day 2"
Weekly_Lab_3$Ad=replace(Weekly_Lab_3$Ad,Weekly_Lab_3$Ad==1, "Ad 1")
Weekly_Lab_3$Ad=replace(Weekly_Lab_3$Ad,Weekly_Lab_3$Ad==2, "Ad 2")
Weekly_Lab_3$Ad=replace(Weekly_Lab_3$Ad,Weekly_Lab_3$Ad==3, "Ad 3")
Weekly_Lab_3$Ad=factor(Weekly_Lab_3$Ad,levels=unique(Weekly_Lab_3$Ad))
levels(Weekly_Lab_3$Ad)
## [1] "Ad 1" "Ad 2" "Ad 3"

Verify that data was factorized

str(Weekly_Lab_3)
## 'data.frame':    18 obs. of  5 variables:
##  $ Time    : Factor w/ 3 levels "Afternoon","Evening",..: 1 3 3 1 2 2 3 3 1 1 ...
##  $ Audience: int  3 5 4 1 3 2 2 6 5 2 ...
##  $ Day     : Factor w/ 2 levels "Day 1","Day 2": 1 2 2 1 1 1 1 2 2 1 ...
##  $ Ad      : Factor w/ 3 levels "Ad 1","Ad 2",..: 1 2 1 2 2 1 2 3 3 3 ...
##  $ Rating  : int  9 9 10 5 2 8 9 9 8 8 ...

Test for ANOVA

anova(lm(Weekly_Lab_3$Rating~Weekly_Lab_3$Time))
anova(lm(Weekly_Lab_3$Rating~Weekly_Lab_3$Day))
anova(lm(Weekly_Lab_3$Rating~Weekly_Lab_3$Ad))

Conclusions

  1. When comparing Ad rating and airing time, F- value is high and p value is under .05. Meaning that the null hypothesis is accepted, and we confirm that ads have a different rating according to the time of airing.
  2. When comparing Ad rating and airing day, F-value is low, p value is below 05. Meaning that the null hypothesis is rejected and we concluded that there is no relationship between Ads’ rating and the day that they were aired.
  3. When comparing the Ad number in contrast to the rating, the F-value is high and the p-value is less than 0.5. This ANOVA is test is used to verify that each ad has different ratings.