BookmarkSubscribeRSS Feed
sky1
Calcite | Level 5

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.

5 REPLIES 5
SteveDenham
Jade | Level 19

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

PGStats
Opal | Level 21

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.

PG
lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12

Actually, adjust=tukey is valid in GLIMMIX. There are many possible adjustments. Check the User's Guide.

SAS/STAT(R) 9.3 User's Guide

lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12

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.

SteveDenham
Jade | Level 19

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

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 5 replies
  • 2154 views
  • 1 like
  • 4 in conversation