I am struggling to output or calculate Studentized Residuals in Proc NLMIXED.
Your help would be appreciated,
Thank you,
Marcio
Thank you Steve, I ended up get this working and here is how.
As always thanks for your input,
Marcio
predict L + U*(z1) out=ppp;
run;
data ppp; set ppp;
resid=y-pred;
resid_t=resid; run;
proc standard data=ppp std =1 out =pred_std;
var resid_t;
run;
title;
proc print data=ppp; run;
proc print data=pred_std;
run;
symbol1 value=dot color=blue i=none;
proc gplot data=pred_std;
plot resid_t*x resid_t*pred/vref=(0);
run;
I don't know, and the person who I think does is seldom found around here anymore. However, take a look at Dale McLerran's post:
https://communities.sas.com/message/55521#55521
where he calculates individual deviances for a Poisson. I believe you could take the square root of the individual deviance and use it as a denominator in calculating the studentized residual. to me, the key statement is the PREDICT statement with the OUT= option.
Steve Denham
Thank you Steve, I ended up get this working and here is how.
As always thanks for your input,
Marcio
predict L + U*(z1) out=ppp;
run;
data ppp; set ppp;
resid=y-pred;
resid_t=resid; run;
proc standard data=ppp std =1 out =pred_std;
var resid_t;
run;
title;
proc print data=ppp; run;
proc print data=pred_std;
run;
symbol1 value=dot color=blue i=none;
proc gplot data=pred_std;
plot resid_t*x resid_t*pred/vref=(0);
run;
You should give yourself a "Correct answer". The use of STANDARD is something I overlook way too often.
Steve Denham
proc standard would not be giving you the standardized or studentized residual. You need to obtain the estimated standard error for EACH residual, which is not directly given by NLMIXED.The standard procedure is just scaling by the the variation in the raw residuals (not the same thing). I think getting standardized residuals from NLMIXED will require some coding (post-model-fitting) which would depend on the chosen conditional distribution. It would require the "hat" matrix.
lvm, thanks. This is what I have used.
data ppp; set ppp;
resid=y-pred;
resid_t=resid; run;
proc standard data=ppp std =1 out =pred_std;
var resid_t;
run;
proc standard will not give you a standardized or studentized residual. Each residual has a unique variance, var(r_i), and you cannot recover this from proc standard (even though I saw a website that says that you can).
I think I saw the same thing, hence my excitementat using PROC STANDARD. I think an IML solution may be the only way out now.
Steve Denham
Hi Steve, do you have any directions on how I could get that?
Hi Steve, thanks!!! I was not able to find nothing related to NLMIXED or 'studentized' in his blog, any idea what I should look at?
Thanks,
Marcio
It wouldn't be specific, but more as background on how to use IML to calculate what you need from the various matrixes, following 's note regarding the individual variances of the residual.
Now it seems to me that a residual is a sum of two non-independent random variables, and the estimate and the Y value are correlated, so the key is getting the covariance between the two to estimate the variance of the residual. Surely someplace on the web has a matrix representation. Then it is just a matter of of following the right examples in the documentation and Rick's blog.
Steve Denham
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.