turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Another question about GENMOD Gamma log link error...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-28-2011 08:22 PM

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!

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!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-29-2011 09:06 AM

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.

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-29-2011 04:02 PM

Hi lvm, I tried that on my data, and your information is quite helpful! Thank you very much!