Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Problem 1 (12 Marks)

Consider an experiment to study four types of advertisement: local newspaper ads, local radio ads,
in-store sales people and in-store displays. The country is divided into 144 locations and 36 locations
are randomly assigned to each type of advertising. The level of sales is measured in reach region in
thousands of dollars. You want to whether the average sales are significantly different for four types
of advertising. The ads.csv dataset contains the following variables:

Ad type of advertising

Sales level of sales in thousands of dollars

Examine the data.

What is the overall median sales value?

Subset the data using subset argument and answer question

The median sales value is 66.82

rm(list=ls())
setwd("C:/Exam")
getwd()

list.files()

totalads<-read.csv("ads.csv")

totalads
totalads.aov = aov(Sales~Ad, data= totalads)
totalads.aov
summary(totalads.aov)
mean(totalads$Sales, na.rm=TRUE)

> mean(totalads$Sales, na.rm=TRUE)


[1] 66.81944
What is the average sales value using paper advertisement?
> PaperAdSales = subset(totalads, Ad== "paper")
> mean(PaperAdSales$Sales, na.rm = TRUE)
[1] 73.22222

What is the standard deviation of sales when radio advertisement was used?

> sd(RadioAdSale$Sales)
[1] 12.9676

Test the hypothesis that all means are equal. What conclusions can you reach? Use the aov()
function.

You might also like