In my paper on the impact of the shale oil and gas boom in the US, I run various instrumental variables specifications. For these, it is nice to stack the regression results one on the other – in particular, to have one row for the IV results, one row for the Reduced Form and maybe one row for plain OLS to see how the IV may turn coefficients around.
I found that as of now – there is no way to do that directly; please correct me if I am wrong.
The layout I have in mind is as in the screenshot of my table.
In Stata, this can be accomplished through the use of esttab with the fragment, and append feature. This appends successive rows to an existing table and you can label the rows using the “refcat” option.
However, in R this is not possible as of yet. I have mainly worked with stargazer, as Marek has added felm objects for high dimensional fixed effects to be handled by his stargazer package.
The following functions are a “hack” that extracts the particular rows from the generated latex code by the stargazer package.
You can then piece the table together by combining the individual elements. The idea is that you have a single stargazer command that is passed to the various functions that extract the different features. Obviuously, this can be done a lot more elegant as the code is extremely hacky, but it does work
Marek has said that he is thinking of incorporating a stacking option into stargazer, but for now, my hack works reasonably well. The key thing to realise is that stargazer calls have the option to return
The following character strings can be used in the table.layout and omit.table.layout arguments of the stargazer command.
| “-” | single horizontal line |
| “=” | double horizontal line |
| “-!” | mandatory single horizontal line |
| “=!” | mandatory double horizontal line |
| “l” | dependent variable caption |
| “d” | dependent variable labels |
| “m” | model label |
| “c” | column labels |
| “#” | model numbers |
| “b” | object names |
| “t” | coefficient table |
| “o” | omitted coefficient indicators |
| “a” | additional lines |
| “n” | notes |
| “s” | model statistics |
The following functions will simply extract the rows that are being returned.
I know the solution is a bit hacky, but it works and does the trick.