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

 From "Cowell, Alexander J." To "'statalist@hsphsun2.harvard.edu'" Subject st: repeated measure anova - controlling for subject-level effects Date Fri, 30 Aug 2002 13:51:21 -0400

```Statalisters

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:

group 	id 	treatment	baselinescore 	score
1	1	1		8		9
1	1	2		8		8
1	1	3		8		5
1	1	4		8		2
1	2	1		15		7
1	2	2		15		14
1	2	3		15		3
1	2	4		15		8
4	3	1		2		5
4	3	2		2		6
4	3	3		2		5
4	3	4		2		5
.	.	.		.		.
.	.	.		.		.
.	.	.		.		.

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.

For the ANOVA, I tried the following:
. anova vas group/id|group baseline_anxiety/id|baseline_anxiety block
group*block, repeated(block)
could not determine between-subject error term; use bse() option
r(421);

No surprise that that didn't work.  I have read Ken Higbee's FAQ on the
stata site (and I know he talks about getting the model right first and then
figuring out the stata command).  But, sometimes you need a little help from

BTW, independent from this problem I tried a 3*3 design here too (with
'period' or 'time' interactions), but Stata's matsize limit of 800 put an
end to that ambition.

Alex Cowell

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