| calm.gof | R Documentation |
Refers the shrinkage-corrected grouped goodness-of-fit statistics to an
analytic reference distribution, so that no bootstrap is needed. It is the
companion of shrink.gof, which refers the same statistics to a
prepivoting bootstrap: the statistics are identical, only the reference
differs. CALM stands for Calibration Assessment under Lambda-shrunk Models.
calm.gof(
X,
y,
lambda,
G = 10,
basis = c("decile", "adaptive", "edge"),
lambda_scale = c("theory", "glmnet"),
tau = 0.2,
inflate = c("kappa", "none")
)
X |
numeric matrix or data frame of predictors, without an intercept column. Standardize the columns as you would before any ridge fit. |
y |
numeric or integer vector of 0/1 responses. |
lambda |
the ridge penalty. On the theory scale by default, that is on
the scale of the log-likelihood; pass |
G |
number of equal-frequency groups. Default 10. |
basis |
which statistics to compute: any of |
lambda_scale |
|
tau |
threshold of the degree rule, in (0, 1). Default 0.2. Values below 0.2 keep the cubic direction too often in the proportional regime. |
inflate |
whether to inflate the reference for the selection effect,
|
Under a ridge penalty the grouped standardized residuals are displaced by shrinkage. Subtracting an estimate of that displacement restores the maximum likelihood covariance to first order, but the resulting reference is conservative, because it standardizes by the Bernoulli variance at the fitted probabilities, which shrinkage inflates towards one quarter. CALM replaces it by a de-noised estimate of the null Bernoulli variance, obtained from the fit alone through the observable adjustments of Bellec (2025), and inflates the result for the effect of grouping on an index that depends on the response.
Two bases are returned. The EDGE basis projects the corrected residual onto
orthogonal polynomials in the group-mean fitted probability, and
SC.EDGE.adaptive chooses the degree from the data: it keeps the cubic
direction when the aspect ratio is small, or when the observable index
correlation \hat\rho satisfies \hat\rho^{6} \ge \tau, and uses
degree two otherwise. That basis is the one to prefer. The decile basis
SC.HL is the shrinkage-corrected Hosmer-Lemeshow statistic and is
reported for continuity with that tradition; because it spends every group
direction it cannot avoid the direction the selection effect occupies, and
its reference relies on a constant calibrated by simulation, which does not
transfer to every design. See the reference for the designs in which it
fails.
An object of class "calm.gof": a list with components
SC.HL, SC.EDGE and SC.EDGE.adaptive (each a list with
statistic and p.value, and for the adaptive basis also the
chosen degree and the observable rho_hat), together with the
penalty on both scales and the observables used to build the reference.
The reference is validated for aspect ratios p/n up to 0.4 and for
penalties that shrink towards zero; the lasso is not covered, because the
displacement requires a differentiable penalty. The test asks whether the
logistic form is correct along the fitted index. It does not ask whether
the shrunk probabilities are calibrated, which under a penalty they are
not, by an amount the analyst chose when selecting lambda.
The reference is validated for outcomes that are not strongly unbalanced.
Once p/n is an appreciable fraction the level is lost as the
prevalence falls: at p/n = 0.25 the smooth basis rejects 0.140,
0.574 and 0.884 of correctly specified models at prevalences 0.30, 0.15
and 0.08, and the decile basis 0.060, 0.204 and 0.492. At fixed dimension
the decile basis is unaffected and the smooth one degrades far more
slowly, to 0.130 at prevalence 0.08. What fails there is the
response-dependent grouping inherited from the Hosmer-Lemeshow
construction rather than the reference itself. With few events and
p/n an appreciable fraction, neither statistic is validated and
shrink.gof is the less badly behaved of the two.
Bellec, P. C. (2025). Observable adjustments in single-index models for regularized M-estimators with bounded p/n. The Annals of Statistics, 53(2), 531–560.
Davies, R. B. (1980). Algorithm AS 155: the distribution of a linear combination of chi-squared random variables. Journal of the Royal Statistical Society, Series C, 29(3), 323–333.
Ebrahim, E. K. (2026). A closed-form goodness-of-fit reference for penalised logistic regression in the proportional regime. Preprint. Reproduction materials: \Sexpr[results=rd]{tools:::Rd_expr_doi("10.5281/zenodo.22467285")}
shrink.gof for the bootstrap reference for the same
statistics, and edge.gof for the EDGE test on an unpenalized fit.
set.seed(1)
n <- 300; p <- 20
X <- matrix(rnorm(n * p), n)
y <- rbinom(n, 1, 1 / (1 + exp(-(X[, 1] - 0.5 * X[, 2]))))
calm.gof(X, y, lambda = 100)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.