15

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

我怎样才能做到这一点?

谢谢!

4

1 回答 1

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

行得通。

于 2014-11-17T18:31:31.277 回答