#install.packages("car")
library(car)
model1<-lm(Temp ~ . , data = climate) # all the independent variables are numeric.
summary(model1) # Proper output
vif(model1)
I get an error and a warning when I execute the the vif(model1)
.
Error in as.vector(y) - mean(y) : non-numeric argument to binary operator
In addition: Warning message:
In mean.default(y) : argument is not numeric or logical: returning NA
I have gone through similar queries in stackoverflow. Most of them suggested to install car
package. I have done that still no luck.
str(climate)
'data.frame': 308 obs. of 9 variables:
$ MEI : num 2.556 2.167 1.741 1.13 0.428 ...
$ CO2 : num 346 346 344 342 340 ...
$ CH4 : num 1639 1634 1633 1631 1648 ...
$ N2O : num 304 304 304 304 304 ...
$ CFC.11 : num 191 192 193 194 194 ...
$ CFC.12 : num 350 352 354 356 357 ...
$ TSI : num 1366 1366 1366 1366 1366 ...
$ Aerosols: num 0.0863 0.0794 0.0731 0.0673 0.0619 0.0569 0.0524 0.0486 0.0451 0.0416 ...
$ Temp : num 0.109 0.118 0.137 0.176 0.149 0.093 0.232 0.078 0.089 0.013 ...