I am trying to build a linear mixed effect model assuming both random intercept and random slope. The data is like this: There are 3 groups (1 ,2 ,3) and 15 subjects in group 1, 8 subjects in group 2, 8 subjects in group 3. Each patient has been measured 3 times (time: 0, 1, 2). The outcome is continuous. so I assumed normal distribution and identity link function.
I wrote code like this:
proc glimmix data=xxx;
class group time;
model outcome = group time group*time / dist=normal link=identity;
random intercept time / subject=id type=un;
estimate "group 1 - group 2 at time 0" ....................
"group 1 - group 3 at time 0"....................
"group 2 - group 3 at time 0".................../ adjust=t;
run;
After I ran the model, I found the interaction term "group*time" is significant. So I want to estimate the differences between groups at time 0 and adjust p-values by tukey. But I am not sure how to specify the values of fixed effect and random effect in the "estimate" statement. can anyone help with this?
In addition, if I specify time as linear instead of categorical variable, would it change the way how we specify the values of fixed effect and random effect?
Thanks.
I think you will want to approach this slightly differently. Since your data are Gaussian, I would model the repeated nature of the design as an R side effect, rather than a G side. This will make the "random" effect of time more easily handled in lsmeans. I would use the LSMESTIMATE statement in GLIMMIX for the comparisons. Thus, the code would look something like:
proc glimmix data=xxx;
class group time id;
model outcome = group time group*time / dist=normal link=identity;
random time /residual subject=id type=un;/*This fits an R side repeated structure*/
lsmestimate group*time "group 1 - group 2 at time 0" 1 0 0 -1 0 0 0 0 0,
"group 1 - group 3 at time 0" 1 0 0 0 0 0 -1 0 0,
"group 2 - group 3 at time 0" 0 0 0 1 0 0 -1 0 0/ adjust=t elsm;/*The elsm option prints the K matrix. Check it to make sure the comparisons I have here match your set-up */
run;
Of course, additional lsmestimate entries, or blocks, can be entered, depending on how you want to adjust your p values.
Steve Denham
Just a note. ADJUST=T is not shorthand for ADJUST=TUKEY. ADJUST=T calls for t-tests with no adjustment. ADJUST=TUKEY is not available for LSMeans differences. The choice of adjustment methods for LSMeans differences in GLIMMIX is quite limited.
Actually, adjust=tukey is valid in GLIMMIX. There are many possible adjustments. Check the User's Guide.
Oops. adjust=tukey IS available with the lsmeans statement (for pairwise differences). However, it is NOT available for estimate or lsmestimate statements. Sorry for confusion.
So, the answer (if someone really wants Tukey's adjustment) would be to use the STORE statement, and follow with PROC PLM, which has the full array of adjustment methods.
OTOH, perhaps using one of the available methods such as adjust=simulate would provide better coverage.
Steve Denham
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.