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

st: Re: Repeated ANCOVA


From   Weihua Guan <[email protected]>
To   [email protected]
Subject   st: Re: Repeated ANCOVA
Date   Wed, 04 Dec 2002 12:33:12 -0600

-- VIVIAND Xavier <[email protected]> wrote,

> Before applying a repeated ANCOVA on my own data, I tried to run the example
> proposed by Tabachnick and Fidell (Computer-assisted research design and
> analysis, 2001) on page 417 (Table 8.13). The data set is a mixed ANCOVA
> with a single covariate (Easy) measured once for each case. The
> randomized-groups IV i type of music (labeled Music, 2 levels) and the
> repeated-measures IV is time of day (4 levels, labeled T1 through T4).
> The data are below :
>
> <data>
>
> I entered the following command :
> anova y easy music/id|music time time*music time*easy, rep(time) cont(easy)
> I got the same same results than reported by Tabachnick and Fidell (using
> SYSTAT GLM) except for the covariate :
>                 SS      df      MS      F       P
> Stata           .125     1        .125       0.18     0.6921
> Tabachnick      11.327 1        11.327  15.96  0.01
> and Fidell
> How can this difference be explained ?

I don't have access to SYSTAT, so am not sure how it handles the sum of
squares for continuous covariates.  In Stata, Tabachnick and Fidell's results
can be reproduced by using -sequential- option and changing the order of
covariates:

. anova y music easy id|music time time*music time*easy, cont(easy) seq

                           Number of obs =      32     R-squared     =  0.9486
                           Root MSE      = .870978     Adj R-squared =  0.8938

                  Source |    Seq. SS     df       MS           F     Prob > F
              -----------+----------------------------------------------------
                   Model |  210.120968    16  13.1325605      17.31     0.0000
                         |
                   music |      10.125     1      10.125      13.35     0.0024
                    easy |  11.3266129     1  11.3266129      14.93     0.0015
                id|music |   3.5483871     5  .709677419       0.94     0.4859
                    time |        1.25     3  .416666667       0.55     0.6563
              time*music |     179.625     3      59.875      78.93     0.0000
               time*easy |  4.24596774     3  1.41532258       1.87     0.1788
                         |
                Residual |  11.3790323    15  .758602151   
              -----------+----------------------------------------------------
                   Total |      221.50    31  7.14516129   

The F-statisitic is computed as the ratio of mean sum of squares:

. di 11.3266129/.709677419
15.960227


> Secondly, I tried to test the homogeneity of regression slopes, i.e. the
> interaction between the covariate Easy and the factor Music by
> anova y easy easy*music music/id|music time time*music time*easy, rep(time)
> cont(easy)
> I got :
>                        SS      df      MS      F       P
>          easy |        .125     1        .125       0.18     0.6921
>    easy*music |        0.00     0
>         music |  .491276672     1  .491276672       0.69     0.4433
>      id|music |   3.5483871     5  .709677419
> Why the df of easy*music is 0 ?

The 0 degree of freedom for the interaction easy*music is due to collinearity
among the covariates.  Let's consider a simpler model: 

. anova y id easy*music,

                           Number of obs =      32     R-squared     =  0.1129
                           Root MSE      = 2.86138     Adj R-squared = -0.1459

                  Source |  Partial SS    df       MS           F     Prob > F
              -----------+----------------------------------------------------
                   Model |       25.00     7  3.57142857       0.44     0.8696
                         |
                      id |       25.00     7  3.57142857       0.44     0.8696
              easy*music |        0.00     0
                         |
                Residual |      196.50    24      8.1875   
              -----------+----------------------------------------------------
                   Total |      221.50    31  7.14516129   

We can further tabulate the two factors:

. gen em = easy*music

. table id em, col

-----------------------------------------------------------
          |                       em                       
       id |     3      4      6     10     12     14  Total
----------+------------------------------------------------
        1 |                   4                           4
        2 |                   4                           4
        3 |            4                                  4
        4 |     4                                         4
        5 |                                 4             4
        6 |                                        4      4
        7 |                   4                           4
        8 |                          4                    4
-----------------------------------------------------------

There are only 8 non-empty cells in the table, corresponding to the 8
categories of "id".  So in the ANOVA model, all the degrees of freedom are
taken by "id" first and nothing is left for the interaction "easy*music".

Hope this can clarify your questions.


Weihua Guan <[email protected]>
Stata Corp.

*
*   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