1

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:

  • single.row = TRUE but that puts the standard errors into the same cell, not a new column.

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

Jeremy K.
  • 1,710
  • 14
  • 35

1 Answers1

2

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

Marius
  • 58,213
  • 16
  • 107
  • 105
  • That's a great solution. You wouldn't know how I could separate the R^2 and R^2 adjusted, onto two separate lines, would you? I asked before, but haven't found a solution https://stackoverflow.com/questions/57505167/sjplottab-model-summary-statistics-reordering-and-splitting-of-r-squared-a – Jeremy K. Aug 21 '19 at 03:55
  • 1
    No way that I know of, `tab_model` has a lot of options but once you exhaust them I think there's not much you can do to change the layout. – Marius Aug 21 '19 at 04:08