Hi,
I have a few question about using linear mixed model for repeated measurements.
Each subject has different follow-up times and number of measurements. For example:
subject A: day 1, day 8, day 20
subject B: day 7, day 13
subject C: day 3, day 19, day 27
...
I then categorized time into 6-day intervals (0-6, 6-12, 12-18...) and labeled it as "time_category", and used it in the mixed model.
Given that the correlations are expected to be highest between adjacent times and lower between more distant times, could I say that the samples are equally spaced (0-6, 6-12..) and use 'type=ar(1)' ?
Or should I consider their orinial unequally spaced time before the categorization, and use 'type=SP(POW)(time)'?
1. If type=ar(1) is better, should I add "time_category" after the REPEATED?
2. If type=SP(POW)(time) is better, does 'type=sp(pow)' only go with continuous variables? If it does, since I've categorized time into categories, should I turn it into something continuous like 1, 2, 3, 4,...?
3. How could I draw a figure to see the differences in trajectory overtime between different site? (predicted value versus time)
Here is my code:
PROC MIXED DATA = test METHOD = REML COVTEST ;
CLASS site record_id time_category(ref="0-6");
MODEL Score =time_category site time_category*site/ SOLUTION;
RANDOM INTERCEPT / SUBJECT = record_id;
repeated time_category/ type=ar(1) SUBJECT = record_id;
RUN;
Any suggesstions are appreciated, thanks!
TYPE=AR(1) does not account for unequal time spacings. TYPE=SP(POW)(time) does.
You might do both and compare the fit statistics to see which model fits your data better.
When using TYPE=SP(POW)(time), you might want to use the original time values --
repeated/ type=sp(pow)(time) SUBJECT = record_id;
For the plot, you might add OUTP=PREDDATA option in the MODEL statement in PROC MIXED. Then use PROC SGPPLOT later --
proc sort data=preddata; by site time; run;
proc sgplot data=preddata;
series y=pred x=time / group=site;
run;
Hope this helps,
Jill
TYPE=AR(1) does not account for unequal time spacings. TYPE=SP(POW)(time) does.
You might do both and compare the fit statistics to see which model fits your data better.
When using TYPE=SP(POW)(time), you might want to use the original time values --
repeated/ type=sp(pow)(time) SUBJECT = record_id;
For the plot, you might add OUTP=PREDDATA option in the MODEL statement in PROC MIXED. Then use PROC SGPPLOT later --
proc sort data=preddata; by site time; run;
proc sgplot data=preddata;
series y=pred x=time / group=site;
run;
Hope this helps,
Jill
Your second PROC MIXED program is missing subject=record_id option in the REPEATED statement.
yes, it seems that either model works for your data.
You may ignore the warning message in this case.
Thanks,
Jill
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.