Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Order of factors in anova affects results


From   Michael Ingre <[email protected]>
To   <[email protected]>
Subject   st: Order of factors in anova affects results
Date   Tue, 30 Sep 2003 09:56:18 +0200

Dear stata listers

As I understand it, the order of factors specified on the command line
should not have an effect of the results (unless you specify the sequential
SS). However, its seems like in certain circumstances it does.

For your information, I�m new to stata (have been working on SPSS) and I'm
not used to the stata syntax or working with the "long" file format.  I
could have got it completely wrong ....

The ANOVA I'm trying to fit is a rather simple one. I have three groups
(grp) with subjects (sub) measured at two points in time (time) and I'm
primarily interested in the interaction grp*time but also in the main
effects of time and group.

If I specify the subject factor before the group factor then there is no
variance left for the group factor (it all end up in the subject factor).
But if I specify it the other way around there is. Why?

See the listings below. As I understand it, it is sufficient to include the
subject factor in the model to account for between subject variance and the
repeated option is not needed when there are only two levels of the repeated
factor. But then again, I could have got it wrong.

I appreciate your comments.

Michael Ingre


. anova dv grp subj time time*grp


                 Number of obs =     231     R-squared     =  0,7962
                 Root MSE      = ,324112     Adj R-squared =  0,5816

        Source |  Partial SS    df       MS           F     Prob > F
    -----------+----------------------------------------------------
         Model |  45,9757346   118  ,389624869       3,71     0,0000
               |
           grp |  ,630208333     2  ,315104167       3,00     0,0538
          subj |  45,5183229   113  ,402817017       3,83     0,0000
          time |  ,166479159     1  ,166479159       1,58     0,2107
      time*grp |  ,259392017     2  ,129696008       1,23     0,2949
               |
      Residual |  11,7654721   112  ,105048858
     ----------+----------------------------------------------------
         Total |  57,7412067   230  ,251048725

. anova dv subj grp time time*grp

                 Number of obs =     231     R-squared     =  0,7962
                 Root MSE      = ,324112     Adj R-squared =  0,5816

        Source |  Partial SS    df       MS           F     Prob > F
    -----------+----------------------------------------------------
         Model |  45,9757346   118  ,389624869       3,71     0,0000
               |
          subj |  45,9169998   115  ,399278259       3,80     0,0000
           grp |           0     0
          time |  ,166479159     1  ,166479159       1,58     0,2107
      time*grp |  ,259392017     2  ,129696008       1,23     0,2949
               |
      Residual |  11,7654721   112  ,105048858
    -----------+----------------------------------------------------
         Total |  57,7412067   230  ,251048725   


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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