# Re: st: repeated measure anova - controlling for subject-level effects

 From khigbee@stata.com To statalist@hsphsun2.harvard.edu Subject Re: st: repeated measure anova - controlling for subject-level effects Date Sat, 31 Aug 2002 08:12:48 -0500

```Alex Cowell <cowell@rti.org> asks:

> I have a question about repeated measures anova.
>
> I have data where each of 96 subjects are each given 4 treatments; the order
> of assignment is random.  Every subject is diagnosed to be one of 4
> 'groups'.  The hypothesis is to assess whether when given treatment # 1
> subjects of group #1 score higher than subjects of group #2.  Importantly,
> scores for every subject were assessed before being given treatment (to
> establish a baseline) and were also assessed after each of the 4 treatments.
>
> The thing that is tripping me up is how to control for the initial baseline
> score.
> Here is a sample of the data, sorted by subject id and treatment:
>
> <cut>
>
> Here is what works in Stata:
>
> . anova vas group/id|group treatment group*treatment, repeated(treatment)
>
> This gives me meaningful output that I can interpret.  But the question is,
> how do I also control for the initial baseline score?  It seems to me that
> id is 'nested' in group, but also that id is 'nested' in baselinescore.  If
> so, how do I make the anova command reflect this?
>
> Having spent a long time in the world of regressions, I am new to the world
> of ANOVA (or repeated measures ANOVA).  In a regression, one could simply
> throw baseline score in as an independent control.
>
> <cut>

One approach for incorporating the baseline would be to include
it as a covariate in the -anova-.

. anova vas gr / id|gr tr gr*tr base , rep(tr) cont(base)

-cont()- is short for the -continuous()- option of -anova-.  If
it makes sense for your model, you can also include interaction
terms involving the continuous variable.

In a follow-up note you also say

> ... I have tried instead positing that id is nested within
> baseline*group.  Also, what I did not say in the first email was that I
> think id is random, everything else is fixed.
>
> I think the following could be right.  It gave me output that I can
> understand:
>
> .anova score baseline group baseline*group/id|baseline*group treatment
> baseline*treatment group*treatment baseline*group*treatment, rep(treatment)
>
> I checked the highest order interaction term (the three way) and
> re-estimated without it because it was not significant (p=.3).
>
> Again: please tell me if this makes sense!  It seems strange to me to be
> fully interacting baseline score.

One way to think of baseline*group is as a supergroup.  In fact,
you could generate such a variable using

. egen supergroup = group(group baseline)

And then

. anova score supergroup / id|supergroup ...

The -anova- you did above is just a more detailed way of doing
this.  It allows you to inspect both the group and baseline
aspects of the supergroup.  So, my opinion is that the model you
show above may indeed make sense.

You can also approach the problem, as I discussed at first, by
including baseline as a covariate (using the -continuous()-
option) and possibly also including interaction terms involving
baseline.  This approach treats baseline more as a nuisance
parameter to be accounted for (regressed out) than as a parameter
of real interest.

I think it is more common to include baseline as a continuous
covariate as opposed to thinking of it as part of your grouping
term(s).  If your baseline were measured more finely (values like
8.26531 instead of 8 etc.) then it would be rare to have 2 people
with identical baseline scores.  Then, the supergroup approach
would fall apart since each supergroup would have only 1 person.

For background you might consider looking over Section 10.5
"Analysis of covariance -- repeated measures" in Winer, Brown, &
Michels (1991), "Statistical Principles in Experimental Design,
this book.  If you do not already have the book available to you,
it is for sell at Stata's online bookstore

http://www.stata.com/bookstore/

And, in particular

http://www.stata.com/bookstore/sped.html

Ken Higbee    khigbee@stata.com
StataCorp     1-800-STATAPC

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