I try to export my summary statistics, the correlation table and my regressions with the esttabs functions. So far, I have figured out how they work and my results look quite appealing. However, there are too minor things, I would like to do.
1. I was asked to combine the summary statistics and the correlation matrix in one table.
2. The correlations between the same variables should not be displayed as they are 1 anyways (e.g. Age correlated with Age = 1 and should not be displayed in the output).
The table below should illustrate what I am trying to do. (Ideally the 1s are also not displayed)
| N | Mean | SE | Var1 | Var2 | Var3 | Var4 | |
| Var1 | 1000 | 500 | 25 | 1 | |||
| Var2 | 1000 | 4 | 1 | 0.7 | 1 | ||
| Var3 | 1000 | 497 | 12 | 0.2 | 0.5 | 1 | |
| Var4 | 1000 | 9345 | 124 | 0.08 | 0.4 | 0.5 | 1 |
Code:
** Set variables used in Summary and Correlation (NOTE: coeflabel has to be adjusted if changes are made)
local variables [Variable Names]
** Descriptive statistics
eststo clear
estpost summarize `variables'
esttab using Summary.rtf, ///
replace ///
cell((count(fmt(%9.0f) label(Count)) mean(fmt(%9.2f) label(Mean)) sd(fmt(%9.2f) label(Standard Deviation)) min(fmt(%9.2f) label(Min)) max(fmt(%9.2f) label(Max)))) ///
coeflabel([Variable Names]) ///
nonumbers ///
title("Summary Statistics")
eststo clear
** Correlation matrix
eststo clear
estpost correlate `variables', matrix
eststo corrtr
esttab using Correlation.rtf, ///
replace ///
unstack ///
not noobs ///
compress ///
coeflabel([Variable Names]) ///
nomtitles eqlabels("(1)" "(2)" "(3)" "(4)" "(5)" "(6)" "(7)" "(8)" "(9)" "(10)" "(11)" "(12)") ///
b(%9.2f) ///
star (* 0.10 ** 0.05 *** 0.01) ///
nonumbers ///
title ("Correlation Table")
eststo clear
0 Response to Esttab: Combining summary statistics and correlation table
Post a Comment