Skip to contents

A categorical predictor can require several contrasts, and a smooth effect can require several spline coefficients. The group argument selects such terms together. It also supports groups of related measurements. Adaptive ridge uses the squared Euclidean norm of the coefficients within each group, so positive and negative effects contribute equally to selection. The adaptive exponent is fixed at \gamma=2.

Fit and tune grouped predictors

library(L0glm)
set.seed(41)
X <- matrix(rnorm(200*12),200,12)
group <- rep(1:6,each=2)
group[11:12] <- 0
beta <- c(1.5,-1.5,0,0,1,-1,rep(0,6))
y <- 1+as.numeric(X%*%beta)+rnorm(200)
fit <- l0glmFit(X,y,group=group,intercept=TRUE,lambda='gic')
l0glmMetrics(fit)[c('gic','group_support_size','group_df')]
#>        gic group_support_size group_df
#> 1 556.5433                  2        4

Group labels can be integers, characters or factors in any order. Group 0, the intercept and always.include terms are unpenalized. Explicit starting-zero exclusions remain binding; the returned sparse coefficient matrix retains all original predictor rows. Criterion-checked support refinement can refit retained groups without shrinkage.

For multiple outcomes, grouped=FALSE selects each predictor group independently within each channel. grouped=TRUE pools its coefficients across channels. Joint multinomial fits pool the identifiable CLR coefficients across categories.

cv <- l0glmTune(X,y,family=gaussian(),group=group,intercept=TRUE,tune='cv',nfolds=5,nlambda=10)
predict(cv$fit_1se,X[1:5,])

Every CV training fold repeats selection independently. Automatic local refinement tests whole-group additions, removals and exchanges when the initial selected coefficient dimension is at most 50. See predictor groups for the penalty equations and local refinement for its controls. Predictor-group models currently fit the supplied design directly; use screen='none' when its dimensions would otherwise activate automatic ISIS.

Recognized scalar GLMs run predictor-group IRLS in C++, with the same group penalties, step halving, dispersion updates and convergence checks. Multiple outcomes use OpenMP channel threads when ncores>1, for example ncores=4. BLAS uses one thread within those parallel passes, and the caller’s thread settings are restored. Custom and special-family adapters and validation checkpoints use the structured R driver.

GIC and group size

The reported information criteria use the same parameter-count convention as other L0glm models:

\mathrm{GIC}=-2\ell(\widehat B,\widehat\psi) +\log(p)\log\log(n)\,k.

Here k counts free nonzero coefficients, compulsory coefficient dimensions and estimated noise parameters. Multinomial counts respect the CLR zero-sum constraint. The original selectable predictor count p is retained. A selected group of four unrestricted coefficients contributes four parameters; its size is accounted for through those coefficients. No further group-size multiplier enters the reported GIC. See information criteria for the Fan–Tang GIC and its assumptions.

To calibrate adaptive-ridge block selection, named IC presets use nominal group coefficient dimensions as penalty multipliers. Exact boundary zeros can reduce the reported parameter count of the resulting fit. IC tuning and local refinement evaluate that returned support using the parameter-count criterion above. A numeric lambda instead specifies a penalty per selected group, with optional group.multiplier values; group_objective reports this weighted group target. Stored multipliers permit numerical reproduction of an IC-calibrated ridge fit.

Other group-specific selection criteria are possible. For example, Zhang et al. study a group-count criterion in Gaussian best-subset-of-groups regression. L0glm retains its parameter-count GIC across families and uses it consistently in the comparisons below.

Comparisons with grpreg

These four simulations include equal and unequal group sizes, correlated predictors and signed effects. Each is repeated with three independent seeds. Two compulsory predictors and an intercept are retained in every method. The reproduction script compares L0glm with grpreg’s group LASSO, group MCP and group SCAD, using both information-criterion paths and five-fold CV with shared folds.

The GIC comparisons use one common likelihood and count active coefficients. For Gaussian data the variance is known to be one, which makes the score comparable even for nearly interpolating path fits. L0glm’s estimated-scale fits are included as a diagnostic alongside the known-scale fits. The grpreg paths contain 40 lambda values; L0glm uses its GIC preset or a ten-value CV grid. This common scoring choice is distinct from grpreg’s default shrinkage-based effective degrees of freedom, described in its selection documentation.

