gpt4 book ai didi

r - 使用 stargazer 添加一行注释

转载 作者:行者123 更新时间:2023-12-04 02:12:20 31 4
gpt4 key购买 nike

我想运行一些回归并使用 stargazer 创建一个表。例如

linear.1 <- lm(rating ~ complaints + privileges + learning + raises + critical, data=attitude)
linear.2 <- lm(rating ~ complaints + privileges + learning, data=attitude)
stargazer(linear.1, linear.2, type="text", keep.stat=c("n"))

对于某些规范,我想在表格中添加几行带有“X”的行。那是:
                                       rating                    
(1) (2)
-----------------------------------------------------------------
complaints 0.692*** 0.682***
(0.149) (0.129)

privileges -0.104 -0.103
(0.135) (0.129)

learning 0.249 0.238*
(0.160) (0.139)

raises -0.033
(0.202)

critical 0.015
(0.147)

Constant 11.011 11.258
(11.704) (7.318)

Note 1 X
Note 2 X
-----------------------------------------------------------------
Observations 30 30
=================================================================
Note: *p<0.1; **p<0.05; ***p<0.01

我怎样才能做到这一点?

谢谢!

最佳答案

stargazer(linear.1, linear.2, type="text", keep.stat=c("n"),  
add.lines=list(c("Note 1", "X", ""), c("Note 2", "", "X")))

有诀窍。

关于r - 使用 stargazer 添加一行注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26950517/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com