BookmarkSubscribeRSS Feed
farag
Calcite | Level 5

hi there

 

I am trying to plot rresiduals in proc mixed for fixed and random effect for a big data but I do not know how.

Can anybody give me some example and different was for plooting residuals in proc mixed please?

 

regards,

Farg

1 REPLY 1
StatsGeek
SAS Employee

 

To get residuals in PROC MIXED for a large data set, you need to add the RESIDUAL option to the model statement. This requests plots of both conditional and marginal residuals. However, ODS supresses plots with more than 5000 points by default. To remove this restriction, add plot(maxpoints=none) to the PROC MIXED statement. Here's an example:

 

proc mixed data=mydata plots(maxpoints=none);

class id;

model y = x / ddfm=kr2 residual;

random int / subject=id;

run;

 

On a side note, I recommend that you also plot the predicted values for the random effects (the EBLUPS). Like the residuals, the random effects are assumed to be normally distributed and unrelated to the predictors. You can request EBLUPS with the SOLUTION option on the RANDOM statement, and then output them with an ODS OUTPUT statement. Here's an example:

 

proc mixed data=mydata plots(maxpoints=none);

class id;

model y = x / ddfm=kr2 residual;

random int / subject=id solution;

ods output solutionr=randomeffects;

run;

 

The data set of EBLUPS can then be combined with your original data for graphing. 

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1 reply
  • 5354 views
  • 0 likes
  • 2 in conversation