What do the residuals in a logistic regression mean? In answering this question John Christie suggested that the fit of logistic regression models should be assessed by evaluating the residuals.  I'm familiar with how to interpret residuals in OLS, they are in the same scale as the DV and very clearly the difference between y and the y predicted by the model.  However for logistic regression, in the past I've typically just examined estimates of model fit, e.g. AIC, because I wasn't sure what a residual would mean for a logistic regression.  After looking into R's help files a little bit I see that in R there are five types of glm residuals available, c("deviance", "pearson", "working","response", "partial").  The help file refers to:  


*

*Davison, A. C. and Snell, E. J. (1991) Residuals and diagnostics. In: Statistical Theory and Modelling. In Honour of Sir David Cox, FRS, eds. Hinkley, D. V., Reid, N. and Snell, E. J., Chapman & Hall.  


I do not have a copy of that.  Is there a short way to describe how to interpret each of these types?  In a logistic context will sum of squared residuals provide a meaningful measure of model fit or is one better off with an Information Criterion?
 A: On Pearsons residuals,
The Pearson residual is the difference between the observed and estimated probabilities divided by the binomial standard deviation of the estimated probability. Therefore standardizing the residuals.
For large samples the standardized residuals should have a normal distribution.
From Menard, Scott (2002). Applied logistic regression analysis, 2nd Edition. Thousand Oaks, CA: Sage Publications. Series: Quantitative Applications in the Social Sciences, No. 106. First ed., 1995. See Chapter 4.4
A: The working residuals are the residuals in the final iteration of any iteratively weighted least squares method. I reckon that means the residuals when we think its the last iteration of our running of model. That can give rise to discussion that model running is an iterative exercise.
A: The easiest residuals to understand are the deviance residuals as when squared these sum to -2 times the log-likelihood. In its simplest terms logistic regression can be understood in terms of fitting the function $p = \text{logit}^{-1}(X\beta)$ for known $X$ in such a way as to minimise the total deviance, which is the sum of squared deviance residuals of all the data points.
The (squared) deviance of each data point is equal to (-2 times) the logarithm of the difference between its predicted probability $\text{logit}^{-1}(X\beta)$  and the complement of its actual value (1 for a control; a 0 for a case) in absolute terms. A perfect fit of a point (which never occurs) gives a deviance of zero as log(1) is zero. A poorly fitting point has a large residual deviance as -2 times the log of a very small value is a large number. 
Doing logistic regression is akin to finding a beta value such that the sum of squared deviance residuals is minimised. 
This can be illustrated with a plot, but I don't know how to upload one.
A: *

*Pearson Residuals
As tosonb1 points out, "The Pearson residual is the difference between the observed and estimated probabilities divided by the binomial standard deviation of the estimated probability". 
I just wanted to mention that Pearson residual is mostly useful with grouped data i.e, say, there are $n_i$ trials at setting i of the explanatory variables (many observations for the same value of predictors) and let $y_i$ denote the number of “successes” for $n_i$ trials. Also, let $\hat{π_i} $ denote the estimated probability of success for the logistic regression model we have fit.
Pearson residual = $e_i = \frac{y_i - \hat{π_i}}{\sqrt {n_i \hat{π_i}(1 - \hat{π_i})}}$
For ungrouped binary data and often when explanatory variables are continuous, each $n_i$ = 1. Then, $yi$ can equal only 0 or 1, and a residual can assume only two values and is usually uninformative. Plots of residuals also then have limited use,
consisting merely of two parallel lines of dots.
From, An Introduction to Categorical Data Analysis, 2nd Edition by Alan Agresti - vide chapter 5, section 5.2.4


