Learn R Programming

clusterGGM (version 0.1.1)

lasso_weights: Compute the Weight Matrix for the Lasso Penalty

Description

Compute the weight matrix for the lasso penalty in the clusterpath estimator of the Gaussian graphical model (CGGM).

Usage

lasso_weights(S, unit = FALSE)

Value

A weight matrix for the lasso penalty.

Arguments

S

The sample covariance matrix of the data.

unit

A logical indicating whether the weights should be all one or based on the inverse of S.

Author

Daniel J.W. Touw

References

D.J.W. Touw, A. Alfons, P.J.F. Groenen and I. Wilms (2025) Clusterpath Gaussian Graphical Modeling. arXiv:2407.00644. doi:10.48550/arXiv.2407.00644.

See Also

clusterpath_weights(), cggm(), cggm_refit(), cggm_cv()

Examples

Run this code
# Generate data
set.seed(3)
Theta <- matrix(
  c(2, 1, 0, 0,
    1, 2, 0, 0,
    0, 0, 4, 1,
    0, 0, 1, 4),
  nrow = 4
)
X <- mvtnorm::rmvnorm(n = 100, sigma = solve(Theta))

# Estimate the covariance matrix
S <- cov(X)

# Compute the weight matrix for the lasso (sparsity) weights
W_lasso <- lasso_weights(S)
W_lasso

Run the code above in your browser using DataLab