BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
JuliaV
Calcite | Level 5

I am creating a linear mixed model that includes an interaction term and a random effect based on site. The outcome is a continuous score and the predictor variables all both binary categorical variables - exposure status (yes/no) and group (a/b). I want to know the difference in means for those exposed vs unexposed separately for group a and b.  My model is:

PROC MIXED DATA = work.data1;

CLASS exposure group (ref = "b");

MODEL score = exposure group exposure*group;

RANDOM site /subject = id type = un SOLUTION;

RUN;

I've tried using ESTIMATE statements, LSMEANS, and LSMESTIMATE but I can't seem to get the output that I need. Any help would be appreciated! I am running SAS 9.4 on windows. 

1 ACCEPTED SOLUTION

Accepted Solutions
SteveDenham
Jade | Level 19

I see a couple things that might be causing problems.  The first is the variable 'site'. Is this numeric?  If so, then make sure your data are sorted by site.  If it is not (and this applies even if it is numeric), you should probably include it in your CLASS statement. The variable 'id' should also be in the CLASS statement.I would rewrite the RANDOM statement as:

 

RANDOM intercept site/subject=id SOLUTION;

This would fit a variance component structure rather than the unstructured covariance you specified.  With type=UN, you are estimating id*(id-1)/2 parameters, and I suspect that you may not have enough data to do that efficiently.

 

So with all this, I would try the following statements:

LSMEANS exposure group/diff;

SLICE exposure*group/diff;

 

The first will give the marginal means and a test for significance for the main effects of exposure and group..  The second will give differences of exposure at each level of group, and differences of group at each level of exposure.  An equivalent approach to SLICE using the LSMESTIMATE statement would look like

LSMESTIMATE exposure*group 'Exposure difference for group A' 1 -1 0 0,

                                                     'Exposure difference for group B' 0 0 1 -1,

                                                     'Group difference for exposure 1' 1 0 -1 0,

                                                     'Group difference for exposure 2' 0 1 0 -1;

Since PROC MIXED doesn't support the SLICEDIFF statement, you will likely have to use the LSMESTIMATE approach for the interaction.

 

SteveDenham

 

 

 

 

View solution in original post

2 REPLIES 2
StatDave
SAS Super FREQ

Use the SLICE statement. For example:

slice exposure*group / sliceby=group means;
SteveDenham
Jade | Level 19

I see a couple things that might be causing problems.  The first is the variable 'site'. Is this numeric?  If so, then make sure your data are sorted by site.  If it is not (and this applies even if it is numeric), you should probably include it in your CLASS statement. The variable 'id' should also be in the CLASS statement.I would rewrite the RANDOM statement as:

 

RANDOM intercept site/subject=id SOLUTION;

This would fit a variance component structure rather than the unstructured covariance you specified.  With type=UN, you are estimating id*(id-1)/2 parameters, and I suspect that you may not have enough data to do that efficiently.

 

So with all this, I would try the following statements:

LSMEANS exposure group/diff;

SLICE exposure*group/diff;

 

The first will give the marginal means and a test for significance for the main effects of exposure and group..  The second will give differences of exposure at each level of group, and differences of group at each level of exposure.  An equivalent approach to SLICE using the LSMESTIMATE statement would look like

LSMESTIMATE exposure*group 'Exposure difference for group A' 1 -1 0 0,

                                                     'Exposure difference for group B' 0 0 1 -1,

                                                     'Group difference for exposure 1' 1 0 -1 0,

                                                     'Group difference for exposure 2' 0 1 0 -1;

Since PROC MIXED doesn't support the SLICEDIFF statement, you will likely have to use the LSMESTIMATE approach for the interaction.

 

SteveDenham

 

 

 

 

Ready to join fellow brilliant minds for the SAS Hackathon?

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!
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
  • 2 replies
  • 553 views
  • 1 like
  • 3 in conversation