*Deviance Residuals
(I am not entirely sure about this one, please point out errors, if any)
The i-th deviance residual can be computed as square root of twice the difference between loglikelihood of the ith observation in the saturated model and loglikelihood of the ith observation in the fitted model. Saturated Model is the model that predicts each observation perfectly and for all purposes in logistic regression, loglikelihood of saturated model $= ln(1) = 0$. Finally, we add a sign '+' in front of the residual if the observed response is 1 and put '-' if the observed response is 0.
Hence, deviance residual for the ith observation, 
$$d_i = (-1)^{y_i + 1}\sqrt{-2 (y_i ln(\hat{π_i}) + (1-y_i) ln(1 - \hat{π_i}))}$$ $y_i \in $ {0,1}
The sum of squares of deviance residuals add up to the residual deviance which is an indicator of model fit.
If a deviance residual is unusually large (which can be identified after plotting them) you might want to check if there was a mistake in labelling that data point.
A: Response:
$$y_i - \hat\mu_i$$
response residuals are inadequate for assessing a fitted glm, because GLMs are based on distributions where (in general) the variance depends on the mean.
Pearson:
The most direct way to handle the non-constant variance is to divide
it out:
$$ \frac{y_i - \hat\mu_i}{\sqrt{V(\mu_i)|_{\hat\mu_i}}}$$
where $V()$ is the (GLM) variance function ($Var(y_i) = a(\phi)*V(\mu_i)$)
Under "Small dispersion asymptotics" conditions, the Pearson residuals have an approximate normal distribution.
Deviance: $$sign(y_i-\hat\mu_i)*\sqrt{d_i}$$ where $d_i$ is the unit deviance, i.e. $d_i = 2(t(y_i,y_i)-t(y_i,\hat\mu_i))$
The deviance statistic (sum of squared unit-deviances) has an approximate chi-square distribution (when the saddlepoint approximation applies and under "Small dispersion asymptotics" conditions). Under these same conditions, the deviance residuals have an approximate normal distribution.
Working:
$$z_i - \eta_i $$
where $z_i$ are the working responses $\eta_i + \frac{d\eta_i}{d\mu_i}(y_i-\hat\mu_i)$ and $\eta_i$ is the linear predictor. Meaning you get that the residual is $\frac{d\eta_i}{d\mu_i}(y_i-\hat\mu_i)$.
The model coefficients are fitted using Fisher scoring algorithm / Iterative Reweighted Least Square (IRLS). And it can be shown that each iteration of this algorithm is equivalent to doing ordinary least-squares on the working responses as defined here.
To test the link function - plotting the linear predictor against the working responses should come out linear if the right link function was used.
Partial:
$$z_i - \eta_i + X^*\beta$$
where $X^*$ is the centered $X$. Partial residuals can be used to determine if a covariate/predictor is on an inappropriate scale.
Quantile:
$$\Phi^{-1}(F(y_i))$$
Where $F(y_i)$ is the CDF of $y_i$, and $\Phi^{-1}$ is the quantile function of standard normal (inverse CDF). For discrete $y_i$'s you take $u \sim Unif(F(y_i-1), F(y_i))$ and $\Phi^{-1}(u)$.
Here is an example code to calculate these residuals:
Y = c(0,0,0,0,1,1,1,1,1)
x1 = c(1,2,3,1,2,2,3,3,3)
x2 = c(1,0,0,1,0,0,0,0,0)

fit = glm(y ~ x1 + x2, family = 'binomial')

lp = predict(fit)
mu = exp(lp)/(1+exp(lp))

# manually calculating the 1st response residual
resid(fit, type="response")[1]
Y[1] - mu[1]

# manually calculating the 1st pearson residual
resid(fit, type="pearson")[1]
(Y[1]-mu[1]) / sqrt(mu[1]*(1-mu[1]))

# manually calculating the 1st deviance residual
resid(fit, type="deviance")[1]
sqrt(-2*log(1-mu[1]))*sign(Y[1]-mu[1])

# manually calculating the 1st working residual
resid(fit, type="working")[1]
(Y[1]-mu[1]) / (mu[1]*(1-mu[1]))

# manually calculating the 1st partial residual
resid(fit, type="partial")[1,1]
(Y[1]-mu[1]) / (mu[1]*(1-mu[1])) + fit$coefficients[2]*(x1[1] - mean(x1))
resid(fit, type="partial")[1,2]
(Y[1]-mu[1]) / (mu[1]*(1-mu[1])) + fit$coefficients[3]*(x2[1] - mean(x2))

# manually calculating the 1st quantile residual
library(statmod)
qresid(fit)[1] # results are random (uniformly), so won't come the same
a = pbinom(Y[1]-1, 1, mu[1]) 
b = pbinom(Y[1], 1, mu[1])
qnorm(runif(1, a, b)) # results are random (uniformly), so won't come the same
n = 10000
mean(replicate(n, qresid(fit)[1]))
mean(qnorm(runif(1000, a, b))) # should be close

For more information I suggest you check this book: Generalized Linear Models With Examples in R:
working response - section 6.3, working residuals - section 6.7, response residuals - section 8.3.1, pearson residuals - section 8.3.2, deviance residuals - section 8.3.3, partial residuals - section 8.7.3
So,

will sum of squared residuals provide a meaningful measure of model fit ?

For Deviance/Pearson - I think so.
But more generally inspecting the residuals can be a bit tricky. In many cases neither the Pearson nor deviance residuals can be guaranteed to have distributions close to normal, especially for discrete distributions. "Small dispersion asymptotics" need to hold (see section 7.5 in the book), so some rule of thumbs are used. For Binomial distributions, and the deviance residual $\min(n_i y_i) > 3$ as well as $\min(n_i(1-y_i)) > 3$. There are also the Quantile Residuals that can be used when these conditions are not met. Check section 8.3.4 of the book.
