Ttytamaki
Ttytamaki

Reputation: 95

Add Random Effects to Stargazer table

I have a Mixed-effects model and I want to use stargazer to create a regression table including the Random Effects part.

I can get something similar using either sjPlot::tab_model() or texreg::texreg(), but I really wanted to know if there's a way to make it using stargazer.

Thanks in advance!

Example:

library(stargazer)
library(sjPlot)
library(texreg)

mtcars$cyl <- as.factor(mtcars$cyl)

# Fit the mixed-effects model
model <- lmer(mpg ~ hp + (1 | cyl), data = mtcars)

summary(model)

# Stargazer does not display the random effects:
stargazer(model, 
          type = "text",
          star.cutoffs = c(0.1, 0.05, 0.01, 0.001),
          star.char = c("+", "*", "**", "***"),
          notes = c("Odds w/ 95% CIs in (parentheses) + p<0.1; * p<0.05; ** p<0.01; *** p<0.001"),
          notes.append=F, align = T, ci = T)

# (sjPlot) tab_model() does:
tab_model(model)

# And so does (texreg) texreg():
texreg(model, ci.force = T)

Upvotes: 1

Views: 84

Answers (0)

Related Questions