Package 'wflsa'

Title: Weighted Fused LASSO Signal Approximator ('wFLSA')
Description: A package for computing the Weighted Fused LASSO Signal Approximator (wFLSA).
Authors: Louis Dijkstra [aut, cre]
Maintainer: Louis Dijkstra <[email protected]>
License: GPL (>= 3)
Version: 1.2.1
Built: 2024-11-21 12:37:30 UTC
Source: https://github.com/bips-hb/wflsa

Help Index


Determine the Diagonal of Matrix AA

Description

The wFLSA algorithm requires the choice of a matrix AA such that ADDA - D'D is positive semidefinite. We choose the matrix AA to be diagonal with a fixed value aa. This function determines the smallest value of aa such that ADDA - D'D is indeed positive semidefinite. We do this be determining the largest eigenvalue

Usage

calculate_diagonal_matrix_A(W, eta1, eta2)

Arguments

W

Weight matrix WW

eta1, eta2

The values η1=λ1/ρ\eta_1 = \lambda_1 / \rho and η2=λ2/ρ\eta_2 = \lambda_2 / \rho

Value

Value of aa

References

Zhu, Y. (2017). An Augmented ADMM Algorithm With Application to the Generalized Lasso Problem. Journal of Computational and Graphical Statistics, 26(1), 195–204. https://doi.org/10.1080/10618600.2015.1114491


Solving Generalized LASSO with fixed λ=1\lambda = 1

Description

Solves efficiently the generalized LASSO problem of the form

β^=argmin12yβ22+Dβ1\hat{\beta} = \operatorname{argmin} \frac{1}{2} || y - \beta ||_2^2 + ||D\beta||_1

where β\beta and yy are mm-dimensional vectors and DD is a (c×m)(c \times m)-matrix where cmc \geq m. We solve this optimization problem using an adaption of the ADMM algorithm presented in Zhu (2017).

Usage

genlassoRcpp(Y, W, m, eta1, eta2, a, rho, max_iter, eps, truncate)

Arguments

Y

The yy vector of length mm

W

The weight matrix WW of dimensions m×mm \times m

m

The number of graphs

eta1

Equals λ1/rho\lambda_1 / rho

eta2

Equals λ2/rho\lambda_2 / rho

a

Value added to the diagonal of DD-D'D so that the matrix is positive definite, see matrix_A_inner_ADMM in package CVN

rho

The ADMM's parameter

max_iter

Maximum number of iterations

eps

Stopping criterion. If differences are smaller than ϵ\epsilon, algorithm is halted

truncate

Values below truncate are set to 0

Value

The estimated vector β^\hat{\beta}

References

Zhu, Y. (2017). An Augmented ADMM Algorithm With Application to the Generalized Lasso Problem. Journal of Computational and Graphical Statistics, 26(1), 195–204. https://doi.org/10.1080/10618600.2015.1114491


Print Function for the Weighted Fused LASSO Signal Approximator (wFLSA) fit object

Description

This function prints information about the fitted wFLSA object, including the number of variables, the number of lambda pairs, and the estimated beta coefficients.

Usage

## S3 method for class 'wflsa.fit'
print(x, ...)

Arguments

x

An object of class wflsa.fit.

...

Additional arguments to be passed to the print function.


The Weighted Fused Lasso Signal Approximator (wFLSA) Algorithm

Description

Solves the weighted Fused LASSO Signal Approximator optimization problem using an ADMM-based approach. The problem is formulated as follows:

β^=argmin12yβ22+λ1β1+λ2i<jwijβiβj\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:

  • yy is the response with mean 00.

  • β\beta is the vector of coefficients to be estimated.

  • 1|| \cdot ||_1 and 2|| \cdot ||_2 are the L1L_1- and L2L_2-norms, respectively.

  • λ1>0\lambda_1 > 0 is the regularization parameter controlling the strength of the sparsity penalty.

  • λ2>0\lambda_2 > 0 is the regularization parameter controlling the smoothness.

  • wij[0,1]w_{ij} \in [0,1] is the weight between the ii-th and jj-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 pp representing the response variable (assumed to be centered).

W

Weight matrix of dimensions p×pp \times p.

lambda1

Vector of positive regularization parameters for L1L_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 yy to be centered, i.e., its mean is 0.

See Also

genlassoRcpp()

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)