The wflsa R package provides an efficient implementation of an algorithm for solving the Weighted Fused LASSO Signal Approximator problem. This algorithm is based on an ADMM (Alternating Direction Method of Multipliers) approach and is designed to estimate a vector of coefficients with sparsity and smoothness constraints.
The problem solved by the wFLSA algorithm is formulated as follows:
Where:
-
$y$ is the response variable with mean 0. -
$\beta$ is the vector of coefficients to be estimated. -
$|| \cdot ||_1$ and$|| \cdot ||_2$ are the$L_1$ - and$L_2$ -norms, respectively. -
$\lambda_1 > 0$ is the regularization parameter controlling the strength of the sparsity penalty. -
$\lambda_2 > 0$ is the regularization parameter controlling the smoothness. -
$w_{ij} \in [0,1]$ is the weight between the$i$ -th and$j$ -th coefficient.
A simple example:
library(wflsa)
set.seed(1)
# number of covariates
p <- 10
# the response vector
y <- rnorm(p)
# Fully connected (Weight matrix is 1)
W <- matrix(rep(1, p*p), ncol = p) - diag(p)
# lambda values:
lambda1 <- c(0.01, 0.1, 0.2)
lambda2 <- c(0.01, 0.1, 0.2)
# Solve the weighted Fused LASSO Signal Approximator
wflsa(y, W, lambda1, lambda2)
You can install the package from GitHub using the devtools
package:
devtools::install_github("bips-hb/wflsa")
Louis Dijkstra
Leibniz Institute for Prevention Research & Epidemiology
E-mail: dijkstra (at) leibniz-bips.de