Multiple Regression
with data in car.txt
> d<-read.table("car.txt",
header=TRUE)
> d
MAKE.MODEL VOL HP MPG SP WT
1 GM/GeoMetroXF1 89 49 65.4 96 17.5
2 GM/GeoMetro 92 55 56.0 97 20.0
3 GM/GeoMetroLSI 92 55 55.9 97 20.0
…
81 BMW750IL 119 295 16.7 157 45.0
82 Rolls-RoyceVarious 107 236 13.2 130 55.0
> regout<-lm(MPG~VOL+HP+SP+WT,d)
> summary(regout)
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 192.43775 23.53161 8.178 4.62e-12 ***
VOL -0.01565 0.02283 -0.685 0.495
HP 0.39221 0.08141 4.818 7.13e-06 ***
SP -1.29482 0.24477 -5.290 1.11e-06 ***
WT -1.85980 0.21336 -8.717 4.22e-13 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 3.653 on 77 degrees of freedom
Multiple R-Squared: 0.8733, Adjusted R-squared: 0.8667
F-statistic: 132.7 on 4 and 77 DF, p-value: < 2.2e-16
> regout<-lm(MPG~HP+SP+WT,d)
> summary(regout)
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 194.12962 23.32213 8.324 2.22e-12 ***
HP 0.40518 0.07891 5.135 2.03e-06 ***
SP -1.32000 0.24118 -5.473 5.19e-07 ***
WT -1.92210 0.19238 -9.991 1.31e-15 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 3.64 on 78 degrees of freedom
Multiple R-Squared: 0.8725, Adjusted R-squared: 0.8676
F-statistic: 177.9 on 3 and 78 DF, p-value: < 2.2e-16
>plot(d)

> regout4<-lm(m~s+h)
> regout5<-lm(m~s)
> summary(regout4)
Call:
lm(formula = m ~ s + h)
Residuals:
Min 1Q Median 3Q
Max
-10.542
-2.966 -1.788 1.158
22.268
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -18.53584
14.30131 -1.296 0.199
s 0.81230 0.16854
4.820 6.84e-06 ***
h
-0.33292 0.04162 -7.998 8.78e-12 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 5.462 on 79 degrees of freedom
Multiple R-Squared: 0.7093, Adjusted R-squared: 0.702
F-statistic: 96.4 on
2 and 79 DF, p-value: < 2.2e-16
> summary(regout5)
Call:
lm(formula = m ~ s)
Residuals:
Min 1Q Median 3Q
Max
-12.066
-4.961 -1.015 4.257
23.564
Coefficients:
Estimate
Std. Error t value Pr(>|t|)
(Intercept) 88.93774
6.54647 13.59 < 2e-16 ***
s
-0.49065 0.05779 -8.49 8.84e-13 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 7.301 on 80 degrees of freedom
Multiple R-Squared: 0.474, Adjusted R-squared: 0.4674
F-statistic: 72.08 on 1 and 80 DF, p-value:
8.837e-13
>