02-20-2018 05:17 PM - edited 02-21-2018 05:06 PM
I want to run a repeated measure in proc mixed with double nest (site is nested in calf and calf is nested in tx) but I am not success to do it. Would you please to help revise my code below? with an example of data of two calves.
input calf time site $ tx $ log10cfu;
9 -1 Ear control 0
9 -1 Eye control 0
9 -1 Nose control 0
30 7 Ear Dex 0
30 7 Eye Dex 0
30 7 Nose Dex 3.574031268
proc mixed method=reml covtest data=dex1;
class calf time site tx;
model log10cfu= site time tx tx*time/ddfm=satterth solution;
random calf site site*calf site*time calf*time calf*tx calf*time*tx calf*time*tx*site;
lsmeans time*tx/ alpha=0.05 cl tdiff Pdiff;
repeated time /sub= site (calf tx) type=arh(1) r rcorr;
Many thanks for help,
02-28-2018 06:06 PM - edited 02-28-2018 06:07 PM
Consider (assuming that I understand your experimental design correctly):
proc mixed method=reml covtest data=dex1; class calf time site tx; model log10cfu= tx site tx*site time time*tx time*site time*tx*site / ddfm=satterth solution; random calf(tx); *random site*calf(tx); /* this statement could be included with arh(1) or not; for most other types, it is excluded because it is redundant to the repeated statement */ repeated time / subject=site*calf(tx) type=arh(1) r rcorr; lsmeans time*tx / alpha=0.05 cl tdiff Pdiff; run;
In the MIXED procedure, fixed effects that are identified in the MODEL statement are not duplicated in the RANDOM statement, so you would not have site or site*time in RANDOM.
calf*time*tx*site should be excluded from RANDOM because it identifies the residual variance; if you include it, your model is overspecified.
In my opinion, some of your terms in RANDOM are either wrong (like calf, rather than calf(tx) ) or partition variance unnecessarily (like calf*time and calf*time*tx.