In: Math
The data provided give the gasoline mileage (in miles per gallon) based on the horsepower of a car's engine and the weight of the car (in pounds). Using the data provided, determine the VIF for each independent variable in the model. Is there reason to suspect the existence of collinearity?
Determine the VIF for each independent variable in the model.
MPG |
Horsepower |
Weight |
|
15.8 |
185 |
4,758 |
|
19.7 |
106 |
3,534 |
|
20.3 |
141 |
3,220 |
|
18.8 |
172 |
4,466 |
|
17.3 |
166 |
4,293 |
|
27.5 |
75 |
3,186 |
|
44.8 |
60 |
2,110 |
|
27.3 |
79 |
2,487 |
|
28.2 |
83 |
2,610 |
|
21.2 |
134 |
3,868 |
Round to three decimal places as needed.
use lm function in R fit a linear regression of MPG on Horsepower and weight
Then install library package and use vif function to get the multicollinearity.
Rcode:
MPG <-
c(15.8,19.7,20.3,18.8,17.3,27.5,44.8,27.3,28.2,21.2)
Horsepower <- c(185,106,141,172,166,75,60,79,83,134)
weight <-
c(4758,3538,3220,4466,4293,3186,2110,2487,2610,3868)
MPG
Horsepower
weight
linmod <- lm(MPG~Horsepower+weight)
coefficients(linmod)
library(car)
car::vif(linmod)
From output:
VIF for each independent variable in the model.
VIF1=7.307
VIF2=7.307
since VIF>5
Yes,there is a problem with multicollinearity.