I am just starting out with PROC MIXED and unable to find help at my university, so hoping someone here can help!
I am setting up a model where my outcome (weight) is measured 3 times (baseline, 12m, 18m) there is so much variability with the time weight was actually measured (baseline-68months) that I am using a continuous "time since intervention" variable.
1. Do I need to center my time variable? why?
2. Is there a general rule of thumb on when to use random slope v random intercept v both random slope and intercept? When I run it with random intercept + slope the model shows no interaction between gender*time, while the random intercept only model does—any thoughts on why this might be?
My base model is:
Weight= time since intervention
and my model w covariates
weight= time since intervention +gender + age
I was going to include a time*time var since we believe people lose more weight earlier in the study- does this make sense?
When I DON’T center time this time*time var is significant vs not signif. when I do center time- any idea what this means?
i want to test time*gender to see if the rate of weight loss differs by gender and will add that in the next model. - does this make sense? does the time variable in this case need to be time*time*gender?
Any help or thoughts in general re mixed models is appreciated.
Example of the raw data. Best as data step code pasted into a text box opened on the forum with the </> icon above the message window. Only need variables used in the model if that reduces the burden.
Example of what "centering" means to you or as applied to the raw data.
The entire Proc code.
Here is an example of the data (there are more ppts, this is just the first 25 rows)
Time= time in months from intervention.
When I speak of centering, I would grand mean center the variable as follows (subtract the mean of TIME from TIME for each row):
Time_Cent= TIME- Time_MEAN;:
</>
ID | WEIGHT | AGE | GENDER | TIME |
25003 | 122.041 | 52 | 2 | 0 |
25003 | 122.002 | 52 | 2 | 5 |
25003 | 121.883 | 52 | 2 | 12 |
25001 | 121.762 | 56 | 3 | 0 |
25001 | 121.729 | 56 | 3 | 8 |
25001 | 121.691 | 56 | 3 | 12 |
25004 | 122.122 | 42 | 2 | 0 |
25004 | 122.051 | 42 | 2 | 7 |
25004 | 122.023 | 42 | 2 | 13 |
25009 | 121.79 | 66 | 1 | 0 |
25009 | 121.763 | 66 | 1 | 7 |
25009 | . | 66 | 1 | . |
25015 | 121.904 | 40 | 2 | 0 |
25015 | . | 40 | 2 | . |
25015 | 121.777 | 40 | 2 | 56 |
25026 | 121.909 | 56 | 2 | 0 |
25026 | 121.869 | 56 | 2 | 6 |
25026 | 121.843 | 56 | 2 | 12 |
25027 | . | 36 | 2 | 0 |
25027 | . | 36 | 2 | . |
25027 | . | 36 | 2 | . |
25048 | 121.619 | 48 | 2 | 0 |
25048 | 121.573 | 48 | 2 | 6 |
25048 | 121.568 | 48 | 2 | 12 |
25059 | . | 57 | 1 | 0 |
</>
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.