Skip to contents

A drop-in replacement for summary.glm that produces the identical coefficient table, dispersion estimate, and (optionally) correlation matrix, but omits the five-number summary of the deviance residuals (summary(object$deviance.resid)) that summary.glm() always computes and stores in its deviance.resid component. That residual summary is cheap for a single fit but adds up when summarizing thousands of GLM fits in a resampling loop (e.g. bootstrap or randomization replicates elsewhere in this package), so this function skips it entirely; the returned object's deviance.resid component is simply absent rather than populated, which will matter to code that calls print.summary.glm() on the result or otherwise inspects that field. Every other computation — dispersion estimation (Pearson \(X^2/\mathrm{df}\) for Gaussian/Gamma/inverse-Gaussian families, fixed at 1 for Poisson/binomial, unless dispersion is supplied explicitly), the coefficient table (Wald z tests when dispersion is fixed/known, t tests with df.residual degrees of freedom when dispersion is estimated), and the optional correlation/symbolic.cor outputs, is identical to summary.glm.

Usage

summary_glm_lean(
  object,
  dispersion = NULL,
  correlation = FALSE,
  symbolic.cor = FALSE,
  ...
)

Arguments

object

A fitted glm object.

dispersion

The dispersion parameter for the fitting family; if NULL (default), estimated as in summary.glm (fixed at 1 for poisson/binomial, else the Pearson-residual-based moment estimate).

correlation

Logical; if TRUE, the estimated correlation matrix of the coefficients is returned and printed. Default FALSE.

symbolic.cor

Logical; if TRUE and correlation = TRUE, the correlation matrix is printed in symbolic form (see symnum) rather than as numbers. Default FALSE.

...

Currently unused; present only for signature compatibility with summary.glm.

Value

An object of class c("summary.glm") with the same components as summary.glm's return value except deviance.resid, which is not computed and is absent from the result.

See also

summary.glm, of which this is a residual-summary-skipping variant.

Examples

fit = glm(rbinom(10, 1, 0.5) ~ rnorm(10), family = binomial)
summary_glm_lean(fit)
#> 
#> Call:
#> glm(formula = rbinom(10, 1, 0.5) ~ rnorm(10), family = binomial)
#> 
#> Coefficients:
#>             Estimate Std. Error z value Pr(>|z|)
#> (Intercept)  -0.3889     0.8009  -0.486    0.627
#> rnorm(10)    -0.7995     0.9863  -0.811    0.418
#> 
#> (Dispersion parameter for binomial family taken to be 1)
#> 
#>     Null deviance: 13.863  on 9  degrees of freedom
#> Residual deviance: 13.156  on 8  degrees of freedom
#> AIC: 17.156
#> 
#> Number of Fisher Scoring iterations: 4
#>