Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Anova and Contrasts with missing cells


From   "Joseph Coveney" <[email protected]>
To   "Statalist" <[email protected]>
Subject   Re: st: Anova and Contrasts with missing cells
Date   Sat, 25 Oct 2008 14:25:00 +0900

Thomas J. Steichen wrote:

I have a question about contrasts after ANOVA for the following example
dataset, which I also summarize via -table- below:
[snip]
. anova nnn round size|round
[snip]
. test _coef[round[1]] = _coef[round[3]]
[snip]
If one compares these contrast results to what SAS or JMP produce, those not
involving round 3 are identical to those of Stata. However, both SAS and JMP
produce p = 0.8256 for the second contrast above. Generally, SAS and JMP
produce p's for contrasts involving round 3 that are close, but different,
to those produced by Stata using the 'adjusted' data above. Also, SAS and
JMP produce identical results using the raw vs. adjusted data (whether round
3 is involved in the contrast or not).

I will speculate that difference in answers is due to the unequal sample
sizes and/or the cells with no data. But the question remains: which is
correct?

--------------------------------------------------------------------------------

Your constrast statement doesn't specify the contrast that you intended.

First, I recommend to specify the ANOVA model as

anova nnn round size

which in this case happens to be equivalent to -anova nn round size|round-,
but will give a clearer readout of what follows:

anova, regress

With that in view, in order to get the correct contrast (and the one that
SAS and JMP report):

lincom _coef[round[3]] - _coef[round[1]] + _coef[size[1]] / 2

the basis of which becomes even clearer with:

table round size, c(mean nnn) format(%04.2f)


Another approach, one that I actually would take first:

xi: regress nnn i.round size

(The t-statistic and p-value for the correct contrast may be read directly
from the regression table in one fell swoop.)


Factorial ANOVA with missing cells is a real bear, and contrasts after it is
even worse.  See Chapter 13 in George A. Milliken & Dallas E. Johnson,
_Analysis of Messy Data_ Volume 1: Designed Experiments (London: Chapman &
Hall, 1992).

Joseph Coveney

clear *
set more off
input byte round size nnn nnn_adjm
1 600 .532 .532
1 600 .573 .573
1 600 .581 .581
2 600 .609 .609
2 600 .465 .465
2 600 .593 .593
3 400 .413 .5756667
3 400 .406 .5686666
3 400 .418 .5806667
3 800 .725 .5623333
3 800 .815 .6523333
3 800 .673 .5103333
4 600 .552 .552
4 600 .585 .585
4 600 .588 .588
4 600 .733 .733
4 600 .608 .608
5 600 .640 .640
5 600 .643 .643
5 600 .906 .906
5 600 .853 .853
5 600 .847 .847
end

table round size, c(mean nnn) format(%04.2f)

anova nnn round size, category(round size)
anova, regress
lincom _coef[round[3]] - _coef[round[1]] + _coef[size[1]] / 2

xi: regress nnn i.round size

exit


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index