BookmarkSubscribeRSS Feed
_maldini_
Barite | Level 11
I'm attempting a linear mixed-effects regression using PROC MIXED. I have never done this analysis before, and frankly, it's over my head..
 
Can someone help me understand this warning in the log. It only appears in my fully-adjusted model.
 
"The R matrix depends on observation order within subjects. Omitting observations from the analysis because of missing
values can affect this matrix. Consider using a classification effect in the REPEATED statement to determine ordering in
the R matrix."
 
The documentation for the REPEATED statement states that "Specifying a repeated effect is useful...", but it's not clear what or how I would do so.
 
Thanks for the assistance.
 
	PROC MIXED DATA=have METHOD=REML EMPIRICAL;		
	CLASS condition sex school baseline;
	MODEL score = condition timepoint_num condition*timepoint_num age sex school baseline / SOLUTION;
	REPEATED / TYPE=UN SUBJECT=patientid;
	QUIT;
 
2 REPLIES 2
Rick_SAS
SAS Super FREQ

To address the "over my head" concern, you might want to read the papers

I'm nit an expert in mixed models, but in KTG (2012), on p. 3, there is an example similar to yours. The surrounding text seems to imply that since you did not put PATIENTID on the CLASS statement, that you should sort the data by PATIENTID and by the time-like variable (which might be timepoint_num???). So try this before the PROC MIXED step:

 

proc sort data=have;

by patientid timepoint_num; /* or whatever variable is used to order the repeated obs */

run;

 

SteveDenham
Jade | Level 19

Working from @Rick_SAS's surmission about your code, try the following:

PROC MIXED DATA=have METHOD=REML EMPIRICAL;		
	CLASS condition sex school baseline timepoint_num patientid;
	MODEL score = condition timepoint_num condition*timepoint_num age sex school baseline / SOLUTION;
	REPEATED timepoint_num / TYPE=UN SUBJECT=patientid;
	RUN;

This will give you a medium inference space solution--broad for patients, narrow for schools.  You might want to consider school as a random effect, in which case the following would be appropriate:

PROC MIXED DATA=have METHOD=REML EMPIRICAL;		
	CLASS condition sex school baseline timepoint_num patientid;
	MODEL score = condition timepoint_num condition*timepoint_num age sex  baseline / SOLUTION;
	REPEATED timepoint_num / TYPE=UN SUBJECT=patientid;
        RANDOM intercept/subject=school;
	RUN;

For these to work, you need unique patientid's across all schools, and you need unique observations at each timepoint_num for each patientid.

 

Now comes the flood--how does your data breakdown?  How many timepoint_num's are you trying to fit?  Since they are indexed (presumably, based on the variable name), is the spacing relatively equal between them, and is it similar in number of timepoints across schools?

 

Besides the texts @Rick_SAS mentioned, get a copy of SAS for MIxed Models, 2nd ed. by Littell et al. (3rd ed. soon to be issued).

 

Steve Denham

 

 

 

 

 

 

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 5647 views
  • 0 likes
  • 3 in conversation