0

I want to export the summary() function of several regressions into a summary table. Normally I use stargaze.

The problem is: I calculated Heteroskedasticity Robust Standard errors which are shown by using a special summary function (e.g. "summary(fit5, robust=TRUE)") - but how can I export the result of this summary table into an export table? Thank you very much for your help!

Nothing worked so far. Until now I used the export type text and overwrote the values...

Thomas
  • 1
  • 1
  • 2
    Welcome to stack. Could you share a reproducible data, along with the code you've tried, and show us how you want the data to look. – Jim O. Jun 10 '19 at 21:32
  • Hi Jim, thank you for your reply. That's some sample code using cars data: fit <- lm(dist ~ speed, data=cars) summary(fit) summary(fit, robust=TRUE) I used the Guide from this side: https://economictheoryblog.com/2016/08/08/robust-standard-errors-in-r/ Usually I would create a summary table by stargazer(fit, fit1, fit1, title="Regression Results", align=TRUE, dep.var.labels=c("depVar"), covariate.labels=c("label1", "label2", "and so on"), – Thomas Jun 11 '19 at 04:18

2 Answers2

0

tidy from the broom package will give you a tibble with your regression coefficients:

library(broom)

fit <-lm(dist ~ speed, data = cars)

summary(fit) %>%
  tidy()

# A tibble: 2 x 5
  term        estimate std.error statistic  p.value
  <chr>          <dbl>     <dbl>     <dbl>    <dbl>
1 (Intercept)   -17.6      6.76      -2.60 1.23e- 2
2 speed           3.93     0.416      9.46 1.49e-12
Paul
  • 2,877
  • 1
  • 12
  • 28
  • Hi Paul, thank you for your answer! Unfortunately it does not solve my problem. I try to restate it: I have several regressions which I want to export into one summary statistics, e. g. like described here: https://cran.r-project.org/web/packages/stargazer/vignettes/stargazer.pdf But unfortunately I don't need the standard summary(my_reg) but the summary(my_reg, robust=TRUE) - I need to show the Heteroskedasticity Robust Standard Errors in my output table which I import into Latex – Thomas Jun 11 '19 at 10:34
0

For those of you interested in the answer! I found this tutorial: https://economictheoryblog.com/2018/05/18/cluster-robust-standard-errors-in-stargazer/

Nevertheless, thanks to all of you who tried to help!

Thomas
  • 1
  • 1
  • Can you include the relevant information directly in your answer? The idea is that answers on stackoverflow should be self-contained to make sure they will still be helpful in case the external link is no longer reachable. – samcarter_is_at_topanswers.xyz Jun 12 '19 at 08:11