set.seed(150)
pkg_version <- packageVersion(params$pkg)

Multivariate Linear Sparse Group Lasso Regression

Multivariate Linear regression with feature and parameter selection using sparse group lasso. Suitable for high dimensional problems.

This is the R package lsgl version r pkg_version.

R-package Overview

This package implements procedures for working with multivariate linear regression models using sparse group lasso. This includes procedures for fitting and cross validating sparse models in a high dimensional setup. See the Quick Start (Predict airline ticket prices for multiple airlines) for an example of a workflow consisting of 1) model selection and assessment using cross validation, 2) estimation of a final model and 3) using the selected model for carrying out predictions on new data.

The multiple lasso estimator and the least squares estimate

Comparison of the multivariate lasso estimate and least squares estimate on simulated data with 50 samples, 50 features and a 25-dimensional response. See ?lsgl::fit for details.

Package highlights:

The penalized maximum likelihood estimator for the linear multiple-response regression model is computed using a coordinate gradient descent algorithm via the sglOptim optimizer. Use of parallel computing for cross validation and subsampling is supported through the foreach and doParallel packages.

Installation

Get the released version from CRAN:

install.packages("lsgl")

Install the version from GitHub:

# install.packages("devtools")
devtools::install_github("nielsrhansen/sglOptim", build_vignettes = TRUE)
devtools::install_github("nielsrhansen/lsgl", build_vignettes = TRUE)

If you don't want to build the vignettes when installing, just remove the build_vignettes = TRUE argument.

Minimal Example

library(lsgl)

# Load sone data
data(AirlineTicketPrices)

# Setup 2 parallel units
cl <- makeCluster(2)
registerDoParallel(cl)

# Do 10-fold cross validation on 100 models with increasing complexity, using the 2 parallel units
fit.cv <- lsgl::cv(
  x = X,
  y = Y,
  alpha = 0.5,
  lambda = 0.001,
  use_parallel = TRUE
)

stopCluster(cl)

# Print information about models
# and cross validation errors
fit.cv

Documentation

Author

Martin Vincent wrote the package. Niels Richard Hansen is the current maintainer.

License

GPL (>=2)



nielsrhansen/lsgl documentation built on Feb. 11, 2024, 8:07 a.m.