Perform the following steps:
- First, we visualize the attribute, mpg, against am using a boxplot:
> boxplot(mtcars$mpg, mtcars$mpg[mtcars$am==0], ylab = "mpg", names=c("overall","automobile")) > abline(h=mean(mtcars$mpg),lwd=2, col="red") > abline(h=mean(mtcars$mpg[mtcars$am==0]),lwd=2, col="blue")
- We then perform a statistical procedure to validate whether the average mpg of automobiles is lower than the average of the overall mpg:
> mpg.mu = mean(mtcars$mpg) > mpg_am = mtcars$mpg[mtcars$am == 0] > t.test(mpg_am,mu = mpg.mu)
- We begin visualizing the data ...