VIF: 'VIF' function for assessing VIF.

Description Usage Arguments Value See Also Examples

View source: R/RcppExports.R

Description

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.

Usage

1
VIF(x, posit_y, posit_x)

Arguments

x

a numeric matrix - a numeric matrix with variables

posit_y

an integer - a position of dependent variable

posit_x

an integer vector - positions of independent variables

Value

load a numeric vector with VIF for all variables provided by posit_x

See Also

fill_NA fill_NA_N

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
## 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)
# VIF for variables at 1,3,4 positions - you include a y position to consider its NA values
data_DT[,.(vifs=VIF(x=as.matrix(.SD),
                    posit_y=1,
                    posit_x=c(2,3,4,5,6,7)))]

######################
#OR using OOP miceFast
######################

airquality2_mat = as.matrix(airquality2)
model = new(miceFast)
model$set_data(airquality2_mat)

as.vector(model$vifs(1,c(2,3,4,5,6,7)))


## End(Not run)

miceFast documentation built on May 7, 2018, 1:03 a.m.