BookmarkSubscribeRSS Feed
wj2
Quartz | Level 8 wj2
Quartz | Level 8

Hello Community,

 

I am working with a data set that includes 3 variables: patient ID number (patient_identifier), a self-reported pain score 0-10 (pain_score), and the number of days since the beginning of a treatment that a pain score was obtained (time_pain). I have provided an example of what the data looks like below. Note that pain scores being analyzed are only those that were obtained at a clinic visit during the time that a patient was receiving the treatment. Therefore, a patient who discontinued treatment relatively early will have fewer pain scores than a patient who received treatment longer. The number of pain scores per patient also depends on whether pain was assessed at their appointments. Further, the number of days since the start of treatment that pain was assessed will also vary between patients depending on when they had follow-up appointments.

 

I would like to obtain subject-specific estimates of pain intercepts and pain-time slopes (to be used as predictor variables of treatment duration in a subsequent model). To obtain the individual estimates of pain intercepts and time slopes, I am using a hierarchical linear model, via PROC MIXED, given that repeated measures of pain scores are nested within individuals. However, the issue is that my current model is not providing estimates for the individual slopes- I have provided my code and Covariance Parameter Estimates output below. Could someone please help with how I might be able to obtain these effects from the model? Any help with this would be much appreciated!!

 

Data input:

Patient_identifier

Time_pain

Pain_score

001

0

9

001

35

7

001

82

7

001

144

8

001

145

7

002

0

10

002

20

10

002

21

8

003

0

0

003

4

0

003

18

0

004

0

0

004

1

0

 

proc mixed data=data_have covtest noclprint method=ML;
class patient_identifier;
model pain_score=time_pain/ solution ddfm = SATTERTHWAITE;
random intercept time_pain/ sub=patient_identifier type=un solution;
ods output solutionr=sr;
run;

wj2_0-1641999629473.png

 

6 REPLIES 6
Rick_SAS
SAS Super FREQ

When I run your example, I get

WARNING: Did not converge.

Could you please provide sample data for which your PROC MIXED statements converge?

 

wj2
Quartz | Level 8 wj2
Quartz | Level 8

@Rick_SAS thank you for your help! I am not able to provide the data set, however, on my end when I run the program on my full sample (298 subjects, 860 total observations), I am being told that the convergence criteria is actually being met. Below is the actual notification from the log for your reference. It's just that I am getting a value of zero for all the individual random slope estimates. Are you able to provide any suggestions that I could try on my end using the actual data set? Thank you!

wj2_0-1642013303021.png

 

Rick_SAS
SAS Super FREQ

I don't doubt that your model converges on your full data. But I am unable to reproduce your issue without sample data.

 

Perhaps someone more familiar with mixed models will be able to help you. Good luck with your problem.

jiltao
SAS Super FREQ

Because the slope variance estimate is zero, you are not going to get the random effect solutions for the subject slopes.

It is possible that your data does not support the random slope model. A random intercept model might work well.

Or you might try to rescale your time variable so the values are in a smaller scale, for example, less than 10, to see if that helps with the variance estimate.

Hope this helps,

Jill

wj2
Quartz | Level 8 wj2
Quartz | Level 8

@jiltao Thank you very much for these suggestions! Would you mind providing an example of how the coding might look for these approaches? For example, to try a random intercept model, would the time variable just be left out of the random statement like shown below? So in this case, would it not be possible to obtain a time-slope estimate for each subject? 

proc mixed data=data_have covtest noclprint method=ML;
class patient_identifier;
model pain_score=time_pain/ solution ddfm = SATTERTHWAITE;
random intercept / sub=patient_identifier type=un solution;
ods output solutionr=sr;
run;

Would you be able to show how rescaling the time variable could be done? The values for the time variable range from about 1-180. Would the dependent variable (pain scores, 0-10) also need to be rescaled if the IV is being rescaled or is this unnecessary? 

 

Thank you!

jiltao
SAS Super FREQ

Yes, that would be a random intercept model. You will not get subject-specific slope estimate from this model.

If your time variable has values from 1 to 180, I am not sure if there is an effective way to rescale it to make it to work. If you want to try your luck, you might divide these values by a reasonable constant, for example, 7, 12, or 60, or another value, depending on the unit for the current time variable and the new unit for the time variable that might make sense.

No you do not need to rescale your dependent variable.

You might want to plot your data to see if a random intercept and slope model makes sense. Maybe your data does not support this model at all.

 

SAS Innovate 2025: Call for Content

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!

Submit your idea!

What is ANOVA?

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.

Discussion stats
  • 6 replies
  • 1451 views
  • 7 likes
  • 3 in conversation