The data is referred as mtcars in the R environment.
The data was extracted from the 1974 Motor Trend US magazine.
It contains performance for 32 automobiles (1973-74 models).
It also includes fuel consumption and 12 aspects of these models.
Summary statistics of continuous variables are presented in the following table.
| mpg | cyl | disp | hp | drat | wt | qsec | |
|---|---|---|---|---|---|---|---|
| N | 32.00 | 32.00 | 32.00 | 32.00 | 32.00 | 32.00 | 32.00 |
| N_excl_NA | 32.00 | 32.00 | 32.00 | 32.00 | 32.00 | 32.00 | 32.00 |
| Min | 10.40 | 4.00 | 71.10 | 52.00 | 2.76 | 1.51 | 14.50 |
| Max | 33.90 | 8.00 | 472.00 | 335.00 | 4.93 | 5.42 | 22.90 |
| AM | 20.09 | 6.19 | 230.72 | 146.69 | 3.60 | 3.22 | 17.85 |
| GM | 19.25 | 5.92 | 197.32 | 131.88 | 3.56 | 3.07 | 17.76 |
| HM | 18.44 | 5.65 | 166.80 | 118.23 | 3.52 | 2.92 | 17.68 |
| Q1 | 15.43 | 4.00 | 120.83 | 96.50 | 3.08 | 2.58 | 16.89 |
| Q2 | 19.20 | 6.00 | 196.30 | 123.00 | 3.70 | 3.33 | 17.71 |
| Q3 | 22.80 | 8.00 | 326.00 | 180.00 | 3.92 | 3.61 | 18.90 |
| Range | 23.50 | 4.00 | 400.90 | 283.00 | 2.17 | 3.91 | 8.40 |
| IQR | 7.38 | 4.00 | 205.18 | 83.50 | 0.84 | 1.03 | 2.01 |
| Var | 36.32 | 3.19 | 15360.80 | 4700.87 | 0.29 | 0.96 | 3.19 |
| SD | 6.03 | 1.79 | 123.94 | 68.56 | 0.53 | 0.98 | 1.79 |
| CV | 0.30 | 0.29 | 0.54 | 0.47 | 0.15 | 0.30 | 0.10 |
Summary statistics of mpg and wt by am are presented in the following table.
| am | mpg | wt |
|---|---|---|
| 0 | 17.15 | 3.77 |
| 1 | 24.39 | 2.41 |
We modelled the fuel efficiency (mpg) to investigate the effect of:
weight of the car (wt) and
transmission type (am)
We fitted a linear regression model with wt and am as predictors.
The model also included the two-way interaction terms of wt and am.
fm.lm <- lm(mpg ~ wt + am + wt:am, data=DF)
summary(fm.lm)
Call:
lm(formula = mpg ~ wt + am + wt:am, data = DF)
Residuals:
Min 1Q Median 3Q Max
-3.6004 -1.5446 -0.5325 0.9012 6.0909
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 31.4161 3.0201 10.402 4.00e-11 ***
wt -3.7859 0.7856 -4.819 4.55e-05 ***
am1 14.8784 4.2640 3.489 0.00162 **
wt:am1 -5.2984 1.4447 -3.667 0.00102 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2.591 on 28 degrees of freedom
Multiple R-squared: 0.833, Adjusted R-squared: 0.8151
F-statistic: 46.57 on 3 and 28 DF, p-value: 5.209e-11
| Estimate | Std. Error | t value | Pr(>|t|) |
|---|---|---|---|
| 31.416055 | 3.020109 | 10.402291 | 0.000000 |
| -3.785908 | 0.785648 | -4.818836 | 0.000046 |
| 14.878423 | 4.264042 | 3.489277 | 0.001621 |
| -5.298360 | 1.444699 | -3.667449 | 0.001017 |
Model assumptions are checked by different plots of the residuals.
We observed that the two-way interaction effect of wt and am was significant.