I am trying to find the VIFs for the Faraway package's divusa data using the following model. Any assistance in this matter is greatly appreciated.
Here is my code:
lmod <- lm(divorce ~ unemployed + femlab + marriage + birth + military, divusa)
summary(lmod)
x <- model.matrix(lmod)
head(x)
x <- model.matrix(lmod)[,-1]
head(x)
e <- eigen(t(x) %*% x)
e$val
sqrt(e$val[1]/e$val)
vif(x)
Here is the error I get every time I run my code.
Error: $ operator is invalid for atomic vectors