This report investigates two questions using the mtcars
dataset:
The analysis uses exploratory data analysis, three linear regression models, confidence intervals, and residual diagnostics. Manual cars have higher average MPG in this sample. However, vehicle weight, horsepower, and displacement may also explain some of the observed difference.
The results describe associations in a small observational dataset and should not be interpreted as proof that transmission type causes higher fuel economy.
The dataset contains 32 cars, including 19 automatic cars and 13 manual cars.
| transmission | Cars | Mean_MPG | Median_MPG | SD_MPG | Mean_Weight | Mean_Horsepower |
|---|---|---|---|---|---|---|
| Automatic | 19 | 17.15 | 17.3 | 3.83 | 3.77 | 160.26 |
| Manual | 13 | 24.39 | 22.8 | 6.17 | 2.41 | 126.85 |
The plot compares the MPG distributions. Manual cars generally show higher fuel economy in this sample. This initial comparison does not control for differences in vehicle characteristics.
We fit three models with progressively more explanatory variables.
| Model | Adjusted_R2 | AIC | Residual_SE |
|---|---|---|---|
| Model 1: Transmission only | 0.338 | 196.484 | 4.902 |
| Model 2: + Weight + Horsepower | 0.823 | 156.135 | 2.538 |
| Model 3: + Displacement | 0.817 | 158.067 | 2.581 |
Model 1 estimates the unadjusted transmission difference. Model 2 controls for vehicle weight and horsepower, two important predictors of fuel economy. Model 3 adds displacement to examine whether the estimated transmission association changes.
We compare adjusted \(R^2\), AIC, residual standard error, and coefficient stability. A lower AIC and higher adjusted \(R^2\) can indicate better fit, but additional predictors also increase model complexity.
Because the dataset contains only 32 observations and weight, horsepower, and displacement may be correlated, we prioritize interpretability and parsimony. Model 2 is our primary adjusted model, while Model 3 is a sensitivity analysis.
In all three models, automatic transmission is the reference
category. Therefore, the coefficient for transmissionManual
represents the estimated MPG difference between manual and automatic
cars, holding the other included variables constant.
| Model | Term | Estimate | Std_Error | t_value | p_value |
|---|---|---|---|---|---|
| Model 1 | (Intercept) | 17.1474 | 1.1246 | 15.2475 | 0.0000 |
| Model 1 | transmissionManual | 7.2449 | 1.7644 | 4.1061 | 0.0003 |
| Model 2 | (Intercept) | 34.0029 | 2.6427 | 12.8669 | 0.0000 |
| Model 2 | transmissionManual | 2.0837 | 1.3764 | 1.5139 | 0.1413 |
| Model 2 | wt | -2.8786 | 0.9050 | -3.1808 | 0.0036 |
| Model 2 | hp | -0.0375 | 0.0096 | -3.9018 | 0.0005 |
| Model 3 | (Intercept) | 34.2094 | 2.8228 | 12.1189 | 0.0000 |
| Model 3 | transmissionManual | 2.1593 | 1.4352 | 1.5045 | 0.1441 |
| Model 3 | wt | -3.0467 | 1.1571 | -2.6330 | 0.0138 |
| Model 3 | hp | -0.0393 | 0.0124 | -3.1627 | 0.0038 |
| Model 3 | disp | 0.0025 | 0.0104 | 0.2399 | 0.8122 |
mtcars.A coefficient’s sign indicates the direction of the association. Its magnitude gives the estimated change in MPG per unit of the predictor. A p-value alone does not measure practical importance or establish causation.
First, calculate the difference in group means.
## Mean MPG, automatic: 17.15
## Mean MPG, manual: 24.39
## Manual minus automatic: 7.24 MPG
Next, calculate a 95% confidence interval using Welch’s two-sample t-test. This method does not assume equal population variances.
| Difference_Manual_Minus_Automatic | CI_Lower | CI_Upper | P_Value |
|---|---|---|---|
| 7.2449 | -11.2802 | -3.2097 | 0.0014 |
The confidence interval quantifies uncertainty in the unadjusted difference in group means. If it excludes zero, the data provide evidence of a difference in mean MPG between the groups under the test’s assumptions.
This interval does not adjust for vehicle weight, horsepower, or displacement. The regression coefficients address those variables separately.
| Estimate | CI_Lower | CI_Upper | P_Value | |
|---|---|---|---|---|
| transmissionManual | 2.0837 | -0.7358 | 4.9032 | 0.1413 |
The adjusted estimate is the expected MPG difference associated with manual rather than automatic transmission among cars with the same modeled weight and horsepower. Its confidence interval describes statistical uncertainty under the regression assumptions.
We inspect the diagnostic plots for Model 2, our primary adjusted model.
The diagnostic plots help assess:
The small sample size limits how confidently these plots can establish that assumptions hold. Any visible patterns or influential observations should be considered when interpreting the results.
In the mtcars sample, manual cars have higher average
MPG than automatic cars. This is an observed association, not evidence
that changing transmission alone would cause the difference.
The unadjusted difference, calculated as manual minus automatic, is 7.24 MPG.
The 95% confidence interval is -11.28 to -3.21 MPG.
After adjusting for weight and horsepower, the estimated transmission difference is 2.08 MPG, with a 95% confidence interval from -0.74 to 4.9 MPG.
Manual transmission is associated with higher MPG in this dataset. The unadjusted comparison quantifies the raw difference, while the adjusted regression estimates the association after accounting for selected vehicle characteristics.
The conclusions should be treated cautiously because the dataset is small and observational, and the predictors may be correlated. The analysis cannot establish a causal effect of transmission type.