将字符向量传递给dep.var.labels
参数到stargazer
时,我希望因变量标签由此向量组成。但是,当模型属于不同类型时,这似乎才会发生。
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'))
即使模型属于同一类型,我怎样才能让观星者显示不同的因变量标签呢?
答案 0 :(得分:3)
stargazer
使用相同的因变量,因为您的因变量是相同的,而不是因为您使用相同类型的统计模型。您可能对使用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")