VIF | 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. Usually values higher than 10 (around), mean a 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 'data.table' 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. This variable is taken into account only for getting complete cases. |
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
VIF(data.frame)
:
VIF(data.table)
:
VIF(matrix)
:
vif_corrected = vif_basic^(1/(2*df))
fill_NA
fill_NA_N
## Not run: library(miceFast) library(data.table) airquality2 <- airquality airquality2$Temp2 <- airquality2$Temp**2 airquality2$Month <- factor(airquality2$Month) 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.V1"]] data_DT[, .(vifs = VIF( x = .SD, posit_y = 1, posit_x = c(2, 3, 4, 5, 6, 7), correct = TRUE ))][["vifs.V1"]] ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.