Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add a row with notes using stargazer

Tags:

r

stargazer

I want to run some regressions and create a table with stargazer. For example

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"))

I want to add a couple of rows the the table with "X" for some of the specifications. That is:

                                       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 

How can I do that?

Thanks!

like image 519
Ignacio Avatar asked Nov 15 '14 20:11

Ignacio


1 Answers

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

Does the trick.

like image 154
Ignacio Avatar answered Nov 17 '22 23:11

Ignacio