VIF {miceFast} | R Documentation |
VIF
function for assessing VIF.VIF measure how much the variance of the estimated regression coefficients are inflated. It helps to identify when the predictor variables are linearly related. You have to decide which variable should be delete. Values higher than 10 signal a potential collinearity problem.
VIF(x, posit_y, posit_x, correct = FALSE) ## S3 method for class 'data.frame' VIF(x, posit_y, posit_x, correct = FALSE) ## S3 method for class 'matrix' VIF(x, posit_y, posit_x, correct = FALSE)
x |
a numeric matrix or data.frame/data.table (factor/character/numeric) - variables |
posit_y |
an integer/character - a position/name of dependent variable |
posit_x |
an integer/character vector - positions/names of independent variables |
correct |
a boolean - basic or corrected - Default: FALSE |
load a numeric vector with VIF for all variables provided by posit_x
data.frame
:
matrix
:
vif_corrected = vif_basic^(1/(2*df))
## Not run: library(miceFast) library(data.table) airquality2 = airquality airquality2$Temp2 = airquality2$Temp**2 #install.packages("car") #car::vif(lm(Ozone ~ ., data=airquality2)) data_DT = data.table(airquality2) data_DT[,.(vifs=VIF(x=.SD, posit_y='Ozone', posit_x=c('Solar.R','Wind','Temp','Month','Day','Temp2'), correct=FALSE))][['vifs']] data_DT[,.(vifs=VIF(x=.SD, posit_y=1, posit_x=c(2,3,4,5,6,7), correct=TRUE))][['vifs']] ## End(Not run)