
Print and summarize sparse regression fits
Source:R/model_summary.R, R/sparseglm_methods.R
model_summary.RdConcise S3 displays for L0glm.fit(), L0nnpois() and sparseglm()
results, including negative-binomial, multinomial and Cox models.
Usage
# S3 method for class 'L0glm_fit'
print(x, digits = max(3L, getOption("digits") - 3L), ...)
# S3 method for class 'L0glm_fit'
summary(object, ..., mu_floor = 0, beta_true = NULL, r2_mu_floor = 0.1)
# S3 method for class 'summary.L0glm_fit'
print(
x,
digits = max(3L, getOption("digits") - 3L),
max.rows = 20L,
max.cols = 6L,
...
)
# S3 method for class 'sparseglm'
print(x, digits = max(3L, getOption("digits") - 3L), ...)
# S3 method for class 'sparseglm'
summary(
object,
...,
mu_floor = object$mu_floor,
beta_true = object$beta_true,
r2_mu_floor = 0.1
)
# S3 method for class 'summary.sparseglm'
print(x, digits = max(3L, getOption("digits") - 3L), ...)Arguments
- x
A fitted model, comparison or corresponding summary object.
- digits
Significant digits for printed numeric values.
- ...
Reserved for additional method arguments; currently unused.
- object
An
L0glm_fitmodel orsparseglmcomparison.- mu_floor
Nonnegative scoring-only mean floor. Model summaries default to zero, matching
stats::logLik()and the criterion methods. Comparison summaries use the floor stored bysparseglm()to match tuning scores.- beta_true
Optional true coefficients for recovery metrics, with the same dimensions as the returned coefficients, including any intercept. Comparison summaries default to their saved truth. Use
NULLto omit it.- r2_mu_floor
Count-mean floor used only for R-squared working weights, default 0.1. See
L0glm.metrics().- max.rows, max.cols
Maximum coefficient rows and response columns shown by
print.summary.L0glm_fit(), default 20 and 6. Positive integers orInf. Only nonzero or mandatory coefficient rows are displayed. These limits do not subset the coefficients retained in the summary.
Value
summary() returns a list of class summary.L0glm_fit or
summary.sparseglm. Both contain metrics and model dimensions. Model
summaries also contain the full sparse coefficients, selected row
indices, dispersion/theta, screening diagnostics when used, and a compact
convergence table. print()
methods return their input invisibly.
Details
Printing a fitted object uses its stored metadata and coefficients; it does
not evaluate likelihoods or refit a model. summary() calls L0glm.metrics()
to obtain likelihood, deviance and information criteria, optionally including
recovery metrics. The full original-dimension sparse coefficient matrix is
retained in the model summary. Coefficients are point estimates; standard
errors and Wald tests are not calculated for the selected penalized model.
Screened fits display the screening method, number of rounds, chosen round,
batch size and screening thread count; summaries retain their complete
screening diagnostics.
Convergence counts use the last recorded pass for each stage and channel, rather than counting intermediate grouped-selection passes as final failures. Missing backend diagnostics remain unavailable. The printed dispersion is the stored fitting scale; the profiled Gaussian likelihood scale can differ, as described in model_criteria. NB summaries also retain theta and its estimation flag. Cox and multinomial do not display an ordinary dispersion.
Comparison summaries retain the complete metrics table, including timings, tuning metadata and explanatory notes for unavailable or failed methods. Their printed tables show essential scores, plus recovery measures when truth is available. No fitted models or adaptive pilots are recomputed.
Examples
set.seed(4)
X <- matrix(rnorm(240), 60, 4)
y <- 2 * X[, 1] + rnorm(60)
fit <- L0glm.fit(X, y, lambda="gic", parallelize=FALSE)
print(fit)
details <- summary(fit)
print(details, max.rows=10)
details$metrics
comparison <- sparseglm(X, y, method=c("L0glm","lasso"), nlambda=4,
lambda=list(L0glm=c(10,4,2)))
summary(comparison)