You are on page 1of 2

Eect of Transmission Type on a Cars Mileage

Shridhara Aithal
Friday, July 24, 2015
Executive Summary
This report is to identify the eect of transmission type (automatic vs. manual) on a cars mileage. We
perform some analysis on mtcars dataset to determine whether manual transmission is better than automatic
and quantify the dierence if any.
Our analysis shows that cars with manual transmission have a better mileage than the cars with automatic
transmission. Holding all other variables constant, manual transmission give an average of 7.25mpg more
than automatic transmission.

Analysis
We rst load mtcars dataset and do a bit of preprocessing and basic analysis to understand the data.
library(dplyr)
library(ggplot2)
data(mtcars)
mtcars$am <- factor(mtcars$am, labels = c("Automatic", "Manual"))
c <- group_by(mtcars, am)
summarize(c, mean(mpg))
## Source: local data frame [2 x 2]
##
##
am mean(mpg)
## 1 Automatic 17.14737
## 2
Manual 24.39231
c <- group_by(mtcars, cyl, am)
summarize(c, mean(mpg))
##
##
##
##
##
##
##
##
##
##

Source: local data frame [6 x 3]


Groups: cyl

1
2
3
4
5
6

cyl
am mean(mpg)
4 Automatic 22.90000
4
Manual 28.07500
6 Automatic 19.12500
6
Manual 20.56667
8 Automatic 15.05000
8
Manual 15.40000

From the summary, we see that on an average, manual transmission has better mpg than automatic whether
we consider number of cylinders or not.
We now t a model and see what the model predicts.
1

fit <- lm(mpg ~ am, data = mtcars)


summary(fit)$coefficients
##
Estimate Std. Error
t value
Pr(>|t|)
## (Intercept) 17.147368
1.124603 15.247492 1.133983e-15
## amManual
7.244939
1.764422 4.106127 2.850207e-04
From the coecients of the model we see that manual transmission has a positive slope (a dierence of
7.25mpg) in comparison with automatic transmission and the relationship is signicant (with a low p-value)
We now plot the residuals to see their characteristics
qplot(mtcars$am, resid(fit)) + geom_boxplot() + ylab("Residuals (mpg)") +
xlab("Transmission") + ggtitle("Residuals")

Residuals
10

Residuals (mpg)

10
Automatic

Manual

Transmission
From the plot we see that the residuals for manual transmission have a greater variation than that of
automatic transmission.

You might also like