简体   繁体   中英

Replicating professional tables with stargazer

I have some issues with the stargazer module. I am trying to do replication studies for my BA thesis and I want to match the table layouts of the papers.

There are 2 things I want to do a) Omit the variable pop_gg and put in a line at the bottom that just says “yes”, as in it is included in the regression b) I am having trouble getting my stargazer code to include clustered standard errors for each of my 3 models, whenever I put it in, it will only ever accept 1 of the models SE

stargazer::stargazer(model1, model2, model3, se= se_model1, omit ="pop_gg"

I need a table that resembles the common paper layout as I wrote above

Here is how I would do it:

stargazer::stargazer(model1, model2, model3, se= list(se_model1, se_model2, se_model3), omit =c("pop_gg","Constant"), add.lines = list(c("pop_gg", "Yes", "No”)))

So for your understanding:

  • For a) you omitted “pop_gg” and then you can either do it using the omit.labels command or as I did it, simply with additional lines at the bottom. In this case I add.lines then c for a column than consists of the variable name and then “Yes” and “No” depending on whether or not each model has this variable. In most papers it is included in some but not all models.

  • For b) I am going to assume each model has different standard errors, so you need to put se=list(and here a list of all se_modelX) separated by a comma. You need to estimate the SE for each model separately in R and create them, just like you did the models, in the global environment.

Hope that helps

Alex

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