I'm looking for a quick reference on how to do some residual analysis for logistic regression in R. Oddly enough, this has not been easy to find.

The data set I am working with is the Add.dat which can be found here: https://www.uvm.edu/~dhowell/fundamentals9/DataFiles/

Once imported I had to convert the binary variables to factors:

cols <- c(3, 4, 9, 10)
Add[,cols] <- lapply(Add[, cols], factor)

The model I'm using is very simple:

glm(formula = Repeat ~ ADDSC, family = binomial, data = Add)

I have several questions that should be relatively straight forward for the experienced:

  1. How do I find the leverage of the predictor variable?
  2. How do I find Cook's distance (namely, the cooks.distance function does seem to work for glm according to the help file, but I would just like validation of that)?
  3. How do I find the dfBeta values for the slope?
  4. Similarly, is there a way to get the delta chi-square/delta deviance for the observations?

Also, what is a good way of graphing the pearson residuals?

In short, I am basically looking to replicate the output of adding the influence command in SAS for logistic regression.

  • $\begingroup$ You can take ideas from: stats.stackexchange.com/questions/398817/…, stats.stackexchange.com/questions/406860/…, stats.stackexchange.com/questions/436481/… look into the R DHARMa package. $\endgroup$ Nov 27, 2019 at 13:39
  • 1
    $\begingroup$ Thanks for this resource. I'm working through it now. It's very cool and surprisingly intuitive. I am going to use this, but, that said, this doesn't (so far as I can tell) answer my questions. The reason I need direct answers is because I'm specifically trying to replicate what SAS is doing in helping a professor of mine, and I obviously don't want to get it wrong. I will, however, also work through dharma and show it to her as well. $\endgroup$
    – Michael
    Nov 28, 2019 at 1:09
  • $\begingroup$ I don't know about sas, so some other must answer that. I added the sas tag so people interested in that can see it. $\endgroup$ Nov 28, 2019 at 1:19
  • $\begingroup$ I was debating that myself. Probably the best idea. Thank you. $\endgroup$
    – Michael
    Nov 28, 2019 at 3:53


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.