Dependent variable labels in stargazer tables
Asked Answered
O

1

8

When passing a character vector to the dep.var.labels argument to stargazer, I expected the dependent variable labels to consist of this vector. But this only seems to happen when the models are of different types.

data(mtcars)
m0 <- lm(mpg ~ hp, data=mtcars)
m1 <- lm(mpg ~ wt, data=mtcars)
m2 <- glm(cyl ~ disp, data=mtcars)

## Only shows the label 'foo' for both models.
stargazer(m0, m1, dep.var.labels=c('foo','bar'))

## shows 'foo' and 'bar' as labels.
stargazer(m0, m2, dep.var.labels=c('foo','bar'))

How can I get stargazer to show different dependent variable labels even when the models are of the same type?

Oubre answered 27/2, 2014 at 0:19 Comment(0)
O
8

stargazer uses the same dependent variable because your dependent variables are the same, not because you are using the same kind of statistical model. You may be interested in using the column.labels argument:

data(mtcars)
m0 <- lm(mpg ~ hp, data=mtcars)
m1 <- lm(mpg ~ wt, data=mtcars)
m2 <- glm(cyl ~ disp, data=mtcars)

## Only shows the label 'foo' for both models.
stargazer(m0, m1, column.labels=c('foo','bar'), type="text")

## shows 'foo' and 'bar' as labels.
stargazer(m0, m2, column.labels=c('foo','bar'), type="text")
Office answered 27/2, 2014 at 16:5 Comment(1)
Is there a way to include bars below the column labels? It would easily visualize the groups.Flocculus

© 2022 - 2024 — McMap. All rights reserved.