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