rglmsummary

R summary of GLM not showing Deviance Residuals


I wish to see the summary of deviance residuals when I run summary on a GLM in R. I believe this should be shown by default, however it doesn't appear for me. I am aware that I can use something like

summary(resid(model,type="deviance")) 

to access this information but I want the deviance of residuals to be displayed in the summary along with all the other information.

I am following a tutorial and this is the example:

#fit logistic regression model
model <- glm(am ~ disp + hp, data=mtcars, family=binomial)

#view model summary
summary(model)

The output I get form the summary is:

Call:
glm(formula = am ~ disp + hp, family = binomial, data = mtcars)

Coefficients:
            Estimate Std. Error z value Pr(>|z|)  
(Intercept)  1.40342    1.36757   1.026   0.3048  
disp        -0.09518    0.04800  -1.983   0.0474 *
hp           0.12170    0.06777   1.796   0.0725 .
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 43.230  on 31  degrees of freedom
Residual deviance: 16.713  on 29  degrees of freedom
AIC: 22.713

Number of Fisher Scoring iterations: 8

This does not contain the deviance residuals. I believe the output should be:

Call:
glm(formula = am ~ disp + hp, family = binomial, data = mtcars)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-1.9665  -0.3090  -0.0017   0.3934   1.3682  

Coefficients:
            Estimate Std. Error z value Pr(>|z|)  
(Intercept)  1.40342    1.36757   1.026   0.3048  
disp        -0.09518    0.04800  -1.983   0.0474 *
hp           0.12170    0.06777   1.796   0.0725 .
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 43.230  on 31  degrees of freedom
Residual deviance: 16.713  on 29  degrees of freedom
AIC: 22.713

Number of Fisher Scoring iterations: 8

Solution

  • This is due to a change that was implemented in R version 4.3.0.

    The R developers detail any changes, new functions, bug fixes, deprecations etc in each new R-version at https://cran.r-project.org/doc/manuals/r-release/NEWS.html. While it may be easier to just read through this web-page to look for any relevant changes, the news file can also be accessed through the R terminal using the news()function. See ?news on tips on how to search; for your query you could try the following:

    db = news()
    news(grepl("deviance residuals", Text), db=db)
    

    This leads to the following

    Changes in version 4.3.0
    NEW FEATURES

    The print() method for class "summary.glm" no longer shows summary statistics for the deviance residuals by default. Its optional argument show.residuals can be used to show them if required.

    Thus you can see the summary of the deviance residuals with an explicit print call:

    print(summary(model),show.residuals=TRUE)