BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
LenH
Fluorite | Level 6

Hi, I have a numerical measurement taken over time (7 timepoints) for two groups (diseased - n=14 and control - n=31). There are a few missing values at some timepoints. As below, I arranged the timepoints into one column and by timepoint (though, since the most recent update, I can't get day14 to = 1 etc).

 

 
proc sort data=one;
by horse status age;
run;

proc transpose data=one out =two;
by horse status age;
var day14 day28 day42 day56 day70 day84 day98;
run;

***need to divide by 40 b/c EPG dilution factor!!!;
data three;
set two;
time = _LABEL_;
if _NAME_ = 'day14' then time = 1;
if _NAME_ = 'day28' then time = 2;
if _NAME_ = 'day42' then time = 3;
if _NAME_ = 'day56' then time = 4;
if _NAME_ = 'day70' then time = 5;
if _NAME_ = 'day84' then time = 6;
if _NAME_ = 'day98' then time = 7;
COL1ct = round(COL1/40);
Keep horse age status time COL1 COL1ct;
run;

proc sort;
by time;
run;

 Looking at distribution, igaussian had the lowest AIC score. Using proc glimmix, with the code below, to determine differences between the variable of interest (COL1ct) and groups (status), significance was shown at certain timepoints and overall. 

 

 proc glimmix data =three ABSPCONV=0.00001;
 class status time horse;
 model COL1ct = status age/ dist = igaussian noint solution cl;
 random time / residual type=cs subject=horse*time;
 by time;
 **Parms (0.8189) (2.2);
 run;

This didn't compare slopes and I wanted to know if the diseased group had a significantly steaper slope than the control group. I used the below code but I'm not confident that this is correct for what I want. It would be great if someone can let me know if I'm on the right track or if I should change anything. The results printout is pasted below

 

**comparing slope elevations https://support.sas.com/kb/24/177.html ;
 proc glimmix data=three ABSPCONV=0.00001;
  class status time;
  model COL1ct = status*time/ dist = igaussian noint solution cl;
  run;

LenH_0-1687485921179.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
StatsMan
SAS Super FREQ

You might want to change your first model to 

proc glimmix data =three ABSPCONV=0.00001;
 class status time horse;
 model COL1ct = status age status*time/ dist = igaussian noint solution cl;
 random int / subject=horse;
 *by time;
 **Parms (0.8189) (2.2);
slice status*time / sliceby=time;
 run;

The SLICE statement will allow you to test for differences in the status at each level of time. Simplifying the RANDOM statement here to fit a random effect of horse. 

 

For the model where you want to compare slopes on time for the two levels of status, try

proc glimmix data=three ABSPCONV=0.00001;
  class status;
  model COL1ct = status time status*time/ dist = igaussian noint solution cl;
random int / subject=horse
*random int time / subject=horse;
  run;

The test on the status*time will tell you if the slopes on time for the two levels of status are different. The first random statement fits a random effect for horse. If you want to fit random adjustments to the slope on time  (and intercept) for each horse, use the 2nd random statement.

 

 

View solution in original post

5 REPLIES 5
StatsMan
SAS Super FREQ

You might want to change your first model to 

proc glimmix data =three ABSPCONV=0.00001;
 class status time horse;
 model COL1ct = status age status*time/ dist = igaussian noint solution cl;
 random int / subject=horse;
 *by time;
 **Parms (0.8189) (2.2);
slice status*time / sliceby=time;
 run;

The SLICE statement will allow you to test for differences in the status at each level of time. Simplifying the RANDOM statement here to fit a random effect of horse. 

 

For the model where you want to compare slopes on time for the two levels of status, try

proc glimmix data=three ABSPCONV=0.00001;
  class status;
  model COL1ct = status time status*time/ dist = igaussian noint solution cl;
random int / subject=horse
*random int time / subject=horse;
  run;

The test on the status*time will tell you if the slopes on time for the two levels of status are different. The first random statement fits a random effect for horse. If you want to fit random adjustments to the slope on time  (and intercept) for each horse, use the 2nd random statement.

 

 

LenH
Fluorite | Level 6

The test on the status*time will tell you if the slopes on time for the two levels of status are different. The first random statement fits a random effect for horse. If you want to fit random adjustments to the slope on time (and intercept) for each horse, use the 2nd random statement.    

 

Thanks so much for sharing your time and expertise by replying. The results from your code make sense of my graph beautifully. Would you mind looking at my results interpretation so I can be confident with my write up?

 

 proc glimmix data =three ABSPCONV=0.00001; 
   class status time horse; 
   model COL1 = status status*time/ dist = gamma noint solution cl; 
   random int / subject=horse; 
   slice status*time / sliceby=time; 
   run; 

LenH_0-1687584464505.png

For the slope ananlysis, I added a few things in the class statement to make it happy. It won' tconverge with 'time' in the random statment, but i think random adjustments to the slope on time (and intercept) for each horse if fine.

I was wondering what part of the code relates to slope analysis, is it the 'status*time' and  the 'random intercept'? 

title 'Test for differences in slope elevations';
proc glimmix data=three ABSPCONV=0.00001;
class status time horse;
model COL1ct = status time status*time/ dist = gamma noint solution cl;
random int / subject=horse;
run;

LenH_3-1687585611707.png

 

 

 

jiltao
SAS Super FREQ

It seems to me that you would need to take TIME out of the CLASS statement if the "slope" is of your interest.

StatsMan
SAS Super FREQ

@jiltao is correct. If you want to compare slopes, then time needs to come off the class statement.

 

Changing the model statement will change the interpretation of the type 3 tests you get on the model effects. Using the E3 option on the model statement will help you see the interpretation of each test. If you want a test that compares the slopes, then you can try a mode like:


proc glimmix data=test;
   class status horse;
   model y=status time status*time / e3;
   random int / subject=horse;
run;
   

With this model, the type 3 test on status*time tells you if the slopes are different. You can use the LSMEANS statement with the AT and PDIFF options to see if the response is different at a particular time point with this model.

lsmeans status / at time=14 pdiff e; 
LenH
Fluorite | Level 6

Thank you, both for your replies. This all works well and I have a better understanding now

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
  • 5 replies
  • 995 views
  • 4 likes
  • 3 in conversation