
Lean GLM Summary (Skips Deviance Residual Quantiles)
Source:R/helper_robust_regression.R
summary_glm_lean.RdA 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.
Arguments
- object
A fitted
glmobject.- dispersion
The dispersion parameter for the fitting family; if
NULL(default), estimated as insummary.glm(fixed at 1 forpoisson/binomial, else the Pearson-residual-based moment estimate).- correlation
Logical; if
TRUE, the estimated correlation matrix of the coefficients is returned and printed. DefaultFALSE.- symbolic.cor
Logical; if
TRUEandcorrelation = TRUE, the correlation matrix is printed in symbolic form (seesymnum) rather than as numbers. DefaultFALSE.- ...
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
#>