Skip to content

Instantly share code, notes, and snippets.

@arimitramaiti
Created July 31, 2021 10:24
Show Gist options
  • Save arimitramaiti/3c81a3aa99c82b8379c062e51d00c945 to your computer and use it in GitHub Desktop.
Save arimitramaiti/3c81a3aa99c82b8379c062e51d00c945 to your computer and use it in GitHub Desktop.
```{r echo=FALSE, results='asis'}
library("rmarkdown")
library("tinytex")
library("stargazer")
library("sandwich")
m1 = lm(drat~ disp + hp + wt, data = mtcars)
m2 = lm(mpg~ disp + hp + wt, data = mtcars)
model.lst = list(m1, m2)
stargazer(m1,
m2,
title="Displaying results for multiple response variables",
type = "latex",
float = TRUE,
report = "vcs*",
se=lapply(model.lst, function(x) sqrt(diag(vcovHC(x, type = "HC1")))),
no.space = TRUE,
header=FALSE,
single.row = TRUE,
font.size = "small",
intercept.bottom = F,
covariate.labels = c("Displacement (cu.in.)", "Gross horsepower", "Weight (lb/1000)"),
column.labels = c("Rear axle ratio", "Miles per gallon"),
column.separate = c(1, 1),
digits = 2,
t.auto = F,
p.auto = F,
notes.align = "l",
notes = c("datasets::mtcars", "lm() function with Robust SE"),
notes.append = TRUE
)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment