This is a sample dataset: Each patient has multiple glucose levels that are categorized into episodes based on the time that glucose test date. Eg: Patient 2 has 3 glucose readings, the first two (80,85) carried out on the same day - therefore it is one episode. The third reading (160) carried out another day - hence its the second episode.
ID Glucose episode 1 140 1 1 145 2 2 80 1 2 85 1 2 160 2
1) I would like to fit a variance component mode to identify variability within & across episodes, and across patients. I have tried the below code, and also using 'subject=episode(ID)' since the episodes are nested within each ID. Could you please explain what would be the best way to fit this model / if this is the right direction?
proc mixed data=test; class ID episode; model glucose = ; random int episode/subject=ID; run;
Looks good - you should probably add the SOLUTION option to your RANDOM statement.
SteveDenham
Looks good - you should probably add the SOLUTION option to your RANDOM statement.
SteveDenham
Hi Steve, Thank you! Could you please explain how the above code takes nesting into account? And, how would the model differ from using the below code?
proc mixed data=test;
class ID episode;
model glucose = ;
random int /subject=episode(ID);
run;
This code fits two variance components:
random int episode/subject=ID
and is equivalent to:
random ID episode*ID;
While this code fits one variance component
random int /subject=episode(ID)
and is equivalent to
random episode*ID;
The key here is that the matrix representation of nested effects is identical to the matrix representation of crossed effects (see the documentation of the RANDOM statement).
It comes down to partitioning the variability between ID and episode*ID, with the remainder, if any, in the residual. All of this is going to be very data dependent.
SteveDenham
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!
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.