Hi,
I'm using SAS 9.4 for a project at work and would like to know how the line on a Pearson Residuals Plot in PROC MIXED would be calculated by hand.
Does anybody know what equation SAS uses to calculate the straight line on the plot above?
I would like to know the procedure used so I can calculate it myself.
Thank you 🙂
From your description, you might have already read my article about how to add a line to a Q-Q plot.
I can't tell from your graph whether these are the marginal or conditional residuals, but you can get the residuals into a data set by using the RESIDUAL option on the MODEL statement and also specifying the OUTPM= or OUTP= options to get the marginal or conditional residuals, respectively. If you post your syntax, we can help you.
To answer your question, read about how to create a Q-Q plot by hand. I believe this is a normal Q-Q plot, which means that you are comparing the distribution of the observed residuals and the quantiles of the standard normal distribution. For this case, you can use PROC UNIVARIATE to create the Q-Q plot. The documentation shows the formulas that are used, in case you want to check the answer manually.
Thank you Rick that's really useful.
I have managed to get the residuals out using outpm = and have now recreated the QQ plot using PROC UNIVARIATE which is very helpful
ods graphics on; proc mixed data=data; class treatment; model x_level = treatment / residual outpm = resid; run; ods graphics off; proc univariate data = resid; var PearsonResid; histogram PearsonResid / normal(sigma=1); QQplot PearsonResid / normal(mu=0 sigma=1); run;
I wanted to plot the residuals as a standard normal probability plot, so have used the code above.
The line plotted using this matches up with the one plotted in PROC MIXED so I was just wondering does PROC MIXED always plot a line y = x for any normal data?
> does PROC MIXED always plot a line y = x for any normal data?
When you STANDARDIZE the data so that if has mean=0 and StdDev=1, then the reference line is the identity line. The identity line has SLOPE=1 and Intercept=0. See the connection?
Yes that is a lot clearer now.
Thank you very much for your help!
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.