Package: sparsegl 1.1.1

sparsegl: Sparse Group Lasso
Efficient implementation of sparse group lasso with optional bound constraints on the coefficients; see <doi:10.18637/jss.v110.i06>. It supports the use of a sparse design matrix as well as returning coefficient estimates in a sparse matrix. Furthermore, it correctly calculates the degrees of freedom to allow for information criteria rather than cross-validation with very large data. Finally, the interface to compiled code avoids unnecessary copies and allows for the use of long integers.
Authors:
sparsegl_1.1.1.tar.gz
sparsegl_1.1.1.tar.gz(r-4.5-noble)sparsegl_1.1.1.tar.gz(r-4.4-noble)
sparsegl_1.1.1.tgz(r-4.4-emscripten)sparsegl_1.1.1.tgz(r-4.3-emscripten)
sparsegl.pdf |sparsegl.html✨
sparsegl/json (API)
NEWS
# Install 'sparsegl' in R: |
install.packages('sparsegl', repos = 'https://cloud.r-project.org') |
Bug tracker:https://github.com/dajmcdon/sparsegl/issues3 issues
Pkgdown site:https://dajmcdon.github.io
- trust_experts - Trust in scientific experts during the Covid-19 pandemic
Last updated 7 months agofrom:9c23391c86. Checks:3 OK. Indexed: no.
Target | Result | Latest binary |
---|---|---|
Doc / Vignettes | OK | Mar 23 2025 |
R-4.5-linux-x86_64 | OK | Mar 23 2025 |
R-4.4-linux-x86_64 | OK | Mar 23 2025 |
Exports:%>%cv.sparseglestimate_riskgr_one_normgr_two_normgrouped_one_normgrouped_sp_normgrouped_two_normgrouped_zero_normmake_irls_warmupone_normsp_group_normsparsegltwo_normzero_norm
Dependencies:clicolorspacecpp11dotCall64dplyrfansifarvergenericsggplot2gluegtableisobandlabelinglatticelifecyclemagrittrMASSMatrixmgcvmunsellnlmepillarpkgconfigpurrrR6RColorBrewerRcppRcppEigenrlangRSpectrascalesstringistringrtibbletidyrtidyselectutf8vctrsviridisLitewithr
Citation
To cite sparsegl in publications use:
Liang X, Cohen A, Solón Heinsfeld A, Pestilli F, McDonald DJ (2024). “sparsegl: An R Package for Estimating Sparse Group Lasso.” Journal of Statistical Software, 110(6), 1–23. doi:10.18637/jss.v110.i06.
Corresponding BibTeX entry:
@Article{, title = {{sparsegl}: An {R} Package for Estimating Sparse Group Lasso}, author = {Xiaoxuan Liang and Aaron Cohen and Anibal {Sol{\'o}n Heinsfeld} and Franco Pestilli and Daniel J. McDonald}, journal = {Journal of Statistical Software}, year = {2024}, volume = {110}, number = {6}, pages = {1--23}, doi = {10.18637/jss.v110.i06}, }
Readme and manuals
sparsegl

The goal of sparsegl is to fit regularization paths for sparse group-lasso penalized learning problems. The model is typically fit for a sequence of regularization parameters $\lambda$. Such estimators minimize
$$ -\ell(\beta | y,\ \mathbf{X}) + \lambda(1-\alpha)\sum_{g\in G} \lVert\beta_g\rVert_2 + \lambda\alpha \lVert\beta\rVert_1. $$
The main focus of this package is for the case where the loglikelihood
corresponds to Gaussian or logistic regression. But we also provide the
ability to fit arbitrary GLMs using stats::family()
objects. Details
may be found in Liang, Cohen, Sólon Heinsfeld, Pestilli, and McDonald
(2024).
Installation
You can install the released version of sparsegl from CRAN with:
install.packages("sparsegl")
You can install the development version from GitHub with:
# install.packages("remotes")
remotes::install_github("dajmcdon/sparsegl")
Minimal Example
set.seed(1010)
n <- 100
p <- 200
X <- matrix(data = rnorm(n * p, mean = 0, sd = 1), nrow = n, ncol = p)
eps <- rnorm(n, mean = 0, sd = 1)
beta_star <- c(
rep(5, 5), c(5, -5, 2, 0, 0),
rep(-5, 5), c(2, -3, 8, 0, 0), rep(0, (p - 20))
)
y <- X %*% beta_star + eps
groups <- rep(1:(p / 5), each = 5)
fit1 <- sparsegl(X, y, group = groups)
plot(fit1, y_axis = "coef", x_axis = "penalty", add_legend = FALSE)
References
Liang, X., Cohen, A., Sólon Heinsfeld, A., Pestilli, F., and McDonald,
D.J. 2024. “sparsegl: An R
Package for Estimating Sparse Group Lasso.”
Journal of Statistical Software 110(6), 1–23.
https://doi.org/10.18637/jss.v110.i06.
Help Manual
Help page | Topics |
---|---|
Extract coefficients from a 'cv.sparsegl' object. | coef.cv.sparsegl |
Extract model coefficients from a 'sparsegl' object. | coef.sparsegl |
Cross-validation for a 'sparsegl' object. | cv.sparsegl |
Calculate information criteria. | estimate_risk |
Create starting values for iterative reweighted least squares | make_irls_warmup |
Plot cross-validation curves produced from a 'cv.sparsegl' object. | plot.cv.sparsegl |
Plot solution paths from a 'sparsegl' object. | plot.sparsegl |
Make predictions from a 'cv.sparsegl' object. | predict.cv.sparsegl |
Make predictions from a 'sparsegl' object. | predict.sparsegl |
Regularization paths for sparse group-lasso models | sparsegl |
Trust in scientific experts during the Covid-19 pandemic | trust_experts |
Calculate common norms | grouped_one_norm grouped_sp_norm grouped_two_norm grouped_zero_norm gr_one_norm gr_two_norm one_norm sp_group_norm two_norm zero_norm |