I am trying to run the vif function (lowercase letters) in rstudio using the data frame below but I keep getting an error stating
Error in y[, i] : incorrect number of dimensions
What am I doing wrong? Why is the vif function giving me the error?
What I have already tried is the code below.
library(usdm) # needed for vif function
x1 <- c(1,2,3,4,5)
x2 <- c(6,7,8,9,10)
x3 <- c(11,12,13,14,15)
y <- c(44,55,66,77,88)
dataFrame = data.frame(x1,x2,x3,y)
vif(dataFrame)
The expected results should be a table such as,
Variables VIF
1 x1 9.294002
2 x2 3.324287
3 x3 5.665959
4 Y 12.011500
Note: in this case all the numbers in the VIF column are just picked at random by me.