In the mtcars sample, manual-transmission cars had an
average fuel economy that was 7.24 MPG higher than that
of automatic cars before adjustment. Because the two groups also
differed in weight and performance, several regression models were
compared. Backward AIC selection retained transmission, weight, and
quarter-mile time. After adjustment, manual transmission was associated
with 2.94 additional MPG for cars with the same weight
and quarter-mile time (95% CI 0.05 to 5.83 MPG;
p = 0.047). Manual transmission therefore
appears better for MPG in this sample, although the estimate is
uncertain and the observational data cannot establish a causal
effect.
The mtcars data set contains 32 automobiles from the
1973–1974 model year: 19 automatic and 13 manual cars. Fuel economy,
measured in miles per gallon (mpg), is the outcome, and
transmission type (am) is coded as automatic or manual.
Manual cars average 24.39 MPG, compared with 17.15 MPG for automatic
cars, giving an unadjusted difference of 7.24 MPG. The scatterplot shows
that MPG generally decreases as weight increases and that manual cars
tend to be lighter. Weight may therefore confound the observed
relationship, so regression adjustment is needed before attributing the
entire difference to transmission type.
| Transmission | n | Mean MPG | SD MPG |
|---|---|---|---|
| Automatic | 19 | 17.15 | 3.83 |
| Manual | 13 | 24.39 | 6.17 |
Figure 1. MPG versus weight. The fitted lines are descriptive within each transmission group.
Several candidate regression models were fitted to separate the
association between transmission and MPG from differences in other
vehicle characteristics. The first model estimated the unadjusted
transmission difference. The second added weight (wt),
which appeared to be an important confounder in the exploratory
analysis. A prespecified candidate model also included horsepower
(hp) and quarter-mile time (qsec) as
performance measures. Finally, a full model containing all available
vehicle characteristics was reduced using backward AIC selection. Lower
AIC values indicate a better balance between model fit and complexity.
Backward selection retained transmission, weight, and quarter-mile time
(mpg ~ transmission + wt + qsec). The selected model had
the lowest AIC among the reported models and remained straightforward to
interpret. Because model selection and inference used the same small
data set, the confidence intervals and p-values should be interpreted
cautiously.
| Model | Terms | AIC | Adjusted R-squared |
|---|---|---|---|
| Unadjusted | transmission | 196.5 | 0.338 |
| Weight adjusted | transmission + wt | 168.0 | 0.736 |
| Prespecified candidate | transmission + wt + hp + qsec | 154.3 | 0.837 |
| AIC-selected | transmission + wt + qsec | 154.1 | 0.834 |
The raw manual-versus-automatic estimate was 7.24 MPG (95% CI 3.64 to 10.85). The selected regression equation is:
Estimated MPG = 9.62 - 3.92(Weight) + 1.23(Quarter-mile time) + 2.94(Manual).
1. Is an automatic or manual transmission better for MPG? Manual transmission is associated with better MPG in this sample. Holding weight and quarter-mile time constant, changing the indicator from automatic to manual corresponds to an expected 2.94-MPG increase.
2. What is the MPG difference? The unadjusted difference is 7.24 MPG. After adjustment, the estimated difference is 2.94 MPG (95% CI 0.05 to 5.83 MPG, p = 0.047). The interval barely excludes zero, so the evidence is modest. Each additional 1,000 lb is associated with 3.92 fewer MPG, while each additional second in quarter-mile time is associated with 1.23 more MPG, with the other model terms held constant.
Vehicle weight explains a substantial part of the raw transmission difference. The diagnostic plots in the appendix show mild curvature and increasing spread, while the Q-Q plot is reasonably close to normal. No observation has Cook’s distance above 1, although several cars merit attention. The sample contains only 32 older cars, and other design differences may remain. The result describes an association and does not establish that changing transmission type causes better fuel economy.
For the cars in the mtcars data set, manual transmission is associated with better fuel economy than automatic transmission. Manual cars average 7.24 more MPG before adjustment. After holding weight and quarter-mile time constant, manual transmission is associated with an estimated 2.94-MPG advantage (95% CI 0.05 to 5.83 MPG). Therefore, manual transmission appears better for MPG in this sample, although the adjusted evidence is modest and the observational data do not establish a causal effect.
All estimates, tables and figures are generated from R’s built-in
mtcars data when this R Markdown file is knitted. The
complete code is contained in its executable chunks; the main model code
is shown below. No random simulation is used, and
sessionInfo.txt is written during knitting.
data(mtcars, package = "datasets")
cars <- transform(mtcars,
transmission = factor(am, c(0, 1), c("Automatic", "Manual")))
m_unadjusted <- lm(mpg ~ transmission, data = cars)
m_weight <- lm(mpg ~ transmission + wt, data = cars)
m_candidate <- lm(mpg ~ transmission + wt + hp + qsec, data = cars)
m_full <- lm(mpg ~ transmission + cyl + disp + hp + drat + wt +
qsec + vs + gear + carb, data = cars)
m_selected <- MASS::stepAIC(m_full, direction = "backward", trace = FALSE)
coef(summary(m_selected)); confint(m_selected)
Henderson, H. V., & Velleman, P. F. (1981). Building multiple regression models interactively. Biometrics, 37, 391-411.
R Core Team (2026). R: A Language and Environment for Statistical Computing. R Foundation for Statistical Computing, Vienna, Austria.
Venables, W. N., & Ripley, B. D. (2002). Modern Applied Statistics with S (4th ed.). Springer.
Figure A1. Diagnostic plots for the selected model.