Dependent variable labels in asterisk tables

When passing the character vector into the argument dep.var.labelsbefore, stargazerI expected that the labels of the dependent variables would consist of this vector. But this only happens 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 various dependent variable labels, even if the models are of the same type?

+4
source share
1 answer

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

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")
+3
source

Source: https://habr.com/ru/post/1529100/


All Articles