Tab_model robust confidence intervals not adjusted for robust std error in glm
handler10 opened this issue · comments
Hi, I am running logistic, poisson, and negative binomial regression models and using tab_model to display results. It seems that when I use the robust options that the SE is correct but the confidence intervals displayed are not (they are the same as using the naive SE).
Below is some code to replicate. Am i doing something wrong? Thanks,
#-----------------------------------------------------------------------------
Load the required packages
#-----------------------------------------------------------------------------
require(foreign)
require(sandwich)
library(tidytidbits)
library(lmtest)
#-----------------------------------------------------------------------------
Load the data
#-----------------------------------------------------------------------------
dat<-read.dta("https://stats.idre.ucla.edu/stat/stata/faq/proportion.dta")
#-----------------------------------------------------------------------------
Fit the glm
#-----------------------------------------------------------------------------
fitglm <- glm(meals ~ yr_rnd + parented + api99, family = binomial(logit), data = dat)
#-----------------------------------------------------------------------------
Output of the model
#-----------------------------------------------------------------------------
summary(fitglm)
#-----------------------------------------------------------------------------
Show tab_model output for logistic model
#-----------------------------------------------------------------------------
sjPlot::tab_model(fitglm, vcov.fun = "HC", vcov.args = list(type="HC1"), transform = NULL, show.se = T)
standard error in tab_model matches robust SE but Confidence intervals use non-robust standard error.
#non-robust
coeftest(fitglm )
coefci(fitglm )
#robust
coeftest(fitglm, vcov. = cov.m1)
coefci(fitglm, vcov. = cov.m1)
#also, seems like model_parameters
parameters::model_parameters(fitglm, robust=T)