Stata 12 has two new commands for performing all pairwise comparisons of
means and other margins across the levels of categorical variables. The
pwmean command provides a simple syntax for computing all pairwise
comparisons of means. After fitting a model with almost any estimation
command, the pwcompare command can perform pairwise comparisons of
estimated marginal means and other types of marginal linear predictions. In
addition, the margins command now allows for performing all pairwise
comparisons of linear and nonlinear predictions, such as marginal
probabilities. With each of these commands, p-values and confidence
intervals can be adjusted for multiple comparisons.
To obtain all pairwise differences of the mean of y across the levels
of a treatment and adjust the p-values and confidence intervals for
multiple comparisons using Tukey’s HSD, we can type
If treatment=1 is a control and the other levels represent
treatments, we may want to use Dunnett’s method for making comparisons.
After fitting a model, we can use pwcompare to make pairwise
comparisons of the margins. We could fit the fully interacted model
. regress y treatment##grp
and obtain pairwise comparisons of all the cell means for the interaction.
Because there are many pairwise comparisons, we obtain the results of the
tests symbolically. Two means that have the same letter are not
significantly different from each other at a 5% significance level.
Back to highlights
New in Stata 12
for more about what was added in Stata Release 12.