Obsidian | Level 7

## Mixed Model Spline Regression Question

Hi all,

I have a question about attempting to model a mixed, random intercept/slope repeated measures regression analysis as a spline model, setting distinct knot points at each time period.

The goal of my analysis is to obtain a graphic that depicts a continuous variable on the Y-axis as a score measurement, a categorical time-session measure (equally spaced 2-10, 12) on the X-axis, and have a set of curves representing 702 individual slopes and intercepts (the subjects in our analysis). Ideally, we'd like to have knot points at each individual session, with the slopes of the curves in-between.

I'm not really sure how to go about obtaining/creating a graph as such. I started by performing a random intercept/slope PROC MIXED regression analysis, using the following code:

ods graphics on;
proc mixed data=Data plots = all order=freq;
model sessionScore = sessionContinuous / solution;
random intercept sessionContinuous / subject = id solution;
run;
ods graphics off;

This gave me the random intercept and slopes for each individual. I'm assuming I could use these values to create the content in the graph I hypothesized earlier, but am not sure how to do so or where I would start.

Can the random intercept/slopes obtained be used in a graph like this, or would another analysis need to be performed entirely?

Thanks in advance for any help or guidance!

1 ACCEPTED SOLUTION

Accepted Solutions
Rhodochrosite | Level 12

## Re: Mixed Model Spline Regression Question

Your current model assumes a linear relationship between sessionScore and sessionContinuous, rather than some sort of smoothed curve.

For an example of smoothed curves fit to individual subjects, you might find this GLIMMIX example useful: Example 47.6 Radial Smoothing of Repeated Measures Data. Documentation about the radial smoother is here: Radial Smoothing Based on Mixed Models.

Splines are available using the EFFECT statement in GLIMMIX: see Rick Wicklin's blog Regression with restricted cubic splines in SAS and the links within, as well as the GLIMMIX documentation.

I would not expect a graphic with 702 separate curves to be visually useful (too much overplotting, I would think), but you could plot a small sample of the 702.

I hope this helps.

2 REPLIES 2
Rhodochrosite | Level 12

## Re: Mixed Model Spline Regression Question

Your current model assumes a linear relationship between sessionScore and sessionContinuous, rather than some sort of smoothed curve.

For an example of smoothed curves fit to individual subjects, you might find this GLIMMIX example useful: Example 47.6 Radial Smoothing of Repeated Measures Data. Documentation about the radial smoother is here: Radial Smoothing Based on Mixed Models.

Splines are available using the EFFECT statement in GLIMMIX: see Rick Wicklin's blog Regression with restricted cubic splines in SAS and the links within, as well as the GLIMMIX documentation.

I would not expect a graphic with 702 separate curves to be visually useful (too much overplotting, I would think), but you could plot a small sample of the 702.

I hope this helps.

Obsidian | Level 7

## Re: Mixed Model Spline Regression Question

Thank you so much, again, for all of your help!
Discussion stats
• 2 replies
• 4637 views
• 3 likes
• 2 in conversation