Residuals in logistic regression

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 138
Accepted Solution

Residuals in logistic regression

Hello,

I have created a multiple logistic regression model and am trying to look at the residuals. The only process I have found (iplots) prints residuals for about 100 participants at a time, which is not ideal since I have over 5000 study subjects. Any help is much appreciated!

Thanks.


Accepted Solutions
Solution
‎01-28-2013 11:14 AM
Frequent Contributor
Posts: 138

Re: Residuals in logistic regression

Posted in reply to Walternate

proc logistic data=mydata;

class var1(reference=1) var2(reference=1) var3(reference=1);

model case(event='1')=var1 var2 var3/rsq ctable pprob=(0 to 1 by .1) lackfit risklimits iplots;

run;

View solution in original post


All Replies
Super User
Posts: 19,769

Re: Residuals in logistic regression

Posted in reply to Walternate

Show your work/code please. 

Super Contributor
Posts: 543

Re: Residuals in logistic regression

Posted in reply to Walternate

How about

ODS GRAPHICS ON;

proc logistic data = your_data plots = (all);

     model y = x;

run;

In my case, the plots are saved on the C:\Documents and Settings\User

Good luck,

Anca.

Solution
‎01-28-2013 11:14 AM
Frequent Contributor
Posts: 138

Re: Residuals in logistic regression

Posted in reply to Walternate

proc logistic data=mydata;

class var1(reference=1) var2(reference=1) var3(reference=1);

model case(event='1')=var1 var2 var3/rsq ctable pprob=(0 to 1 by .1) lackfit risklimits iplots;

run;

Super User
Posts: 19,769

Re: Residuals in logistic regression

Posted in reply to Walternate

I think Anca solution is what you're looking for. In addition, I think you need to add the /param=ref option to your class statement.

Take a look at your output, specifically the Class level information and see if its what you want (basically your design matrix) or if you want the option I suggested.

Frequent Contributor
Posts: 138

Re: Residuals in logistic regression

Could you please explain what the /param=ref option is for?

Thanks!

Super Contributor
Posts: 543

Re: Residuals in logistic regression

Posted in reply to Walternate

In your class statement you use 'reference = 1', which tells SAS that for the variable var1 the reference category is '1'.

You need the param = ref to tell SAS to use that reference coding in parameter estimates.

Smiley Happy

----

Super User
Posts: 19,769

Re: Residuals in logistic regression

Posted in reply to AncaTilea

Not quite, it can still use that as the reference for Effect coding, but it won't be what you want necessarily.

Super Contributor
Posts: 543

Re: Residuals in logistic regression

Thank you.

Super User
Posts: 19,769

Re: Residuals in logistic regression

Posted in reply to Walternate

It specifies how SAS creates the design matrix for class variables, the default is 'EFFECT CODING' when most people want 'REFERENCE CODING' instead.

SAS FAQ: In PROC LOGISTIC why aren't the coefficients consistent with the odds ratios?

Super Contributor
Posts: 543

Re: Residuals in logistic regression

Posted in reply to Walternate

When I tried to run plots with Logistic with a data set that has more than 5000 observations I get this warning:

-------------

WARNING: Some plots have more than 5000 observations and are suppressed.  Specify the

         PLOTS(MAXPOINTS=NONE) option in the PROC LOGISTIC statement to display the plots.

Did you try this?

proc logistic data = my_data plots(maxpoints = none);

     model...;

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 10 replies
  • 760 views
  • 1 like
  • 3 in conversation