- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I need some help obtaining the random slope estimates per individual, so that I can use those parameters per individual as an outcome in another part of the analysis.
Below is the code that I am currently using:
ods output solutionf=slopes;
proc mixed data=trial;
class idno time;
model GLOBALCOG = time WMFA WMH ICV brainvol AGE RACE GENDER/s chisq OUTPM=WORK.PM RESIDUAL;
random intercept time;
repeated time/type=un subject=idno r rcorr;
run;
The part "solutionf=slopes" provide one parameter of the random slope but not per individual.
Thanks!
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If this random slope is one slope for one subject. Try this:
data trial; call streaminit(123); do idno=1 to 10; do time=1 to 4; globalcog=rand('normal'); brain=rand('normal'); output; end; end; run; ods output SolutionR= SolutionR; proc mixed data=trial; class idno time ; model GLOBALCOG = time brain/s chisq RESIDUAL; /*random intercept /subject=idno solution ;*/ random brain/subject=idno solution ; /*repeated time/type=un subject=idno r rcorr;*/ run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Is this what you are looking for?
https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.3/statug/statug_mixed_examples05.htm
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Yes! Thanks for sharing. However, what it's still not clear is how to extract the random slope parameters per individual as a column that you could add to the dataset to use for analysis. I'd greatly appreciate suggestions!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I think your code should look like this:
data trial; call streaminit(123); do idno=1 to 10; do time=1 to 4; globalcog=rand('normal'); brain=rand('normal'); output; end; end; run; ods output SolutionR= SolutionR; proc mixed data=trial; class idno time; model GLOBALCOG = time brain/s chisq RESIDUAL; random intercept /subject=idno solution ; repeated time/type=un subject=idno r rcorr; run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If this random slope is one slope for one subject. Try this:
data trial; call streaminit(123); do idno=1 to 10; do time=1 to 4; globalcog=rand('normal'); brain=rand('normal'); output; end; end; run; ods output SolutionR= SolutionR; proc mixed data=trial; class idno time ; model GLOBALCOG = time brain/s chisq RESIDUAL; /*random intercept /subject=idno solution ;*/ random brain/subject=idno solution ; /*repeated time/type=un subject=idno r rcorr;*/ run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
First, your PROC MIXED code does not seem to be appropriate. It looks to me that you wanted to fit a random coefficients model? If so, TIME should not be a CLASS variable, and you should have the SUBJECT= option in the RANDOM statement. Then with this modified RANDOM statement, your REPEATED statement with TYPE=UN structure is likely over-fitting your data and might need to be removed.
proc mixed data=trial;
class idno ;
model GLOBALCOG = time WMFA WMH ICV brainvol AGE RACE GENDER/s chisq OUTPM=WORK.PM RESIDUAL;
random intercept time / subject=idno;
run;
Then you might use approaches illustrated in the following usage note to obtain subject-specific intercept and slope estimates.
Hope this helps,
Jill
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks!!