Add a row with notes using stargazer
Asked Answered
E

1

16

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!

Enrique answered 15/11, 2014 at 20:43 Comment(2)
And this absolutelu must be this way, i.e. no footnote or table caption can be used? I would either edit the resulting LaTeX table manually or, if you need reproducible code, insert the necessary LaTeX code e.g. using gsub()Elmiraelmo
Has to be this way :(Enrique
E
15
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.

Enrique answered 17/11, 2014 at 18:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.