BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
GiaLee
Obsidian | Level 7

Dear all,

I am feeling confused about reporting the results from a mixed model. The time is categorical (with "6" set as the reference). I tested the interaction between time and overweight, adjusted for several covariates, with the outcome being a score.

Here are the results from PROC mixed output and the PROC PLM output.

 

For instance, the estimate on time_*overweight at time "12" is -0.3755.

Does this mean that at time "12", the difference in score changes between time "6" and time "12" for the overweight group is significantly different from the difference in the non-overweight group? The overweight group has a mean score 0.3755 points lower than the non-overweight group at time "12"? This description is a little bit confusing, but am I understanding it correctly?

 

Regarding the PROC PLM output, is "Y" the predicted mean at each point across different groups?

And how could I explain this figure (significant or non significant..)? Could I explain this based on the "solution for fixed effects" table?

Thank you for your help. 

 

Screen Shot 2024-03-10 at 21.16.29.png

GiaLee_0-1710120982339.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

@GiaLee The best way to get a complete answer is to post the SAS code that you are using. Otherwise, we can only guess what might be happening.

 

The OP posted essentially the same question as a comment to my blog. I responded, "The documentation for the EFFECTPLOT statement states that the covariates that are not in the plot are evaluated at a default value. For continuous covariates, the default is to use the mean. For a CLASS variable, the reference level is used. In the resulting plot, the Y axis is the predicted values of the model evaluated at the covariates."

 

You can use the AT option to set values if you do not want the default values.

 

For mixed models, there are two common "predicted values." See <a href="https://blogs.sas.com/content/iml/2018/12/19/visualize-mixed-model.html">"Visualize a mixed model that has repeated measures or random coefficients"</a> for a discussion. PROC PLM uses the OUTPREDM= values, which is from the marginal model that does not incorporate the random effects. To incorporate the random slope or intercept for each subject, use the OUTPRED= values.

View solution in original post

11 REPLIES 11
GiaLee
Obsidian | Level 7
Thank you! I have read it, and it's really helpful. I just want to confirm one more thing: if the interaction term is between two categorical variables, then the estimate represents the main difference. If the interaction term is between one categorical and one continuous variable, then the estimate represents the slope. Am I understanding this correctly? Thanks!

Additionally, do you know where I can find the values used to plot the PROC PLM figure? I thought it should be the predicted mean, and the value is from the least squares means table, but the values don't match.

Gia
Ksharp
Super User
Yes. I think so. But I am not expert about statistics , I think @Rick_SAS @lvm @SteveDenham @StatDave could give you better explanation .

"Additionally, do you know where I can find the values used to plot the PROC PLM figure? "
Sorry. I don't know. I think it is a binary file ( not writable ) , @Rick_SAS might give you a hint.
Rick_SAS
SAS Super FREQ

@GiaLee The best way to get a complete answer is to post the SAS code that you are using. Otherwise, we can only guess what might be happening.

 

The OP posted essentially the same question as a comment to my blog. I responded, "The documentation for the EFFECTPLOT statement states that the covariates that are not in the plot are evaluated at a default value. For continuous covariates, the default is to use the mean. For a CLASS variable, the reference level is used. In the resulting plot, the Y axis is the predicted values of the model evaluated at the covariates."

 

You can use the AT option to set values if you do not want the default values.

 

For mixed models, there are two common "predicted values." See <a href="https://blogs.sas.com/content/iml/2018/12/19/visualize-mixed-model.html">"Visualize a mixed model that has repeated measures or random coefficients"</a> for a discussion. PROC PLM uses the OUTPREDM= values, which is from the marginal model that does not incorporate the random effects. To incorporate the random slope or intercept for each subject, use the OUTPRED= values.

GiaLee
Obsidian | Level 7

Hi Rick, thanks for your reply.

I saw this sentence from your blog: "You can use the STORE statement and PROC PLM to obtain a graph of the predictions from the "marginal model" that contains the fixed effects. (You can also use the OUTPREDM= option for this purpose.)"

 

