Jeremy K.
Jeremy K.

Reputation: 1792

regression output tables with standard errors in a new column, with "Latex look" html output

When displaying tables of regressions (say with stargazer or texreg::htmlreg), is there a way where I can:

  1. Make the standard errors be displayed in a new, separate column next to the coefficient estimates?
  2. Have the output in html, while having the look of Latex produced tables (both stargazer and texreg::htmlreg do this, often referred to as "publication ready").

Desired output format: enter image description here

I've tried using:

Reproducible example below:

library(texreg)
library(stargazer)

mtcars
m1 <- lm(mpg ~ disp, data = mtcars)
m2 <- lm(mpg ~ disp + wt, data = mtcars)

htmlreg(list(m1, m2), file = "htmlreg_table.html", single.row = 1)
stargazer(m1, m2, out = "stargazer_table.html", single.row = TRUE)

As you can see, the output looks "publication ready", but the standard errors are in the same column, rather than in a new separate column.

I'm open to using any package, not only stargazer or texreg, which is why this question differs from: report regression result using stargazer to add separate column for standard error

enter image description here

Upvotes: 1

Views: 1763

Answers (1)

Marius
Marius

Reputation: 60060

I think sjPlot::tab_model() does a lot of what you want:

library(sjPlot)

tab_model(m1, m2, show.se = TRUE,
          dv.labels = c("Model 1", "Model 2"))

Output:

enter image description here

Upvotes: 2

Related Questions