Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: Residuals in Logistic Regression


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: Residuals in Logistic Regression
Date   Fri, 9 Apr 2004 18:55:09 +0100

To give this pot another stir, and to use
mutually accessible data, -logit- and -glm- 
with logit link and binomial family give quite 
different deviance residuals. 

The pattern of -glm-'s makes sense, 
but that of -logit-'s is more puzzling. 

Something's wrong here; is it my understanding? 

sysuse auto, clear
logit foreign mpg 
predict logitdev, dev
glm  foreign mpg, link(logit) f(binomial) 
predict glmdev, dev
scatter *dev
scatter logitdev mpg, mlabel(foreign)
scatter glmdev mpg, mlabel(foreign)

Nick 
[email protected] 

Richard Williams
> 
> >I obviously don't understand how the residual statistics 
> work in logistic 
> >regression.  I have run a logistic regression of happymar 
> (coded 0, 1) on 
> >church and female (also both 0, 1) and educ (years of 
> education).  I then 
> >use predict to get the deviance residuals (I get similar 
> results if I use 
> >the rstandard or residuals options on predict).  I get the following:
> >
> >. extremes  dev p happymar church female educ, nolabel high
> >
> >   +----------------------------------------------------------------+
> >   | obs:        dev          p   happymar   church   female   educ |
> >   |----------------------------------------------------------------|
> >   |  43.   1.170689   .5039612          1        1        0     10 |
> >   |   2.   1.394511   .3782007          1        0        1     10 |
> >   |   6.     2.4859   .0858805          0        0        0     11 |
> >   |  13.     2.4859   .0858805          1        0        0     11 |
> >   |  36.     2.4859   .0858805          1        0        0     11 |
> >   +----------------------------------------------------------------+
> 
> To follow up on my own message:  I ran the same logistic 
> regression in 
> SPSS, and its residuals statistics behave as I would expect, 
> i.e. case 6 is 
> not an outlier but cases 13 and 36 are.  As far as I can 
> tell, with Stata's 
> logistic regression, the residuals produced by the 
> -deviance-, -rstandard-, 
> and -deviance- parameters on -predict- will all be the same 
> for cases that 
> have the same values on the covariates, regardless of whether 
> they have the 
> same value on the outcome measure.  I imagine there is a 
> logic behind this, 
> but I don't know what it is, and it is not the same logic 
> used by SPSS in 
> computing residuals.

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index