EXECUTIVE SUMMARY

This assignment addresses two key questions:

Based on the analysis, the following can said:

  1. A Manual transmission would appear to be better for mpg than an Automatic.
  2. On average, a Manual transmission adds approximately 7 miles per gallon (+/- 3.6 mpg with 95% confidence) to fuel efficiency when compared to an Automatic.

EXPLORATORY DATA ANALYSIS

##               mpg cyl disp  hp drat    wt  qsec vs am gear carb
## Mazda RX4      21   6  160 110  3.9 2.620 16.46  0  1    4    4
## Mazda RX4 Wag  21   6  160 110  3.9 2.875 17.02  0  1    4    4

The above plot suggests there is an mpg advantage beyond ~25mpg for Manual Transmissions.

MODEL THE DATA

Model 1

Model 1 considers only the effect of Transmission on mpg. The effect in this case appears to be significant (p < 0.05) and a Manual transmission adds an average of 7.2 mpg as compated to an Automatic transmission.

m1 <- lm(mpg ~ factor(am.type), data = mtcars.1)
summary(m1)$coef
##                        Estimate Std. Error   t value     Pr(>|t|)
## (Intercept)           17.147368   1.124603 15.247492 1.133983e-15
## factor(am.type)Manual  7.244939   1.764422  4.106127 2.850207e-04

Model 2

Model 2 introduces some additional variables, cylinders and horsepower to test their influence over mpg.

These additional two variables have a negative effect on mpg, which makes sense since additional cylinders and increasing horsepower will decrese mpg. Both of these additional variables are statistically significant (p < 0.05).

However these additonal variables have lessened the significance of Transmission where a Manual Transmission adds 3.9 mpg on average whilst holding cyl and hp constant.

m2 <- lm(mpg ~ factor(am.type) + (cyl) + hp, data = mtcars.1)
summary(m2)$coef
##                          Estimate Std. Error   t value     Pr(>|t|)
## (Intercept)           30.88834447 2.78421734 11.094085 9.270924e-12
## factor(am.type)Manual  3.90427517 1.29659203  3.011182 5.464020e-03
## cyl                   -1.12721117 0.63416591 -1.777470 8.635578e-02
## hp                    -0.03687575 0.01451937 -2.539763 1.692706e-02

Model 3

Model 3 includes all variables to demonstrate this effect.

m3 <- lm(mpg ~ ., data = mtcars)
summary(m3)$coef
##                Estimate  Std. Error    t value   Pr(>|t|)
## (Intercept) 12.30337416 18.71788443  0.6573058 0.51812440
## cyl         -0.11144048  1.04502336 -0.1066392 0.91608738
## disp         0.01333524  0.01785750  0.7467585 0.46348865
## hp          -0.02148212  0.02176858 -0.9868407 0.33495531
## drat         0.78711097  1.63537307  0.4813036 0.63527790
## wt          -3.71530393  1.89441430 -1.9611887 0.06325215
## qsec         0.82104075  0.73084480  1.1234133 0.27394127
## vs           0.31776281  2.10450861  0.1509915 0.88142347
## am           2.52022689  2.05665055  1.2254035 0.23398971
## gear         0.65541302  1.49325996  0.4389142 0.66520643
## carb        -0.19941925  0.82875250 -0.2406258 0.81217871

Residuals

The plots in the Appendix A demonstrate a larger spread in residual values for manual transmission vehicles.

When reviewing the Residuals Vs Fitted plot, there is an incresasing pattern as model complexity increases. For this reason, the simplest model has been selected (Model 1).

Inference

Now look at the confidence intervals for Model 1 in relation to Manual Transmission.

sumCoef <- summary(m1)$coefficients
sumCoef[2, 1] + c(-1, 1) * qt(0.975, df = m1$df) * sumCoef[2, 2]
## [1]  3.64151 10.84837

Meaning that Manual transmissions have a 3.6 to 10.8 increase in mpg (95% confidence).

APPENDIX A

Residual Plots