Skip to contents

Solves the weighted Fused LASSO Signal Approximator optimization problem using an ADMM-based approach. The problem is formulated as follows: $$ \hat{\beta} = \operatorname{argmin} \frac{1}{2} || y - \beta ||_2^2 + \lambda_1 ||\beta ||_1 + \lambda_2 \sum_{i < j} w_{ij} | \beta_i - \beta_j | $$ where:

  • \(y\) is the response 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.

Usage

wflsa(
  y,
  W,
  lambda1 = c(0.1),
  lambda2 = c(0.1),
  rho = 1,
  max_iter = 1e+05,
  eps = 1e-10,
  truncate = 1e-04,
  offset = TRUE
)

Arguments

y

Vector of length \(p\) representing the response variable (assumed to be centered).

W

Weight matrix of dimensions \(p \times p\).

lambda1

Vector of positive regularization parameters for \(L_1\) penalty.

lambda2

Vector of positive regularization parameters for smoothness penalty.

rho

ADMM's parameter (Default: 1).

max_iter

Maximum number of iterations (Default: 1e5).

eps

Stopping criterion. If differences are smaller than eps, the algorithm halts (Default: 1e-10).

truncate

Values below truncate are set to 0 (Default: 1e-4).

offset

Logical indicating whether to include an intercept term (Default: TRUE).

Value

A list containing:

  • betas: Estimated vector \(\hat{\beta}\) from the Weighted Fused LASSO.

  • tuning_parameters: Data frame with tuning parameters. The column df contains the number of non-zero coefficients for the different lambda-values

  • all input variables.

Note

Important Note: The algorithm assumes \(y\) to be centered, i.e., its mean is 0.

See also

Examples

# Example usage of the wflsa function
y <- c(1, 2, 3)
W <- matrix(c(1, 0, 0, 0, 1, 0, 0, 0, 1), ncol = 3)
lambda1 <- c(0.1, 0.2)
lambda2 <- c(0.1, 0.2)
result <- wflsa(y, W, lambda1, lambda2)