Consider a dataset mtcars This data has with 32 observations

Consider a dataset mtcars. This data has with 32 observations on 11 variables.

• mpg Miles/(US) gallon

• cyl Number of cylinders

• disp Displacement (cu.in.)

• hp Gross horsepower

• drat Rear axle ratio

• wt Weight (lb/1000)

• qsec 1/4 mile time

• vs V-engine or Straight-engine

• am Transmission (0 = automatic, 1 = manual)

• gear Number of forward gears

• carb Number of carburetors library(datasets) head(mtcars)

• a) Construct a model to predict whether the car has a V-engine or Straight-engine using its weight (wt) and displacement (disp).

• b) Calculate a null deviance and model deviance using the predicted probabilities, compare to the output of the glm function.

• c) Discuss the quality of regression model (chisquare test, residuals, odds, etc.)

• d) Predict the probability of having a V-engine for the car that has a weight of 2100 lbs and engine displacement of 180 cubic inches.

Solution

a) Coefficients:
(Intercept) wt disp
0.808237 0.184911 -0.004185

b)

lm(formula = v ~ w + d)

Residuals:
Min 1Q Median 3Q Max
-0.7136 -0.1804 0.1142 0.2112 0.6771

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.808237 0.264588 3.055 0.004795 **
w 0.184911 0.142300 1.299 0.204029
d -0.004185 0.001123 -3.726 0.000838 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.3565 on 29 degrees of freedom
Multiple R-squared: 0.5319, Adjusted R-squared: 0.4997
F-statistic: 16.48 on 2 and 29 DF, p-value: 1.657e-05

c) as R-sq value is 0.5319, so fit is more or less good

d)  0.808237 + 0.184911*(2.100) -0.004185 *(180)

=0.443

Consider a dataset mtcars. This data has with 32 observations on 11 variables. • mpg Miles/(US) gallon • cyl Number of cylinders • disp Displacement (cu.in.) •
Consider a dataset mtcars. This data has with 32 observations on 11 variables. • mpg Miles/(US) gallon • cyl Number of cylinders • disp Displacement (cu.in.) •

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site