Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# st: rmanova or anova with repeated command, what to use?

 From "Pieter-Jan" To Subject st: rmanova or anova with repeated command, what to use? Date Tue, 4 Oct 2011 21:58:04 +0200

```Dear statalisters,

Some time ago we performed a randomized crossover study in which we
monitored the lung function of a group of volunteers  during three days. Day
1 was used to determine baseline lung function whereas day 2 and 3 were used
to monitor lung function after inhaling either placebo (air) or active gas
(oxygen) under hyperbaric  condition. During each measurement day lung
function was measured 6 times. All variables and observations were put in a
dataset which initially had the following format:

ID           Group      Time                     Result1 etc
1             0          0                             6.19
2             0          0                             5.97
.             .          .                              .
.             .          .                              .
13            2          22                           5.33
Etc

ID exist of 13 persons (nr 1-13)
Group: 0 (baseline), 1 (placebo), 2 (active)
Time: pre, 0, 2, 4, 8, 12, 22 hours after exposure

We want to perform a repeated measures anova as all subject performed all
three test days which makes the groups not independent. The format we had in
mind was to search for differences between the groups at a specific time
point and to look for a correlation between Result1, etc and variable time.
I found two possibilities of doing a repeated measures anova using Stata
9.2:

1.	Using Ado rmanova written by George Hoffman
2.	Using anova with command repeated.

I tried both commands but they gave some contradictory results. To gave an
example I put in the log results of one test:

. rmanova FEF50 id time group
ANOVA for var FEF50 by subject ID
n=198 df=32 R2=.90011879

between effect: group

Source |  Partial SS    df       MS           F     Prob >
F

-------------+----------------------------------------------------
group |   94.488177     2  47.2440885       0.17
0.8420
id*group |  8196.56138    30  273.218713

within effect: time

Source |  Partial SS    df       MS           F     Prob >
F

-----------+----------------------------------------------------
Time |   218.17681    17    12.83393       1.78
0.0343
Residual |  1226.78373   170  7.21637487

. anova FEF50 id group time, repeated(group time)

Number of obs =     198     R-squared     =
0.8668
Root MSE      = 2.68633     Adj R-squared =
0.8457

Source |  Partial SS    df       MS           F     Prob >
F

-----------+----------------------------------------------------
Model |  7984.27781    27  295.713993      40.98
0.0000
|
Id   |    7766.101    10    776.6101     107.62
0.0000
group |  45.8076387     2  22.9038193       3.17
0.0443
time |  123.688633    15  8.24590887       1.14
0.3222
|
Residual |  1226.78373   170  7.21637487

-----------+----------------------------------------------------
Total |  9211.06154   197  46.7566576

Between-subjects error term:  id
Levels:  11        (10 df)
Lowest b.s.e. variable:  id

Repeated variable: group
Huynh-Feldt epsilon        =
0.6682
Greenhouse-Geisser epsilon =
0.6227
Box's conservative epsilon =
0.5000

------------ Prob > F
------------
Source |     df      F    Regular    H-F      G-G      Box

-----------+----------------------------------------------------
group |      2     3.17   0.0443   0.0651   0.0685
0.0784
Residual |    170

-----------+----------------------------------------------------

Repeated variable: time
Huynh-Feldt epsilon        =
0.4478
Greenhouse-Geisser epsilon =
0.2469
Box's conservative epsilon =
0.0667

------------ Prob > F
------------
Source |     df      F    Regular    H-F      G-G      Box

-----------+----------------------------------------------------
Time |     15     1.14   0.3222   0.3460   0.3482
0.3073
Residual |    170

-----------+----------------------------------------------------

. log close

In rmanova there is a significant correlation with FEF50 and time
(p=0.0343), while in the anova with repeated command test there is none such
correlation. Can anyone advise us which option we should use: rmanova or
anova with the repeated command? Many thanks.

Sincerely Yours,

Pieter-Jan van Ooij

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