ANOVA / ANCOVA
- Balanced and unbalanced designs
- Missing cells
- Factorial, nested, and mixed designs
- Repeated measures
- Box, Greenhouse–Geisser, and Huynh–Feldt corrections
Afifi and Azen (1979) fitted a model of the change in systolic blood
pressure for 58 patients, each suffering from one of three diseases, who
were randomly assigned one of four different drug treatments:
An important feature of Stata is that it does not have modes or modules.
You do not enter the ANOVA module to fit an ANOVA model, but you simply type
the command. The advantage in this is that Stata’s other commands can be
interspersed to help you better understand these data. For instance, the
data here are almost balanced, as revealed by Stata's table command:
table can also be used to help you better understand the relationship
of the increase in blood pressure by drug and disease:
The test command allows you to perform tests directly on the
coefficients of the underlying regression model. For instance, we can test
if the coefficient on the third drug is equal to the coefficient on the
fourth.
We find that the two coefficients are not significantly different,
at least at any significance level smaller than 73%.
For more complex tests, the contrast command often provides
a more concise way to specify the test we are interested in and prevents
us from having to write tests in terms of the regression coefficients.
With contrast, we instead specify our tests in terms of differences
in the marginal means for the levels of a particular factor. For
example, if we want to compare the third and fourth drugs, we can test the
difference in the mean impact on systolic blood pressure separately
for each disease using the @ operator. We also use the reverse
adjacent operator, ar., to compare the fourth level of the drug
with the previous level.
test and contrast can still access the estimates, even though
two tabulations have intervened. Similarly, anova is integrated with
Stata’s regress command for estimating linear regressions. We
can review the underlying regression estimates by typing regress
without arguments:
In our original estimation, the direct effect of disease was found to be
insignificant, as was the drug#disease interaction. We might now
compare our two-way factorial model with a simpler, one-way layout:
With the test command above, we found that a one-way model
fits these data well. We could use either Stata's anova command or
Stata’s oneway command to fit a one-way model.
Table 7.7 of Winer, Brown, and Michels (1991) provides a repeated-measures
ANOVA example involving both nested and crossed terms. There are four dial
shapes and two methods for calibrating dials. Subjects are nested within
the calibration method, and an accuracy score is obtained. Here is the
Stata anova command for this problem.
See
New in Stata 12
for more about what was added in Stata Release 12.
References
- Afifi, A. A., and S. P. Azen. 1979.
- Statistical Analysis: A computer-oriented approach. 2nd ed.
New York: Academic Press.
- Winer, B. J., R. Brown, and K. M. Michels. 1991.
- Statistical Principles in Experimental Design.
3rd ed. New York: McGraw–Hill.
|