* descriptive statistics:summarize x1 summarize x1, detail /* 5 number summary */ stem x1 /* stem & leaf diagram */ graph x1, normal /* histogram */ lv x1 /* letter-value table */ tabulate x1 /* one-way table */ tabulate x1 x2 /* two-way table */ table x1, by(x2) contents(mean y sd y)
* one sample:
ttest y = 10 /* single sample t-test */ signtest y = 10 /* sign test */
* two dependent groups:
ttest post = pre /* dependent t-test */ signrank post = pre /* Wilcoxen signed-rank test */
* two independent groups:
ttest y, by(grp) /* independent t-test equal variances */ ttest y, by(grp) unequal /* independent t-test unequal variances */ ranksum y, by(grp) /* Wilcoxen rank-sum (Mann-Whitney) test */ hotel y1 y2 y3, by(grp) /* Hotelling’s T2 */
* multiple groups:
oneway y grp, tabulate sidak /* one-way anova */ anova y grp /* one-way anova */ kwallis drink, by(grtp) /* Kruskal-Wallis test */
test a, error(a*b)
* regression:
correlate y x1 x2 x3 regress y x1 x2 x3 logistic y x1 fit y x1 x2 x3 test x1 predict yhat /* predicted score */ predict sresid, rstandard /* standardized residuals */ rvfplot /* residual vs predicted */ rvpplot x1 /* residual vs IV */ avplot /* added-variable plot (partial plot) */ avplots /* added-variable plots (partial plots) */ lvr2plot /* leverage to squared resid plot */ vif /* variance inflation factor */ correlate, _coef
* seemingly unrelated regression:
An economic model may contain a number of linear equations. It may be unrealistic to expect that the equation errors will be uncorrelated. A set of equations that has contemporaneous cross-equation error correlation is called a seemingly unrelated regression (SUR) system. At first look the equations seem unrelated, but the equations are related through the correlation in the errors.
use hsb2 sureg (read gender ses ss)(math gender ses sci)
* compare to regular regression regress read gender ses ss regress math gender ses sci