Date: Thu, 27 Mar 2008 06:07:30 -0700 Steve Denham "SAS(r) Discussion" Steve Denham Re: Repeated measure in Mixed procedure To: Walid Alali text/plain; charset=us-ascii

Walid and everyone,

This got more interesting when I started working with a full simulated dataset. The first thing is that your data has replicate completely confounded with animal. I don't think this is the case--so I recoded replicate as 1, 2, 3 for each animal. It then becomes a lot more apparent that there is a lot of nested random effects: pen, animal within pen, replicate within animal for each week. I also ginned up a second day's worth of data

The following code "works". I still feel like there might be something better.

proc mixed data=sasl; class pen TRT Day animal replicate; model response= TRT Day TRT*Day ; random pen animal(pen) replicate(animal pen); repeated Day / subject = animal(pen) type = cs r rcorr; lsmeans TRT Day TRT*Day/diff; run;

Notes: Take a look at that r matrix. It has six entries--3 reps by 2 days. There has to be something better. A group statement perhaps?

Steve Denham Associate Director, Biostatistics MPI Research

----- Original Message ---- From: Walid Alali <walidalali@GMAIL.COM> To: SAS-L@LISTSERV.UGA.EDU Sent: Wednesday, March 26, 2008 3:16:13 PM Subject: Repeated measure in Mixed procedure

Hello all,

I am having trouble finding the best way of including all sources of variability in my mixed model.

My study design (which is a clinical trial) goes like this: I have 3 pens, in each pen; 10 animals (5 exposed and 5 controls). The response (i.e. the outcome) is measured over time (every week for 2 months). To make this complicated, the response was measured in triplicate (i.e. 3 times) at each time point.

Here is a glimpse of the data (just for the 1st pen): Animal TRT DAY Pen Replicate response 151 E 0 5 1 6.75E+03 151 E 0 5 1 6.22E+03 151 E 0 5 1 4.98E+03 152 E 0 5 10 6.25E+03 152 E 0 5 10 8.92E+03 152 E 0 5 10 6.09E+03 153 E 0 5 2 7.38E+03 153 E 0 5 2 4.68E+03 153 E 0 5 2 6.94E+03 154 E 0 5 3 2.49E+03 154 E 0 5 3 2.31E+03 154 E 0 5 3 2.03E+03 155 E 0 5 4 1.32E+04 155 E 0 5 4 9.92E+03 155 E 0 5 4 9.49E+03 156 C 0 5 5 4.22E+03 156 C 0 5 5 4.21E+03 156 C 0 5 5 3.46E+03 157 C 0 5 6 3.70E+03 157 C 0 5 6 3.62E+03 157 C 0 5 6 2.85E+03 158 C 0 5 7 1.54E+03 158 C 0 5 7 1.38E+03 158 C 0 5 7 1.63E+03 159 C 0 5 8 5.16E+03 159 C 0 5 8 5.00E+03 159 C 0 5 8 4.66E+03 160 C 0 5 9 5.37E+03 160 C 0 5 9 5.30E+03 160 C 0 5 9 5.41E+03

I have the model set up like this, but not sure how to include 'replicate' in it??

proc mixed data=data; class pen TRT Day animal; model response= TRT Day TRT*Day ; random pen; repeated Day / subject = animal(TRT) type = un r rcorr; lsmeans TRTcode Day TRTcode*Day/diff; run;