使用stata,ttest
estpost ttest varlist [if] [in], by(groupvar) [ unequal welch listwise
casewise quietly esample ]
posts two-group mean-comparison tests computed by ttest.
Options are:
by(), unequal, and welch as described in help ttest.
listwise to handle missing values through listwise deletion, meaning
that an observation is omitted from the estimation sample if any
of the variables in varlist is missing for that observation. The
default is to determine the used observations for each variable
separately without regard to whether other variables are missing.
casewise is a synonym for listwise.
quietly to suppress the output.
esample to mark the estimation sample in e(sample).
The following results vectors are saved in e():
e(b) mean difference
e(count) number of observations
e(se) standard error of difference
e(t) t statistic
e(df_t) degrees of freedom
e(p_l) lower one-sided p-value
e(p) two-sided p-value
e(p_u) upper one-sided p-value
e(N_1) number of observations in group 1
e(mu_1) mean in group 1
e(N_2) number of observations in group 2
e(mu_2) mean in group 2