2

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.

kjetil b halvorsen
  • 63,378
  • 26
  • 142
  • 467
Michael
  • 121
  • 8
  • You can take ideas from: https://stats.stackexchange.com/questions/398817/conditions-in-which-the-sign-of-a-coefficient-will-change-between-a-linear-proba, https://stats.stackexchange.com/questions/406860/dharma-diagnostics-testdispersion-and-testzeroinflation-interpretation, https://stats.stackexchange.com/questions/436481/how-to-interpret-quantile-residuals look into the R `DHARMa` package. – kjetil b halvorsen Nov 27 '19 at 13:39
  • 1
    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. – Michael Nov 28 '19 at 01:09
  • I don't know about sas, so some other must answer that. I added the [tag:sas] tag so people interested in that can see it. – kjetil b halvorsen Nov 28 '19 at 01:19
  • I was debating that myself. Probably the best idea. Thank you. – Michael Nov 28 '19 at 03:53

0 Answers0