Learn R Programming

cxreg (version 1.0.0)

cxreg-package: Complex-valued Lasso and graphical Lasso paths

Description

This package fits complex-valued Lasso for regression using coordinate descent. The algorithm is extremely fast, and exploits sparsity in the input x matrix where it exists. A variety of predictions can be made from the fitted models.

Arguments

Author

Younghoon Kim, Navonil Deb, Sumanta Basu
Maintainer: Younghoon Kim yk748@cornell.edu

Details

This package also provides fitting for complex-valued graphical Lasso using coordinate descent. The function is built upon classo with covariate updates, just as the regular real-valued coordinate descent algorithm for graphical Lasso.

Package:cxreg
Type:Package
Version:1.0.0
Date:2025-07-01
License:MIT + file LICENSE

Very simple to use. Accepts x,y data for penalized regression models, and produces the regularization paths over a grid of values for the tuning parameters lambda. Similarly, accepts S,n data for penalized Gaussian likelihood, and produce the regularization paths over a grid of values for the tuning parameter lambda.

References

Deb, N., Kuceyeski, A., Basu, S. (2024) Regularized Estimation of Sparse Spectral Precision Matrices, https://arxiv.org/abs/2401.11128.

Examples

Run this code
# \donttest{ 
set.seed(1234)
x <- array(rnorm(100*20), c(100,20)) + (1+1i) * array(rnorm(100*20), c(100,20))
for (j in 1:20) x[,j] <- x[,j] / sqrt(mean(Mod(x[,j])^2))
e <- rnorm(100) + (1+1i) * rnorm(100)
b <- c(1, -1, rep(0, 18)) + (1+1i) * c(-0.5, 2, rep(0, 18))
y <- x %*% b + e
fit <- classo(x, y)
predict(fit, newx = x[1:5, ], s = c(0.01, 0.005))
predict(fit, type = "coef")
plot(fit, xvar = "lambda")
# }

# \donttest{ 
p <- 30
n <- 500
C <- diag(0.7, p)
C[row(C) == col(C) + 1] <- 0.3  
C[row(C) == col(C) - 1] <- 0.3  
Sigma <- solve(C)
set.seed(1010)
m <- floor(sqrt(n)); j <- 1
X_t <- mvtnorm::rmvnorm(n = n, mean = rep(0, p), sigma = Sigma)
d_j <- dft.X(X_t,j,m)
f_j_hat <- t(d_j) %*% Conj(d_j) / (2*m+1)
fit <- cglasso(S=f_j_hat, nobs=n,type="I")
plot(fit$Theta_list,index=fit$min_index,type="mod",label=FALSE)
# }

Run the code above in your browser using DataLab