Recently, Motor Trend comissioned an analysis of automatic vs. manual transmission for cars. We were interested in answering the following two questions: -
Is an automatic or manual transmission better for MPG? - We find that manual transmission is generally better for car mileage, holding all other variables constant (see Appendix 2 for a zone between 2500-3500 lbs where automatic transmission sometimes performs better than manual transmission).
What is the MPG difference between automatic and manual transmissions? - Miles per gallon difference between automatic and manual trasmission is about 1.21 mpg holding all other variables constant, with 95% confidence interval as (-5.70, 8.06). Given the interval crosses 0, we cannot reject the null hypothesis, that transmission type has no impact on miles per gallon.
The data used below is extracted from the 1974 Motor Trend US magazine, and comprises fuel consumption and 10 aspects of automobile design and performance for 32 automobiles (1973–74 models). Their transmission systems and their MPG are shown in Appendix 1. Plotting the MPG vs. Transmission type would suggest that Manual transmission seems to go further in miles per gallon, than Automatic transmission. ##Simple linear regression of mpg vs. transmission type Fitting a linear model with mpg as the outcome, and transmission (am in the dataset mtcars) as the predictor, mpg = b0 + b1 * am, shows that mpg is strongly correlated to transmission.
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 17.147368 1.124603 15.247492 1.133983e-15
## am1 7.244939 1.764422 4.106127 2.850207e-04
We need to understand whether one or many of othe variables have a correlation to miles per gallon, and are confounding this analysis. Fitting a linear model including all variables shows the following: -
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 23.87913244 20.06582026 1.19004018 0.25252548
## cyl6 -2.64869528 3.04089041 -0.87102622 0.39746642
## cyl8 -0.33616298 7.15953951 -0.04695316 0.96317000
## disp 0.03554632 0.03189920 1.11433290 0.28267339
## hp -0.07050683 0.03942556 -1.78835344 0.09393155
## drat 1.18283018 2.48348458 0.47627845 0.64073922
## wt -4.52977584 2.53874584 -1.78425732 0.09461859
## qsec 0.36784482 0.93539569 0.39325050 0.69966720
## vs 1.93085054 2.87125777 0.67247551 0.51150791
## am1 1.21211570 3.21354514 0.37718957 0.71131573
## gear4 1.11435494 3.79951726 0.29328856 0.77332027
## gear5 2.52839599 3.73635801 0.67670068 0.50889747
## carb2 -0.97935432 2.31797446 -0.42250436 0.67865093
## carb3 2.99963875 4.29354611 0.69863900 0.49546781
## carb4 1.09142288 4.44961992 0.24528452 0.80956031
## carb6 4.47756921 6.38406242 0.70136677 0.49381268
## carb8 7.25041126 8.36056638 0.86721532 0.39948495
We see that the effect of manual transmission (am1) on mpg reduces from 7.24 to 1.21 confirming our hypothesis that other variables were confounding the analysis.
However, how are we assured that the standard errors are not being inflated, due to throwing in uncorrelated variables into the model? We form a hypthesis that weight of the car, the displacement and horsepower of the engine are covariates in addition to the transmission type in predicting the miles per gallon for the car. We will create 3 additional linear models: -
Taking weight, displacement, horsepower, and transmission type into account, we are able to parsimoniously explain the total variation in miles per gallon almost completely, comparing r-squared of model 6 (0.8930749) vs. model 5 (0.8402309). So, in summary, if we hold all other variables constant, moving from automatic to manual transmission type will result in a 1.21 mpg increase in mileage of the car. The confidence interval around this estimate is: -
## 2.5 % 97.5 %
## am1 -5.637394 8.061625
## Car Transmission MPG
## 1 Mazda RX4 Manual 21.0
## 2 Mazda RX4 Wag Manual 21.0
## 3 Datsun 710 Manual 22.8
## 4 Hornet 4 Drive Automatic 21.4
## 5 Hornet Sportabout Automatic 18.7
## 6 Valiant Automatic 18.1
## 7 Duster 360 Automatic 14.3
## 8 Merc 240D Automatic 24.4
## 9 Merc 230 Automatic 22.8
## 10 Merc 280 Automatic 19.2
## 11 Merc 280C Automatic 17.8
## 12 Merc 450SE Automatic 16.4
## 13 Merc 450SL Automatic 17.3
## 14 Merc 450SLC Automatic 15.2
## 15 Cadillac Fleetwood Automatic 10.4
## 16 Lincoln Continental Automatic 10.4
## 17 Chrysler Imperial Automatic 14.7
## 18 Fiat 128 Manual 32.4
## 19 Honda Civic Manual 30.4
## 20 Toyota Corolla Manual 33.9
## 21 Toyota Corona Automatic 21.5
## 22 Dodge Challenger Automatic 15.5
## 23 AMC Javelin Automatic 15.2
## 24 Camaro Z28 Automatic 13.3
## 25 Pontiac Firebird Automatic 19.2
## 26 Fiat X1-9 Manual 27.3
## 27 Porsche 914-2 Manual 26.0
## 28 Lotus Europa Manual 30.4
## 29 Ford Pantera L Manual 15.8
## 30 Ferrari Dino Manual 19.7
## 31 Maserati Bora Manual 15.0
## 32 Volvo 142E Manual 21.4
## Appendix 3 - Plot of the mpg against transmission type, displacement, horsepower and wt
## Appendix 4 - Plot of the mpg against all regressors