Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding custom column to regression table (tab_model, sjplot)?

Tags:

r

regression

I'd like to add my own column containing VIF values to a regression table that I've made with the tab_model() function in the sjplot package.

Here's an example of what I'm trying to do:

log_fit <- glm(Sepal.Length ~ ., data = iris)
require(sjplot)
tab <- tab_model(log_fit)
require(car)
VIF_vals <- vif(log_fit)

I'd like to add the VIF_vals$GVIF data as a column to the tab object, with each VIF value in the row corresponding to the same IV (e.g. Sepal Width, Petal Length, etc. etc.)

like image 582
pfadenhw Avatar asked Aug 10 '26 10:08

pfadenhw


1 Answers

I've found that this can be done with a different function and package: summ() function in the jtools package by setting vifs = TRUE.

However, I'd still prefer to use the tab_model() function instead since it has the appropriate R-squared value I want (Tjur), makes the confidence intervals look nicer, and has the option of including the deviance.

like image 133
pfadenhw Avatar answered Aug 14 '26 05:08

pfadenhw