The table I would like to have would be something formatted similar to this table from Lee et. al. 2004.
Array
The code I currently have is below here. It works to create a table but the columns and rows are rotated and I'm unable to report the number of effective observations for different bandwidths.
I used The Stata-to-LaTex Guide, regression table 5 as reference when trying to find a solution.
Code:
// directory setup: local root_dir //input desired directory cd "`root_dir'" // packages: ssc install estout, replace net install rdrobust, from(https://raw.githubusercontent.com/rdpackages/rdrobust/master/stata) replace //data: use "https://raw.githubusercontent.com/rdpackages/rdrobust/master/stata/rdrobust_senate.dta", clear //Rdrobust Regressions: eststo class_bwauto: rdrobust class margin, all eststo class_bw5: rdrobust class margin, all h(5 5) eststo class_bw10: rdrobust class margin, all h(10 10) eststo population_bwauto: rdrobust class margin, all eststo population_bw5: rdrobust class margin, all h(5 5) eststo population_bw10: rdrobust class margin, all h(10 10) // Table creation: esttab *_bwauto using "table.tex", replace f /// prehead(\begin{tabular}{l*{@M}{r}} \\\toprule) /// b(3) se(3) star(* 0.10 ** 0.05 *** 0.01) /// keep(Robust) varlabels(Robust " MSE-optimal bandwidth") /// label booktabs noobs nonotes collabels(none) /// alignment(D{.}{.}{-1}) esttab *_bw5 using "table.tex", append f /// b(3) se(3) star(* 0.10 ** 0.05 *** 0.01) /// keep(Robust) varlabels(Robust "Bandwidth = 5") /// label booktabs nodep nonum nomtitles nolines noobs nonotes collabels(none) /// alignment(D{.}{.}{-1}) esttab *_bw10 using "table.tex", append f /// postfoot(\bottomrule \end{tabular}) /// b(3) se(3) star(* 0.10 ** 0.05 *** 0.01) /// keep(Robust) varlabels(Robust "Bandwidth = 10", elist(Robust \bottomrule)) /// label booktabs collabels(none) nomtitles nolines nonum /// alignment(D{.}{.}{-1}) sfmt(%6.0fc)
0 Response to Creating RDD Tables with Rdrobust and Estout Packages
Post a Comment