BookmarkSubscribeRSS Feed
maomiss
Calcite | Level 5
Hi,

I am building a model as follows:

proc genmod data = aa;
model totalmedcost= PDC age sex race education /dist=gamma link=log;
run;

Here, I need to check if the estimate of the major predictor PDC is appropriate or unbiased. One of methods is to plot the error of the model (deviance) against PDC to see whether the error is randomly scattered around PDC; another way is to examine the association between deviance and PDC.

However, when I use PLOTS=RESDEV(XBETA), it only generates the plots of deviance residuals as a function of linear predictor, not necessarily the major predictor.

Q1: How could I get the plot of deviance against the specific predictor I want after controlling all the covariates?

Q2: How to get the deviance residual (DR) for each observation, so that I could run the regression of (DR) agaist the predictor PDC?

Thanks for help!
2 REPLIES 2
lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12
One way is to use the OUTPUT statement, with the needed keywords. You will need to check out the documentation, but something like:
output out=results pred=yhat resdev=resdev stdresdev=sresdev;

This example creates a file with yhat for the predicted log link, resdev for the deviance residual, and sresdev for the standardized deviance residuals. There are several other possible variables that can be created (other types of residuals, and so on). The file automatically has all your other (original) variables. Use a proc print data=results; to see what is in the file.
Then you can then use proc gplot, or one of the statistical graphics procedures to plot the relevant residuals vs. your predictor variables.

There may be other ods graphics options built right into GENMOD for doing this, but you will need to check out the documentation.
maomiss
Calcite | Level 5
Hi lvm, I tried that on my data, and your information is quite helpful! Thank you very much!

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 1515 views
  • 0 likes
  • 2 in conversation