So I presume that I can use the predicted values in the OUTPREDM output data to generate a plot similar to what PROC PLM does. But I don't know how to do this. I attempted using PROC MEANS for the predicted values, but the results did not match.

 

Here is my code: 

 

PROC MIXED DATA = test      METHOD = REML COVTEST;
CLASS record_id younger (ref="0") time_(ref="6") female(ref="0") white (ref="0")
hispanic_(ref="0") depression_(ref="0") anxiety_(ref="0")
diabetes_(ref="0") hypertension_(ref="0") site_JL(ref="outpatien") vaccine(ref="0") overweight(ref="0")
other_comorbid(ref="0") fatigue_JL(ref="0");
MODEL Score = time_ overweight overweight*time_ younger female white
hispanic_ depression_ anxiety_
diabetes_ hypertension_ site_JL vaccine other_comorbid fatigue_JL/ SOLUTION OUTPREDM=PREDDATA S;
RANDOM INTERCEPT / SUBJECT = record_id;
repeated time_ / type=ar(1) sub=record_id;
LSMEANS time_ overweight overweight*time_/pdiff;
RUN;

proc plm restore=MixedModel;
effectplot interaction (x=time_ sliceby=overweight) / clm connect; run;

proc means data=PREDDATA; var pred;  class time_ overweight;   run;

 

 

Results: Here, we  that for group 0, at time "6", it starts from -0.2, then increases to around 0.05, and finally returns to approximately -0.1. The Y-axis is the predicted mean I think.

GiaLee_0-1710247959338.png

 

 

Here are the mean prediction values at each time. We see that the mean value differs from the figure above. 

Screen Shot 2024-03-12 at 08.55.02.png

 

 

 

Rick_SAS
SAS Super FREQ

PROC MEANS is reporting the unconditional predicted values. You are averaging over all observations, which include non-reference values of the covariate that are not shown in the plot. You need to construct a scoring data set that sets all values of the covariates to their reference (or mean) values, and then let TIME_ range over the range 6, 12, ..., 40. Then score the model on that data.

 

For an example, see the article, "How to create a sliced fit plot in SAS"

and especially the example that shows how to create a scoring data set in the section "Create a sliced fit plot manually."

GiaLee
Obsidian | Level 7

Thank you Rick. This is very helpful. 

By the way, may I ask you another question? Is there any relationship between the PROC PLM effectplot figure and the Least Squares Means estimates?


I plotted a figure using the values from the least squares means (generated from: LSMEANS time_ overweight overweight*time_/pdiff;)


We can see that the trajectory is parallel to what PROC PLM shows. However, once again, the values are slightly different.

 

Screen Shot 2024-03-12 at 08.55.19.png

Screen Shot 2024-03-12 at 17.05.01.pngScreen Shot 2024-03-12 at 17.06.29.png

 
Rick_SAS
SAS Super FREQ

The LS-means estimates are not the same as the predicted values from the model. The documentation of the LSMEANS statement explains the idea of LS-means:

  • "In the GLM, MIXED, and GLIMMIX procedures, LS-means are predicted population margins—that is, they estimate the marginal means over a balanced population. In a sense, LS-means are to unbalanced designs as class and subclass arithmetic means are to balanced designs."
  •  the LS-means are "linear combinations of the parameter estimates that are constructed in such a way that they correspond to average predicted values in a population where the levels of classification variables are balanced."

 

GiaLee
Obsidian | Level 7
Thank you!
jiltao
SAS Super FREQ

The graph from PROC PLM shows the lsmeans when the values for other effects are at zero, as shown in the footnote of the plot; the graph from LSMEANS shows the lsmeans when the values for other related effects are at their means. You can add the E option in the LSMEANS statement to see exactly how the lsmeans correspond to.

Hope this helps,

Jill

GiaLee
Obsidian | Level 7
Thank you so much! It's much clearer for me now.
Gia

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 11 replies
  • 1215 views
  • 13 likes
  • 4 in conversation