Bookmark and Share

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


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

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


From   "Hoffman, George" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: RE: rmanova or anova with repeated command, what to use?
Date   Wed, 5 Oct 2011 05:35:00 -0500

You might think about, and then organize, the dataset a little differently.
You want to compare the effects of two treatments on lung function, measured repeatedly over time, before and after initiation of treatment. 
You have two treatment groups (air, O2) and two (or three) 'conditions' (baseline, active day 2, active day 3).

(question: is day 2 hyperbaric, and day 3 normobaric? Or are both under the same conditions, in which case you experiment would have only two conditions)

In either case, you need to split your 'group' variable into two variables that identify the treatment group (air, O2) and condition (baseline, active).

ID		group		condition	hour
1,2...13	1,2		1,2 (3)	0,2,....22

This would allow you to use anova y group##cond, rep(hour) to look at treatment effects.

Alternatively, you could code time as sequential hours form 0-72, then xtdes, i(id) t(hour) and use the xt functions.

I hope this helps a little.
rmanova and anova should give similar results set up this way.

George Hoffman

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Pieter-Jan
Sent: Tuesday, October 04, 2011 2:58 PM
To: [email protected]
Subject: st: rmanova or anova with repeated command, what to use?

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/

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index