新浪博客

Labels, titles, and notes

Basic syntax and usage

esttab is a wrapper for estout. Its syntax is much simpler than that of estout and, by default, it produces publication-style tables that display nicely in Stata's results window. The basic syntax of esttab is:
esttab [ namelist ] [ using filename ] [ , options estout_options ]
The procedure is to first store a number of models and then apply esttab to these stored estimation sets to compose a regression table. The main difference between esttab andestout is that esttab produces a fully formatted right away. Example:
. sysuse auto (1978 Automobile Data) . eststo: quietly regress price weight mpg (est1 stored) . eststo: quietly regress price weight mpg foreign (est2 stored) . esttab -------------------------------------------- (1) (2) price price -------------------------------------------- weight 1.747** 3.465*** (2.72) (5.49) mpg -49.51 21.85 (-0.57) (0.29) foreign 3673.1*** (5.37) _cons 1946.1 -5853.7 (0.54) (-1.73) -------------------------------------------- N 74 74 -------------------------------------------- t statistics in parentheses * p<0.05, ** p<0.01, *** p<0.001 . eststo clear
[do-file]
Note that the dashed lines appear as solid lines in Stata's results window:
esttab001.png

Standard errors, p-values, and summary statistics

The default in esttab is to display raw point estimates along with t statistics and to print the number of observations in the table footer. To replace the t-statistics by, e.g., standard errors and add the adjusted R-squared type:
. sysuse auto (1978 Automobile Data) . eststo: quietly regress price weight mpg (est1 stored) . eststo: quietly regress price weight mpg foreign (est2 stored) . esttab, se ar2 -------------------------------------------- (1) (2) price price -------------------------------------------- weight 1.747** 3.465*** (0.641) (0.631) mpg -49.51 21.85 (86.16) (74.22) foreign 3673.1*** (684.0) _cons 1946.1 -5853.7 (3597.0) (3377.0) -------------------------------------------- N 74 74 adj. R-sq 0.273 0.478 -------------------------------------------- Standard errors in parentheses * p<0.05, ** p<0.01, *** p<0.001
[do-file]
The t-statistics can also be replaced by p-values (p), confidence intervals (ci), or any parameter statistics contained in the estimates (see the aux() option). Further summary statistics options are, for example, pr2 for the pseudo R-squared and bic for Schwarz's information criterion. Moreover, there is a generic scalars() option to include any other scalar statistics contained in the stored estimates. For instance, to print p-values and add the overall F-statistic and information on the degrees of freedom, type:
. esttab, p scalars(F df_m df_r) -------------------------------------------- (1) (2) price price -------------------------------------------- weight 1.747** 3.465*** (0.008) (0.000) mpg -49.51 21.85 (0.567) (0.769) foreign 3673.1*** (0.000) _cons 1946.1 -5853.7 (0.590) (0.087) -------------------------------------------- N 74 74 F 14.74 23.29 df_m 2 3 df_r 71 70 -------------------------------------------- p-values in parentheses * p<0.05, ** p<0.01, *** p<0.001 . eststo clear
[do-file]

Beta coefficients

To display beta coefficients and suppress the t-statistics type:
. sysuse auto (1978 Automobile Data) . eststo: quietly regress price weight mpg (est1 stored) . eststo: quietly regress price weight mpg foreign (est2 stored) . esttab, beta not -------------------------------------------- (1) (2) price price -------------------------------------------- weight 0.460** 0.913*** mpg -0.097 0.043 foreign 0.573*** -------------------------------------------- N 74 74 -------------------------------------------- Standardized beta coefficients * p<0.05, ** p<0.01, *** p<0.001 . eststo clear
[do-file]

Wide table: coefficients and t-statistics side-by-side

The wide option arranges point estimates and t-statistics beside one another instead of beneath one another:
. sysuse auto (1978 Automobile Data) . eststo: quietly regress price weight mpg (est1 stored) . eststo: quietly regress price weight mpg foreign (est2 stored) . esttab, wide ---------------------------------------------------------------------- (1) (2) price price ---------------------------------------------------------------------- weight 1.747** (2.72) 3.465*** (5.49) mpg -49.51 (-0.57) 21.85 (0.29) foreign 3673.1*** (5.37) _cons 1946.1 (0.54) -5853.7 (-1.73) ---------------------------------------------------------------------- N 74 74 ---------------------------------------------------------------------- t statistics in parentheses * p<0.05, ** p<0.01, *** p<0.001 . eststo clear
[do-file]

Numerical formats

esttab has sensible default settings for numerical display formats. For example, t-statistics are printed using two decimal places and R-squared measures are printed using three decimal places. For point estimates and, for example, standard errors an adaptive display format is used where the number of displayed decimal places depends on the scale of the statistic to be printed (the default format is a3; see below).
The format applied to a certain statistic can be changed by adding the appropriate display format specification in parentheses. For example, to increase precision for the point estimates and display p-values and the R-squared using four decimal places, type:
. sysuse auto (1978 Automobile Data) . eststo: quietly re

我的更多文章

下载客户端阅读体验更佳

APP专享