title: Sparse regression with paired covariates output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{vignette} %\VignetteEncoding{UTF-8} %\VignetteEngine{knitr::rmarkdown} editor_options: chunk_output_type: console
knitr::opts_chunk$set(echo=TRUE,eval=FALSE)
The R package palasso
implements the paired lasso.
Installing the current release from CRAN:
install.packages("palasso")
Installing the latest development version from GitHub:
#install.packages("devtools") library(devtools) install_github("rauschenberger/palasso")
We use glmnet for the standard lasso, and palasso for the paired lasso.
Loading and attaching the packages:
library(glmnet) library(palasso)
Attaching some data to reproduce the examples:
attach(toydata)
names <- names(toydata) for(i in 1:length(names)){ assign(names[i],toydata[[i]]) } rm(names)
Data are available for $n=30$ samples and $p=50$ covariate pairs. The object y
contains the response (numeric vector of length $n$). The object X
contains the covariates (list of two numeric matrices, both with $n$ rows and $p$ columns).
The standard lasso is a good choice for exploiting either the first or the second covariate group:
object <- glmnet(y=y,x=X[[1]]) object <- glmnet(y=y,x=X[[2]])
But the paired lasso might be a better choice for exploiting both covariates groups at once:
object <- palasso(y=y,X=X)
In contrast to the standard lasso, the paired lasso accounts for the structure between the covariate groups.
Given a limited number of non-zero coefficients, we expect the paired lasso to outperform the standard lasso:
object <- palasso(y=y,X=X,max=10)
Standard methods are available for the paired lasso:
weights(object)
fitted(object)
residuals(object)
predict(object,newdata=X)
A Rauschenberger, I Ciocanea-Teodorescu, RX Menezes, MA Jonker, and MA van de Wiel (2020). "Sparse classification with paired covariates". Advances in Data Analysis and Classification. 14:571-588. doi: 10.1007/s11634-019-00375-6
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.