calc_vif | R Documentation |
Calculates variance-inflation linear, generalized linear, and other models.
I found this function on
StackOverflow
The function vif
from the car
package would be my preference but I wanted to
put this one somewhere for posterity.
calc_vif(fit)
fit |
An |
A tbl_df
library(car)
# Using the car package
car::vif(lm(prestige ~ income + education, data = Duncan))
car::vif(lm(prestige ~ income + education + type, data = Duncan))
# User defined function
calc_vif(lm(prestige ~ income + education, data = Duncan))
calc_vif(lm(prestige ~ income + education + type, data = Duncan))
# Another example using glm
model1 <- glm(case ~ spontaneous + induced,
data = infert,
family = binomial(link = "logit"))
summary(model1)
car::vif(model1)
calc_vif(model1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.