简体   繁体   中英

How to change header names and note generated by stargazer?

How do I customize the header names "panel linear", "coefficient test"? In the package Stargzer?

I'm open to using another package as well to present panel model summary data results.

  library(stargazer)
  stargazer(random2, Rmodel3, 
      type='latex',header = FALSE,
      column.labels = c("RE", "RSE"))

在此处输入图片说明

A clean solution using stargazer for me is to set model.names = FALSE , and then adding, as you have done, column.labels .

# library;
library(stargazer)

# run some random models;
model_1 <- lm(
        mpg ~ am, data = mtcars
)

model_2 <- glm(
        mpg ~ cyl, data = mtcars
)



# Print stargazer output; 
stargazer(
        model_1, model_2,
        column.labels = c("\\textit{OLS}", "\\textit{MLE}"),
        model.names = FALSE,
        type = "text" # Remember to change this to 'latex'.
)

Which gives the following output

====================================================
                          Dependent variable:       
                    --------------------------------
                                  mpg               
                             OLS              MLE   
                             (1)              (2)   
----------------------------------------------------
am                         7.245***                 
                           (1.764)                  
                                                    
cyl                                        -2.876***
                                            (0.322) 
                                                    
Constant                  17.147***        37.885***
                           (1.125)          (2.074) 
                                                    
----------------------------------------------------
Observations                  32              32    
R2                          0.360                   
Adjusted R2                 0.338                   
Log Likelihood                              -82.653 
Akaike Inf. Crit.                           169.306 
Residual Std. Error    4.902 (df = 30)              
F Statistic         16.860*** (df = 1; 30)          
====================================================
Note:                    *p<0.1; **p<0.05; ***p<0.01

I'm a huge fan of stargazer , but it is, from time to time, tedious to work with.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM