Hello there,
Is there someone that knows how to do contrast analyze in repeated measures?
I have a data with three treatments in cattle: the first group is a control, the second group got a habituation protocol and third group got another different habituation protocol. So I would like to test the control (first) vs habituated (second + third group); and test between the habituated ones (second vs third). The traits were collected in day 0 (no habituation in any groups) and day 14 (14 days after end of habituation of the second and third group) and day 28 (28 days after end of habituation of the second and third group). So I have 3 repeated measures.
Is it possible to use the proc Mixed?
proc mixed data=B; /*behaviour*/
class group breed animal day;
MODEL VAR=GROUP DAY BREED GROUP*DAY;
repeated DAY / type= ANTE(1) subject=animal*group;
random breed / subject=animal;
lsmeans group*day / pdiff;
lsmeans group / pdiff;
lsmeans day / pdiff;
run;
Thank you
That is quite close. The key will be to limit the comparisons for group*day, unless comparing Group 1 on Day 0 to Group 3 on Day 14 has some interest for you. I would recommend the following lsmean statements:
lsmean group^day/diff slice=day;
This would give an F test for the difference between groups for each day.
If you wished to be more explicit in your tests, you could construct LSMESTIMATE statements that make the comparisons which are of interest.
Finally, the LSMEAN statement has more options in PROC GLIMMIX. If you changed your analysis to the following
proc glimmix data=B; /*behaviour*/
class group breed animal day;
MODEL VAR=GROUP DAY BREED GROUP*DAY;
random DAY / type= ANTE(1) subject=animal*group residual;
random breed / subject=animal;
lsmeans group*day / slicediff ( group day);
lsmeans group / diff;
lsmeans day / diff;
run;
In addition, with only 3 timepoints, I would specify the type= as type=chol, which would use a Cholesky factorization of an unstructured matrix, just in case there is a marked difference in the variance and covariance as time progressed in your experiment.
SteveDenham
That is quite close. The key will be to limit the comparisons for group*day, unless comparing Group 1 on Day 0 to Group 3 on Day 14 has some interest for you. I would recommend the following lsmean statements:
lsmean group^day/diff slice=day;
This would give an F test for the difference between groups for each day.
If you wished to be more explicit in your tests, you could construct LSMESTIMATE statements that make the comparisons which are of interest.
Finally, the LSMEAN statement has more options in PROC GLIMMIX. If you changed your analysis to the following
proc glimmix data=B; /*behaviour*/
class group breed animal day;
MODEL VAR=GROUP DAY BREED GROUP*DAY;
random DAY / type= ANTE(1) subject=animal*group residual;
random breed / subject=animal;
lsmeans group*day / slicediff ( group day);
lsmeans group / diff;
lsmeans day / diff;
run;
In addition, with only 3 timepoints, I would specify the type= as type=chol, which would use a Cholesky factorization of an unstructured matrix, just in case there is a marked difference in the variance and covariance as time progressed in your experiment.
SteveDenham
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.