In: Statistics and Probability
z
Assuming that the response variable is Speed
Ans 6)
Cars1 <-
subset(Cars,Class=="Sub-Compact") ## subset
containing cars of class sub-compact
> Cars1[,2] <- as.factor(Cars1[,2])
> Cars1[,5]<- as.factor(Cars1[,5])
> mod2<- lm(Speed~Make+MPG+Transmission+Engine +
Cylinders)
> summary(mod2)
Call:
lm(formula = Speed ~ Make + MPG + Transmission + Engine +
Cylinders)
Residuals:
Min 1Q Median 3Q Max
-0.70194 -0.10354 -0.01130 0.08524 0.80506
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2.12243 0.46053 4.609 1.58e-05 *** ### 2.12243
is the slope for sub-compact car
MakeBMW 0.04804 0.17035 0.282 0.77870
MakeChevrolet -0.26716 0.17975 -1.486 0.14130
MakeEagle 0.04677 0.17839 0.262 0.79387
MakeFord -0.31796 0.18126 -1.754 0.08337 .
MakeHonda -0.02536 0.17341 -0.146 0.88413
MakeHyundai 0.02384 0.23699 0.101 0.92014
MakeJaguar 0.72729 0.32884 2.212 0.02995 *
MakeLexus 0.35012 0.25176 1.391 0.16833
MakeMercedes-Benz 0.80818 0.30904 2.615 0.01073 *
MakeMitsubishi 0.09942 0.15113 0.658 0.51261
MakeNissan -0.01780 0.19464 -0.091 0.92739
MakePontiac -0.29389 0.18837 -1.560 0.12282
MakeSAAB 0.07226 0.20038 0.361 0.71936
MakeSaturn -0.10018 0.20293 -0.494 0.62295
MakeSubaru -0.04091 0.20473 -0.200 0.84215
MakeSuzuki -0.07741 0.20674 -0.374 0.70911
MakeToyota -0.31808 0.21360 -1.489 0.14055
MakeVolkswagen 0.02384 0.23699 0.101 0.92014
MPG 0.02293 0.01055 2.174 0.03278 *
TransmissionL 0.68602 0.22895 2.996 0.00367 **
TransmissionM 1.75449 0.23252 7.545 7.60e-11 ***
Engine 0.25052 0.12627 1.984 0.05082 .
Cylinders -0.01389 0.08989 -0.155 0.87757
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard
error: 0.2709 on 77 degrees of freedom
Multiple R-squared: 0.8693, Adjusted R-squared:
0.8303
F-statistic: 22.27 on 23 and 77 DF, p-value: < 2.2e-16