How do I use the anovalator command? (Stata 11) | Stata FAQ

The anovalator command refers to a mythical program that displays the results of an
estimation command in an anova-like manner, that is, separate multidegree of freedom tests for
main effects, two-way and 3-way interactions. In addition, anovalation will do tests of simple
main effects, pairwise comparisons and arbitrary linear contrasts.
You may download this program from the UCLA ATS
Statistical Consulting Group by typing the following two commands into Stata’s command window.

Now for a bunch of caveats. The anovalator program should be considered experimental in that
it has not been tested with every possible estimation command in Stata. In fact, it has been
tested a lot with only a handful of estimation procedures. It does not have a “true”
help file, just this web page. The program also does not do as much internal consistency checking
as it should. If you
enter information incorrectly it may not catch it and issue a warning, it may just crash.
You will then most likely
have to rerun your estimation command. anovalator will try to do what you request even if
it doesn’t make any sense. It just doesn’t know any better. Do not bother looking for the
return results as there aren’t any.
Further, anovalator does not
make any adjustments for multiple tests for pairwise comparisons or linear contrasts. This is left
up to the user. To sum it up, the user takes full responsibility for using the command correctly.
Please use it carefully.

After all of the above, why would anyone use this program? Well, it can be very useful in certain
situations. Everything that anovalator does can, of course, be done manually after running
the margins command with the post option. But, if you know what you are doing,
anovalator can get you the results you are interested in more easily and quicker than the
manual approach.

Why does anovalator do main effects and two-way interactions? These tests are needed because
factor variables in Stata 11 use indicator (dummy) coding for categorical predictor variables.
When using dummy coding in models with two-way or higher interactions the tests of the coefficients
are not the tests of the main effects. This is true even if the interactions are not significant.
In models with three-way interactions the tests of the interaction coefficients are not the same
as the test of the two-way interaction effect.

We can finally get on with the demonstration of anovalator on four different models.

Main effects, two-way interaction and tests of simple main effects with F-ratios

F statistics are exact for models in which the disturbances are assumed to be normally
distributed, as in the regression above. You can check the main effects and two-way
interaction results by running the command: anova write grp##female.

We will start with a contrast amont the levels of grp that is the average of 1 &
2 versus the average of
3 & 4. Please note: It is
up to you to make sure that the weights for the contrast sum to zero. There is no internal
checking.
The contrast will be followed by all pairwise comparisons for grp.

If you don’t want to see the table of adjusted group means from the margins
command, just use the quiet option.

Logit Model

Users need to exercise great care in using anovalator with nonlinear models to ensure that
they are testing what they really want to test. anovalator gives users the choice of
testing effects in the probability metric (the default) or in terms of log-odds using the
linear predictor xb. When working in the probability metric the effect of all covariates
need to be taken into account when estimating effects. After the logit model below we
run a series of anovalator commands first using predicted probabilites and then using
the linear prediction.