I am trying to use sjplot to create html tables for output for a glm (actually a mixed effects model, but I will keep it simple), and I can't figure out how to print estimates and se for predictors. Here is an example:
n <- 50
cov <- 10
x <- c(rep(0,n/2), rep(1, n/2))
p <- 0.4 0.2*x
y <- rbinom(n, cov, p)
ggplot(data.frame(x=factor(x),y=as.numeric(y)),
aes(x=x, y=y/cov))
geom_point(position=position_jitter(height=0.02, width=0.07))
xlab("x")
ylab("y/cov")
model0 <- glm(cbind(y, cov-y) ~ x, family="binomial")
summary(model0)
tab_model(model0,show.est = TRUE)
As you can see in the results, tab_model() doesn't print the estimates, only the odd ratio and CI for the odd ratio. Is it possible to do this in sjplot, or should I look elsewhere. I am basically just wanting to put the table into an rmarkdown, but find it to be a little more tricky than I expected.
CodePudding user response:
You need to include the argument transform = NULL
to prevent tab_model
from automatically exponentiating the estimates into odds ratios:
tab_model(model0, transform = NULL, show.est = TRUE, show.se = TRUE)