powered by
Use the graphical lasso algorithm to regularize a square symmetric matrix (e.g. a covariance or correlation matrix) by assuming that its inverse has many zeros.
regul_glasso( mat, lambda, maxiter_outer = 200, maxiter_lasso = 200, tol = 1e-04, verbose = FALSE )
The regularized matrix, where the diagonal should be the same and zeros should be kept as well. It also returns the lambda used as an attribute.
lambda
A square symmetric matrix.
Strength of regularization. It needs to be scaled with mat. It should also be the maximum difference between the two matrices.
mat
Maximum number of iterations of the outer loop. Default is 200.
Maximum number of iterations of each lasso solver. Default is 200.
Tolerance for assessing convergence. Default is 1e-4 and it needs to be scaled with mat.
Whether to print iterations and differences. Default is FALSE.
(cov <- cov(iris[1:4])) lambda <- 1 / sqrt(nrow(iris)) (cov_regul <- regul_glasso(cov, lambda))
Run the code above in your browser using DataLab