BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
aska_ujita
Obsidian | Level 7

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

1 ACCEPTED SOLUTION

Accepted Solutions
SteveDenham
Jade | Level 19

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

 

 

View solution in original post

1 REPLY 1
SteveDenham
Jade | Level 19

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: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is ANOVA?

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.

Discussion stats
  • 1 reply
  • 515 views
  • 0 likes
  • 2 in conversation