### Monday, February 27, 2006

## re: st: repeated anova

.

> I am struggling with this seemly simple ANOVA, but I > can't get it set correctly. I have 40 students > randomly allocated to 4 experimental stress groups. > The diastolic blood pressure was measured for each > student at baseline and at five additional times. The > lay out is something like this: > > . table time group > > ---------------------------------- > | group > time | 0 1 2 3 > ----------+----------------------- > 0 | 10 10 10 10 > 1 | 10 10 10 10 > 2 | 10 10 10 10 > 3 | 10 10 10 10 > 4 | 10 10 10 10 > 5 | 10 10 10 10 > ---------------------------------- > > Note that there are 10 students in each -group-, but > each student was measured at 6 different times. Could > someone please tell me what is the correct Stata > command for this repeated ANOVA?

This is a simple split plot design that shows up everywhere in biology. You've got one between-subjects factor (group), and one within-subjects factor (time). You can analyze this design using a number of Stata commands: anova, manova, or xtmixed. Take a look at the UCLA page which covers classical designs using ANOVA and the equivalent xtmixed command:

http://www.ats.ucla.edu/stat/stata/faq/xtmixed.htm

On that page you will see this relevant part:

/* spf-2.4 subjects nested in a */ /* between subjects: a */ /* within subjects: b */

use http://www.ats.ucla.edu/stat/stata/examples/kirk/spf2-4, clear

/* anova code: */ anova y a / s|a b a*b /, repeated(b)

xi3 e.a*e.b

xtmixed y _Ia_2 _Ib_2 _Ib_3 _Ib_4 _Ia2Xb2 _Ia2Xb3 _Ia2Xb4 || s:

test _Ia_2

test _Ib_2 _Ib_3 _Ib_4

/* scale chi^2 as F-ratio to compare with anova */ display r(chi2)/r(df)

test _Ia2Xb2 _Ia2Xb3 _Ia2Xb4

display r(chi2)/r(df)

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

Tag: statalist