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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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