Using the mtcars data, answer the following:
1.1 What is the mean and standard deviation of mpg of the mtcars
data?
mean(mtcars$mpg)
## [1] 20.09062
sd(mtcars$mpg)
## [1] 6.026948
1.2 Is there sufficient evidence that the population mean score of
the mtcars data exceeds 19 miles per gallon?
t.test(mtcars$mpg, mu=19, alternative = "greater")
##
## One Sample t-test
##
## data: mtcars$mpg
## t = 1.0237, df = 31, p-value = 0.157
## alternative hypothesis: true mean is greater than 19
## 95 percent confidence interval:
## 18.28418 Inf
## sample estimates:
## mean of x
## 20.09062
1.3 Refer to Question 1.2, state your null and alternative
hypotheses?
Null hypothesis: The population mean score of the mtcars data does
not exceeds 19 miles per gallon.
Alternative hypothesis: The population mean score of the mtcars data
exceeds on 19 miles per gallon.
1.4 Is there sufficient evidence that mean difference of miles per
gallon between automatic and manual cars differ statistically?
mtcars$am <- as.factor(mtcars$am)
levels(mtcars$am) <-c("AT", "MT")
mpg.at <- mtcars[mtcars$am == "AT",]$mpg
mpg.mt <- mtcars[mtcars$am == "MT",]$mpg
t.test(mpg.at, mpg.mt)
##
## Welch Two Sample t-test
##
## data: mpg.at and mpg.mt
## t = -3.7671, df = 18.332, p-value = 0.001374
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -11.280194 -3.209684
## sample estimates:
## mean of x mean of y
## 17.14737 24.39231
1.5 Refer to Question 1.4, state your null and alternative
hypotheses?
Null hypothesis: Doesn’t have a mean difference of miles per gallon
between automatic and manual cars.
Alternative hypothesis: There exist a mean difference of miles per
gallon between automatic and manual cars.