使用stargazer添加一行注释

时间:2014-11-15 20:43:24

标签: r stargazer

我想运行一些回归并用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"))

我想在表中添加几行&#34; X&#34;对于某些规格。那就是:

                                       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 

我该怎么做?

谢谢!

1 个答案:

答案 0 :(得分:8)

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

诀窍。