gaussian equal: 400 observations, 202 predictors, 50 groups (6 active).

Method Seconds GIC Group TP Group FP F1 MCC
L0glm 0.05 1369.0 6 0 1 1
L0glm estimated scale 0.08 1369.0 6 0 1 1
grLasso 0.03 1462.1 6 0 1 1
grMCP 0.05 1369.0 6 0 1 1
grSCAD 0.04 1369.3 6 0 1 1

gaussian wide: 400 observations, 602 predictors, 100 groups (8 active).

Method Seconds GIC Group TP Group FP F1 MCC
L0glm 0.05 1746.5 7.67 0.00 0.978 0.977
L0glm estimated scale 0.07 1719.2 8.00 0.00 1.000 1.000
grLasso 0.06 2037.3 8.00 3.33 0.831 0.829
grMCP 0.08 1736.7 8.00 0.67 0.963 0.962
grSCAD 0.06 1766.2 8.00 1.33 0.924 0.920

logistic equal: 600 observations, 242 predictors, 60 groups (8 active).

Method Seconds GIC Group TP Group FP F1 MCC
L0glm 0.22 608.5 8.00 0.00 1.000 1
grLasso 1.89 827.5 5.33 0.33 0.647 NA
grMCP 1.08 608.5 8.00 0.00 1.000 1
grSCAD 1.15 608.5 8.00 0.00 1.000 1

logistic unequal: 1000 observations, 602 predictors, 100 groups (10 active).

Method Seconds GIC Group TP Group FP F1 MCC
L0glm 0.21 1123.7 4.33 0 0.557 0.604
grLasso 5.44 1308.8 2.67 0 0.394 0.473
grMCP 2.17 1101.7 5.67 0 0.651 0.689
grSCAD 2.31 1142.0 7.00 0 0.727 0.767

Gaussian preset fits recover the groups accurately, with prediction errors close to the noise level in the equal-size case. The native group driver reuses bounded Gaussian weighted cross-products and runs the iteration in C++. Wide systems retain the Woodbury solver path, and sparse inputs retain their sparse solves. In logistic regression, L0glm’s preset with local refinement is faster than these complete paths; the unequal-size, correlated example is harder for parameter-count GIC, and CV recovers more of its true groups. For CV, grpreg’s native group coordinate-descent paths reuse work through warm starts along the lambda sequence. L0glm repeats independent adaptive-ridge fits and whole-group local refinement within each training fold. Its preset avoids that grid search when information-criterion selection is appropriate.

Simulation Method Seconds Group TP Group FP F1 MCC
gaussian_equal L0glm 3.11 6.00 0.00 1.000 1.000
gaussian_equal grLasso 0.21 6.00 12.33 0.502 0.493
gaussian_equal grMCP 0.31 6.00 0.33 0.974 0.972
gaussian_equal grSCAD 0.29 6.00 0.33 0.974 0.972
gaussian_wide L0glm 3.74 8.00 1.67 0.914 0.912
gaussian_wide grLasso 0.32 8.00 27.67 0.366 0.396
gaussian_wide grMCP 0.56 8.00 4.00 0.822 0.825
gaussian_wide grSCAD 0.34 8.00 5.33 0.761 0.764
logistic_equal L0glm 18.11 8.00 0.00 1.000 1.000
logistic_equal grLasso 7.60 8.00 31.67 0.337 0.282
logistic_equal grMCP 4.73 8.00 0.00 1.000 1.000
logistic_equal grSCAD 5.32 8.00 0.00 1.000 1.000
logistic_unequal L0glm 16.56 9.67 0.00 0.982 0.981
logistic_unequal grLasso 19.17 10.00 44.67 0.311 0.305
logistic_unequal grMCP 10.46 9.33 0.00 0.965 0.962
logistic_unequal grSCAD 10.37 10.00 0.00 1.000 1.000

Timings are medians; recovery scores are averages across three replicates. All fits and CV folds use one thread, on an HP ZBook Fury G8 with an Intel Core i9-11950H, Windows, R 4.5.0 and grpreg 3.6.0. Simulation and final scoring are excluded from the timings; fitting and selection are included. For grpreg’s GIC paths this includes scoring all candidates with the common criterion. The complete run-level results include test RMSE or AUC/log loss, convergence diagnostics and path warnings.