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

I've run a mixed model and want to plot the Actual by. Predicted values.  In JMP you can plot the predicted values or the Conditional predicted values (the values with Random Effects included) as the x-var.  I see that in Proc Mixed you have the option of saving the predicted values as OUTPRED=filename but is this using the Predicted or Conditional Predicted values?  Then, how do I graph them?  Thanks.

 

Or, is it better to use Proc PLM?

proc mixed data=source;
  class hyb ntrt;
  model y = a b a*b / redidual outpred=predicted;
  random hyb ntrt hyb*ntrt ;
  lsmeans a b / pdiff=all cl adjust=tukey alpha=0.10;
  title 'Model A';
  store ModA;
run;

proc plm restore=ModA;
  effectplot;
run;
1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

See the examples and discussion in "Visualize a mixed model that has repeated measures or random coefficients"

 

Briefly:

  • use PROC PLM to obtain a graph of the predictions from the "marginal model" that contains the fixed effects
  • The OUTPRED= option on the MODEL statement creates an output data set in which the predicted values incorporate random effects for each subject. Then use PROC SGPLOT to graph them, as shown in the article.

View solution in original post

2 REPLIES 2
Rick_SAS
SAS Super FREQ

See the examples and discussion in "Visualize a mixed model that has repeated measures or random coefficients"

 

Briefly:

  • use PROC PLM to obtain a graph of the predictions from the "marginal model" that contains the fixed effects
  • The OUTPRED= option on the MODEL statement creates an output data set in which the predicted values incorporate random effects for each subject. Then use PROC SGPLOT to graph them, as shown in the article.
Daisy2
Obsidian | Level 7

Thanks for your help with this. This is what I ended up adding:  

 

proc mixed data=source;
  class hyb ntrt;
  model tnc = a b a*b / residual outpred=predicted;
  random hyb ntrt hyb*ntrt ;
  lsmeans a b / pdiff=all cl adjust=tukey alpha=0.10;
  title 'Model A';
  store ModA;
run;

proc sgplot data=predicted;
  title "Predicted vs Actual Graph";
  scatter x=Pred y=tnc;
  lineparm x=0 y=0 slope=1; /** intercept, slope **/
  xaxis grid; yaxis grid;
run;

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