| Title: | Complex-Valued Lasso and Complex-Valued Graphical Lasso |
|---|---|
| Description: | Implements 'glmnet'-style complex-valued lasso (CLASSO) and complex-valued graphical lasso (CGLASSO) via a pathwise coordinate descent algorithm for complex-valued parameters, using an isomorphism between complex numbers and 2x2 orthogonal matrices. Also provides a full inference pipeline for high-dimensional sparse spectral precision matrices, including data-driven bandwidth selection, one-step debiasing, asymptotic variance estimation, entry-wise confidence regions, and FDR-controlled hypothesis testing. Supporting tools for cross-validation, simulation, coefficient extraction, and plotting are included. See Deb, Kuceyeski, and Basu (2024) <doi:10.48550/arXiv.2401.11128> and Deb, Kim, and Basu (2026) <doi:10.48550/arXiv.2606.07986>. |
| Authors: | Younghoon Kim [aut, cre], Navonil Deb [aut], Sumanta Basu [aut] |
| Maintainer: | Younghoon Kim <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.1.2 |
| Built: | 2026-07-06 04:14:55 UTC |
| Source: | https://github.com/cran/cxreg |
This package fits a 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.
This package also provides fitting for a complex-valued graphical Lasso
(CGLASSO) using coordinate descent. The function is built upon
classo with covariate updates, just as the regular real-valued
coordinate descent algorithm for graphical Lasso.
Beyond estimation, the package implements a full inference pipeline for high-dimensional sparse spectral precision matrices:
select_m: data-driven bandwidth selection via
generalised cross-validation (GCV) on the diagonal periodogram.
decglasso: one-step debiasing (desparsification)
of the CGLASSO estimator.
var.cov: asymptotic variance and pseudovariance
estimation (plug-in or HAC) with real/imaginary decomposition.
spec.test: entry-wise Z-statistics, Mahalanobis
chi-squared statistics, and confidence ellipse areas.
spec.fdr: FDR-controlled multiple testing for
spectral precision matrix support recovery.
| Package: | cxreg |
| Type: | Package |
| Version: | 1.1.0 |
| Date: | 2026-06-01 |
| License: | MIT + file LICENSE |
Younghoon Kim, Navonil Deb, Sumanta Basu
Maintainer:
Younghoon Kim [email protected]
Deb, N., Kuceyeski, A., Basu, S. (2024) Regularized Estimation of Sparse Spectral Precision Matrices, https://arxiv.org/abs/2401.11128.
Deb, N., Kim, Y., Basu, S. (2026) Inference for High-Dimensional Sparse Spectral Precision Matrices, https://arxiv.org/abs/2606.07986.
## --- classo: complex-valued lasso regression --- set.seed(1234) n <- 100; p <- 20 x <- array(rnorm(n*p), c(n,p)) + (1+1i) * array(rnorm(n*p), c(n,p)) for (j in 1:p) x[,j] <- x[,j] / sqrt(mean(Mod(x[,j])^2)) e <- rnorm(n) + (1+1i) * rnorm(n) b <- c(1, -1, rep(0, p-2)) + (1+1i) * c(-0.5, 2, rep(0, p-2)) 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") ## --- cglasso: complex-valued graphical lasso --- library(mvtnorm) 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) X_t <- rmvnorm(n = n, mean = rep(0, p), sigma = Sigma) m <- floor(sqrt(n)); j <- 1 d_j <- dft.j(X_t, j, m) f_j_hat <- t(d_j) %*% Conj(d_j) / (2*m + 1) fit <- cglasso(S = f_j_hat, m = m, type = "I") ## --- Inference pipeline: debiasing, variance, testing --- library(mvtnorm) p <- 10; n <- 200 set.seed(42) X <- rmvnorm(n, mean = rep(0, p), sigma = diag(p)) ## Bandwidth selection bw_sel <- select_m(X) m <- bw_sel$m_opt ## Spectral density estimate and cglasso fit j <- floor(n / 4) dft <- dft.all(X) fhat <- fhat_at(dft, j, m) fit <- cglasso(S = fhat, m = m) ## Debiasing res <- decglasso(object = fit, fhat = fhat) ## Variance estimation vc <- var.cov(Theta = res$Theta_tilde, X = X, j = j, m = m, type = "plug-in") ## Confidence regions and test statistics (H0: Theta = 0) st <- spec.test(Est = res$Theta_tilde, varcov = vc, m = m, alpha = 0.05) ## FDR-controlled support recovery fdr_res <- spec.fdr(Chi_sq = st$Chi_sq, alpha = 0.05, diag = FALSE) fdr_res$tau fdr_res$Decision## --- classo: complex-valued lasso regression --- set.seed(1234) n <- 100; p <- 20 x <- array(rnorm(n*p), c(n,p)) + (1+1i) * array(rnorm(n*p), c(n,p)) for (j in 1:p) x[,j] <- x[,j] / sqrt(mean(Mod(x[,j])^2)) e <- rnorm(n) + (1+1i) * rnorm(n) b <- c(1, -1, rep(0, p-2)) + (1+1i) * c(-0.5, 2, rep(0, p-2)) 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") ## --- cglasso: complex-valued graphical lasso --- library(mvtnorm) 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) X_t <- rmvnorm(n = n, mean = rep(0, p), sigma = Sigma) m <- floor(sqrt(n)); j <- 1 d_j <- dft.j(X_t, j, m) f_j_hat <- t(d_j) %*% Conj(d_j) / (2*m + 1) fit <- cglasso(S = f_j_hat, m = m, type = "I") ## --- Inference pipeline: debiasing, variance, testing --- library(mvtnorm) p <- 10; n <- 200 set.seed(42) X <- rmvnorm(n, mean = rep(0, p), sigma = diag(p)) ## Bandwidth selection bw_sel <- select_m(X) m <- bw_sel$m_opt ## Spectral density estimate and cglasso fit j <- floor(n / 4) dft <- dft.all(X) fhat <- fhat_at(dft, j, m) fit <- cglasso(S = fhat, m = m) ## Debiasing res <- decglasso(object = fit, fhat = fhat) ## Variance estimation vc <- var.cov(Theta = res$Theta_tilde, X = X, j = j, m = m, type = "plug-in") ## Confidence regions and test statistics (H0: Theta = 0) st <- spec.test(Est = res$Theta_tilde, varcov = vc, m = m, alpha = 0.05) ## FDR-controlled support recovery fdr_res <- spec.fdr(Chi_sq = st$Chi_sq, alpha = 0.05, diag = FALSE) fdr_res$tau fdr_res$Decision
These are not intended for use by users. Constructs a prediction matrix for
cross-validation folds using the coefficient paths in outlist.
Inspired by internal functions in the glmnet package.
buildPredmat(outlist, lambda, x, foldid, alignment, ...) ## Default S3 method: buildPredmat(outlist, lambda, x, foldid, alignment, ...)buildPredmat(outlist, lambda, x, foldid, alignment, ...) ## Default S3 method: buildPredmat(outlist, lambda, x, foldid, alignment, ...)
outlist |
A list of fitted |
lambda |
A vector of penalty values from the master fit. |
x |
The full predictor matrix (complex-valued). |
foldid |
Integer vector of fold assignments, length |
alignment |
Alignment method: |
... |
Other arguments passed to |
A complex matrix of predicted values, nrow(x) by
length(lambda). Rows correspond to observations held out in each
fold; all other entries are NA.
Fit a complex-valued graphical lasso for spectral precision matrix (inverse spectral density matrix) via a complex variable-wise coordinate descent algorithm for classo with covariates update.
cglasso( S, D = NULL, type = c("I", "II"), m, lambda = NULL, nlambda = 50, lambda.min.ratio = 0.01, W.init = NULL, stopping_rule = TRUE, stop_criterion = c("EBIC", "AIC", "RMSE"), maxit = 500, thresh = 1e-04, trace.it = 0, ... )cglasso( S, D = NULL, type = c("I", "II"), m, lambda = NULL, nlambda = 50, lambda.min.ratio = 0.01, W.init = NULL, stopping_rule = TRUE, stop_criterion = c("EBIC", "AIC", "RMSE"), maxit = 500, thresh = 1e-04, trace.it = 0, ... )
S |
nvar x nvar-dimensional symmetric spectral density (or spectral coherence) matrix. S is considered as being computed by average smoothed periodogram (the bandwidth is computed by using the given nobs). |
D |
The nvar x nvar-dimensional diagonal matrix to produce the partial spectral coherence matrix from S. Default is |
type |
A logical flag to choose the formulation to solve. Default is
for the given D. If type is |
m |
Window size. This quantity is need to compute the Fourier frequency, extended BIC, and bandwidth for the average smoothed periodogram. |
lambda |
A user supplied |
nlambda |
The number of |
lambda.min.ratio |
Smallest value for |
W.init |
Logical flag whether the initially estimated spectral density matrix is given. Default is |
stopping_rule |
Logical flag if the algorithm is terminated by stopping rule. If the algorithm is early terminated ,not all estimates for initially designated lambdas are explored. |
stop_criterion |
Stopping criterion for early termination. Default is |
maxit |
Maximum number of iterations of both outer and inner loops. Default 500. |
thresh |
Convergence threshold for coordinate descent. Default is 1e-4. |
trace.it |
If |
... |
Other arguments that can be passed to |
The sequence of models implied by lambda is fit by coordinate descent.
An object with class "cglassofit" and "cglasso".
Sequence of values of information criterion for a fixed lambda.
Stopping criterion used.
The index for lambda that minimizes the value of the information criterion.
Sequence of lambdas used.
Estimated inverse spectral matrix for each fixed lambda. It is provided in the list.
Type of the formulation used, either CGLASSO-I or CGLASSO-II.
Used scale diagonal matrix.
Navonil Deb, Younghoon Kim, Sumanta Basu
Maintainer: Younghoon Kim
[email protected]
Deb, N., Kim, Y., Basu, S. (2026) Inference for High-Dimensional Sparse Spectral Precision Matrices, https://arxiv.org/abs/2606.07986.
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.j(X_t,j,m) f_j_hat <- t(d_j) %*% Conj(d_j) / (2*m+1) fit <- cglasso(S=f_j_hat, m=floor(sqrt(n)))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.j(X_t,j,m) f_j_hat <- t(d_j) %*% Conj(d_j) / (2*m+1) fit <- cglasso(S=f_j_hat, m=floor(sqrt(n)))
A synthetic dataset used to illustrate the complex-valued graphical Lasso
(cglasso). The data consist of a smoothed periodogram matrix
at a single Fourier frequency, computed from a simulated multivariate
time series with a known sparse spectral precision matrix structure.
data(cglasso_example)data(cglasso_example)
A list with the following components:
f_hatA complex-valued Hermitian matrix.
The smoothed periodogram (spectral density) estimate at Fourier
frequency index j, computed via fhat_at with
half-bandwidth m = floor(sqrt(n)).
nA positive integer. The number of time series
observations used to generate the data. The half-bandwidth is
m = floor(sqrt(n)).
pA positive integer. The number of variables (dimension of the time series).
jA positive integer. The Fourier frequency index at which
f_hat was evaluated.
The dataset is generated from a -dimensional VMA(3) process
with observations. The half-bandwidth m is chosen
as floor(sqrt(n)) and the smoothed periodogram f_hat is
evaluated at frequency index j = 1.
Deb, N., Kim, Y., Basu, S. (2026) Inference for High-Dimensional Sparse Spectral Precision Matrices, https://arxiv.org/abs/2606.07986.
Fit a complex-valued graphical Lasso formulation for a path of lambda values.
cglasso.path solves the penalized Gaussian maximum likelihood problem for a path of lambda values.
cglasso.path( S, D, type, m, lambda, nlambda, lambda.min.ratio, W.init, stopping_rule, stop_criterion, maxit, thresh, trace.it, ... )cglasso.path( S, D, type, m, lambda, nlambda, lambda.min.ratio, W.init, stopping_rule, stop_criterion, maxit, thresh, trace.it, ... )
S |
p x p-dimensional symmetric spectral density (or spectral coherence) matrix. S is considered as being computed by average smoothed periodogram (the bandwidth is computed by using the given nobs). |
D |
The p x p-dimensional diagonal matrix to produce the partial spectral coherence matrix from S. Default is |
type |
Logical flag to choose the formulation to solve. Default is
for the given |
m |
Window size. This quantity is need to compute the Fourier frequency, extended BIC, and bandwidth for the average smoothed periodogram. |
lambda |
A user supplied |
nlambda |
The number of |
lambda.min.ratio |
Smallest value for |
W.init |
Logical flag whether the initially estimated spectral density matrix is given. Default is |
stopping_rule |
Logical flag if the algorithm is terminated by stopping rule. If the algorithm is early terminated, not all estimates for initially designated lambdas are explored. |
stop_criterion |
Stopping criterion for early termination. Default is |
maxit |
Maximum number of iterations of both outer and inner loops. Default 500. |
thresh |
Convergence threshold for coordinate descent. Default is 1e-4. |
trace.it |
If |
... |
Other arguments that can be passed to |
An object with class "cglassofit" and "cglasso".
Sequence of values of the information criterion for each lambda.
Stopping criterion used.
The index for the lambda that minimizes the information criterion.
Sequence of lambdas used.
Estimated spectral precision matrix for each fixed lambda, provided as a list.
Type of the formulation used, either CGLASSO-I or CGLASSO-II.
Scale diagonal matrix used.
Fit a complex-valued lasso formulation via complex update coordinate descent algorithm. By defining a field isomophism between complex values and its 2 by 2 representation, it enables to update each coordinate of the solution as a regular coordinate descent algorithm.
classo( x, y, weights = NULL, lambda = NULL, nlambda = 100, lambda.min.ratio = ifelse(nobs < nvars, 0.01, 1e-04), standardize = TRUE, intercept = FALSE, maxit = 10000, thresh = 1e-07, trace.it = 0, ... )classo( x, y, weights = NULL, lambda = NULL, nlambda = 100, lambda.min.ratio = ifelse(nobs < nvars, 0.01, 1e-04), standardize = TRUE, intercept = FALSE, maxit = 10000, thresh = 1e-07, trace.it = 0, ... )
x |
input matrix, of dimension nobs x nvars; each row is an observation vector.
Requirement: |
y |
response variable. |
weights |
observation weights. Default is 1 for each observation. |
lambda |
A user supplied |
nlambda |
The number of |
lambda.min.ratio |
Smallest value for |
standardize |
Logical flag for x variable standardization, prior to
fitting the model sequence. The coefficients are always returned on the
original scale. Default is |
intercept |
Should intercept(s) set to zero (default=FALSE) or be fitted (TRUE). |
maxit |
Maximum number of iterations of outer loop. Default 10,000. |
thresh |
Convergence threshold for coordinate descent.
Each inner coordinate-descent loop continues until the maximum change in the objective
after any coefficient update is less than |
trace.it |
If |
... |
Other arguments that can be passed to |
The sequence of models implied by lambda is fit by coordinate descent.
An object with class "classofit" and "classo".
Intercept sequence of length length(lambda).
A nvars x length(lambda) matrix of coefficients, stored in
sparse matrix format.
The number of nonzero coefficients for each value of lambda.
Dimension of coefficient matrix.
The actual sequence of lambda values used. When alpha=0, the largest lambda reported does not quite give the zero coefficients reported (lambda=inf would in principle). Instead, the largest lambda for alpha=0.001 is used, and the sequence of lambda values is derived from this.
The fraction of (null) deviance explained. The deviance calculations incorporate weights if present in the model. The deviance is defined to be 2*(loglike_sat - loglike), where loglike_sat is the log-likelihood for the saturated model (a model with a free parameter per observation). Hence dev.ratio=1-dev/nulldev.
Null deviance (per observation). This is defined to be 2*(loglike_sat -loglike(Null)). The null model refers to the intercept model.
The call that produced this object.
Number of observations.
Navonil Deb, Younghoon Kim, Sumanta Basu
Maintainer: Younghoon Kim
[email protected]
Deb, N., Kuceyeski, A., Basu, S. (2024) Regularized Estimation of Sparse Spectral Precision Matrices, https://arxiv.org/abs/2401.11128.
set.seed(1010) n <- 1000 p <- 200 x <- array(rnorm(n*p), c(n,p)) + (1+1i) * array(rnorm(n*p), c(n,p)) for (j in 1:p) x[,j] <- x[,j] / sqrt(mean(Mod(x[,j])^2)) e <- rnorm(n) + (1+1i) * rnorm(n) b <- c(1, -1, rep(0, p-2)) + (1+1i) * c(-0.5, 2, rep(0, p-2)) y <- x %*% b + e fit.test <- classo(x, y)set.seed(1010) n <- 1000 p <- 200 x <- array(rnorm(n*p), c(n,p)) + (1+1i) * array(rnorm(n*p), c(n,p)) for (j in 1:p) x[,j] <- x[,j] / sqrt(mean(Mod(x[,j])^2)) e <- rnorm(n) + (1+1i) * rnorm(n) b <- c(1, -1, rep(0, p-2)) + (1+1i) * c(-0.5, 2, rep(0, p-2)) y <- x %*% b + e fit.test <- classo(x, y)
A synthetic dataset used to illustrate the complex-valued Lasso
(classo). The data consist of a complex-valued design matrix
and response vector generated from a sparse linear model.
data(classo_example)data(classo_example)
A list with the following components:
xA complex-valued matrix of dimension
(). Each column has been
normalised so that .
yA complex-valued vector of length . The response
where is complex
Gaussian noise.
betaA complex-valued vector of length . The true
sparse coefficient vector, with nonzero entries at positions 1 and 2.
nA positive integer. The number of observations.
pA positive integer. The number of variables.
The dataset is generated with observations and
variables. The true coefficient vector has
two nonzero entries. Each column of x is normalised to have unit
complex magnitude. The response y is
with complex Gaussian noise .
Deb, N., Kuceyeski, A., Basu, S. (2024) Regularized Estimation of Sparse Spectral Precision Matrices, https://arxiv.org/abs/2401.11128.
View and/or change the factory default parameters in classo
classo.control( fdev = NULL, devmax = NULL, eps = NULL, big = NULL, mnlam = NULL, pmin = NULL, exmx = NULL, prec = NULL, mxit = NULL, itrace = NULL, epsnr = NULL, mxitnr = NULL, factory = FALSE )classo.control( fdev = NULL, devmax = NULL, eps = NULL, big = NULL, mnlam = NULL, pmin = NULL, exmx = NULL, prec = NULL, mxit = NULL, itrace = NULL, epsnr = NULL, mxitnr = NULL, factory = FALSE )
fdev |
minimum fractional change in deviance for stopping path; factory default = 1.0e-5 |
devmax |
maximum fraction of explained deviance for stopping path; factory default = 0.999 |
eps |
minimum value of lambda.min.ratio (see classo); factory default= 1.0e-6 |
big |
large floating point number; factory default = 9.9e35. Inf in definition of upper.limit is set to big |
mnlam |
minimum number of path points (lambda values) allowed; factory default = 5 |
pmin |
minimum probability for any class. factory default = 1.0e-9. Note that this implies a pmax of 1-pmin. |
exmx |
maximum allowed exponent. factory default = 250.0 |
prec |
convergence threshold for multi response bounds adjustment solution. factory default = 1.0e-10 |
mxit |
maximum iterations for multiresponse bounds adjustment solution. factory default = 100 |
itrace |
If 1 then progress bar is displayed when running |
epsnr |
convergence threshold for |
mxitnr |
maximum iterations for the IRLS loop in |
factory |
If |
If called with no arguments, classo.control() returns a list with the
current settings of these parameters. Any arguments included in the call
sets those parameters to the new values, and then silently returns. The
values set are persistent for the duration of the R session.
A list with named elements as in the argument list
classo
classo.control(fdev = 0) # continue along path even though not much changes classo.control() # view current settings classo.control(factory = TRUE) # reset all parameters to their defaultclasso.control(fdev = 0) # continue along path even though not much changes classo.control() # view current settings classo.control(factory = TRUE) # reset all parameters to their default
Fit a complex-valued lasso formulation for a path of lambda values.
classo.path solves the Lasso problem for a path of lambda values.
classo.path( x, y, weights = NULL, standardize = FALSE, lambda = NULL, nlambda = 100, lambda.min.ratio = ifelse(nobs < nvars, 0.01, 1e-04), intercept = FALSE, thresh = 1e-10, maxit = 1e+05, trace.it = 0, ... )classo.path( x, y, weights = NULL, standardize = FALSE, lambda = NULL, nlambda = 100, lambda.min.ratio = ifelse(nobs < nvars, 0.01, 1e-04), intercept = FALSE, thresh = 1e-10, maxit = 1e+05, trace.it = 0, ... )
x |
Complex-valued input matrix, of dimension nobs by nvar; each row is an observation vector. |
y |
Complex-valued response variable, nobs dimensional vector. |
weights |
Observation weights. Default is 1 for each observation. |
standardize |
Logical flag for x variable standardize beforehand; i.e. for n and p by nobs and nvar,
is satisfied for the input x. Default is |
lambda |
A user supplied |
nlambda |
The number of |
lambda.min.ratio |
If |
intercept |
Should intercept be set to zero (default=FALSE) or fitted (TRUE)? This default is reversed from |
thresh |
Convergence threshold for coordinate descent. Each inner
coordinate-descent loop continues until the maximum change in the objective after any
coefficient update is less than thresh times the null deviance. Default value is |
maxit |
Maximum number of iterations of outer loop. Default 10,000. |
trace.it |
Controls how much information is printed to screen. Default is
|
... |
Other arguments that can be passed to |
An object with class "classofit" and "classo".
Intercept sequence of length length(lambda).
A nvars x length(lambda) matrix of coefficients, stored in
sparse matrix format.
The number of nonzero coefficients for each value of lambda.
Dimension of coefficient matrix.
The actual sequence of lambda values used. When alpha=0, the largest lambda reported does not quite give the zero coefficients reported (lambda=inf would in principle). Instead, the largest lambda for alpha=0.001 is used, and the sequence of lambda values is derived from this.
The fraction of (null) deviance explained. The deviance calculations incorporate weights if present in the model. The deviance is defined to be 2*(loglike_sat - loglike), where loglike_sat is the log-likelihood for the saturated model (a model with a free parameter per observation). Hence dev.ratio=1-dev/nulldev.
Null deviance (per observation). This is defined to be 2*(loglike_sat -loglike(Null)). The null model refers to the intercept model.
The call that produced this object.
Number of observations.
Similar to other predict methods, this function predicts fitted values,
coefficients and more from a fitted "classo" object.
## S3 method for class 'classo' coef(object, s = NULL, exact = FALSE, ...) ## S3 method for class 'classo' predict( object, newx, s = NULL, type = c("link", "response", "coefficients", "nonzero"), exact = FALSE, ... )## S3 method for class 'classo' coef(object, s = NULL, exact = FALSE, ...) ## S3 method for class 'classo' predict( object, newx, s = NULL, type = c("link", "response", "coefficients", "nonzero"), exact = FALSE, ... )
object |
Fitted |
s |
Value(s) of the penalty parameter |
exact |
Relevant only when predictions are made at values of |
... |
Additional arguments, e.g. |
newx |
Matrix of new values for |
type |
Type of prediction required. |
coef(...) is equivalent to predict(type="coefficients",...).
"link" and "response" are treated identically and both return
the fitted complex-valued predictions .
The object returned depends on type. "coefficients"
returns a matrix; "nonzero" returns a list of index vectors;
"link" and "response" return a complex matrix of
predictions.
Younghoon Kim, Navonil Deb, and Sumanta Basu
Maintainer:
Younghoon Kim [email protected]
Deb, N., Kuceyeski, A. and Basu, S. (2024) Regularized estimation of sparse spectral precision matrices, https://arxiv.org/abs/2401.11128.
classo, and print, and coef methods, and
cv.classo.
A convenience wrapper that extracts coefficients from the
classo.fit stored in a "cv.classo" object at a chosen
lambda value.
## S3 method for class 'cv.classo' coef(object, s = c("lambda.1se", "lambda.min"), ...)## S3 method for class 'cv.classo' coef(object, s = c("lambda.1se", "lambda.min"), ...)
object |
Fitted |
s |
Value(s) of the penalty parameter |
... |
Additional arguments passed to |
A complex-valued coefficient matrix; see predict.classo.
classo, coef.classo,
cv.classo.
Does k-fold cross-validation for classo, produces a plot, and returns a
value for lambda
cv.classo( x, y, weights = NULL, lambda = NULL, nfolds = 10, foldid = NULL, alignment = c("lambda", "fraction"), keep = FALSE, parallel = FALSE, trace.it = 0, ... )cv.classo( x, y, weights = NULL, lambda = NULL, nfolds = 10, foldid = NULL, alignment = c("lambda", "fraction"), keep = FALSE, parallel = FALSE, trace.it = 0, ... )
x |
|
y |
response |
weights |
Observation weights; defaults to 1 per observation |
lambda |
Optional user-supplied lambda sequence; default is |
nfolds |
number of folds - default is 10. Although |
foldid |
an optional vector of values between 1 and |
alignment |
This is an experimental argument, designed to fix the
problems users were having with CV, with possible values |
keep |
If |
parallel |
If |
trace.it |
If |
... |
Other arguments that can be passed to |
The function runs classo nfolds+1 times; the first to get the
lambda sequence, and then the remainder to compute the fit with each
of the folds omitted. The error is accumulated, and the average error and
standard deviation over the folds is computed.
Note that the results of cv.classo are random, since the folds
are selected at random. Users can reduce this randomness by running
cv.classo many times, and averaging the error curves.
an object of class "cv.classo" is returned, which is a list
with the ingredients of the cross-validation fit.
the values of lambda used in the fits.
The mean cross-validated error - a vector of length length(lambda).
estimate of standard error of cvm.
upper curve = cvm+cvsd.
lower curve = cvm-cvsd.
number of non-zero coefficients at each lambda.
a text string indicating type of measure for plotting purposes.
a fitted classo object for the full data.
value of lambda that gives minimum cvm.
largest value of lambda such that error is within 1 standard error of the minimum.
if keep=TRUE, this is the array of pre-validated fits. Some entries can be NA,
if that and subsequent values of lambda are not reached for that fold.
if keep=TRUE, the fold assignments used.
a one column matrix with the indices of lambda.min and lambda.1se in the sequence of coefficients, fits etc.
Navonil Deb, Younghoon Kim, Sumanta Basu
Maintainer: Younghoon Kim
[email protected]
classo and plot and coef methods for "cv.classo".
set.seed(1010) n <- 1000 p <- 200 x <- array(rnorm(n*p), c(n,p)) + (1+1i) * array(rnorm(n*p), c(n,p)) for (j in 1:p) x[,j] <- x[,j] / sqrt(mean(Mod(x[,j])^2)) e <- rnorm(n) + (1+1i) * rnorm(n) b <- c(1, -1, rep(0, p-2)) + (1+1i) * c(-0.5, 2, rep(0, p-2)) y <- x %*% b + e cv.test <- cv.classo(x, y)set.seed(1010) n <- 1000 p <- 200 x <- array(rnorm(n*p), c(n,p)) + (1+1i) * array(rnorm(n*p), c(n,p)) for (j in 1:p) x[,j] <- x[,j] / sqrt(mean(Mod(x[,j])^2)) e <- rnorm(n) + (1+1i) * rnorm(n) b <- c(1, -1, rep(0, p-2)) + (1+1i) * c(-0.5, 2, rep(0, p-2)) y <- x %*% b + e cv.test <- cv.classo(x, y)
Simple simulated data, used to demonstrate the features of cxreg
Data objects used to demonstrate features in the cxreg vignette
These datasets are artificial, and are used to test out some of the features of cxreg.
data(classo_example) x <- classo_example$x y <- classo_example$y classo(x, y) data(cglasso_example) f_hat <- cglasso_example$f_hat m <- floor(sqrt(cglasso_example$n)) cglasso(S = f_hat, m = m, type = "I") cglasso(S = f_hat, m = m, type = "II")data(classo_example) x <- classo_example$x y <- classo_example$y classo(x, y) data(cglasso_example) f_hat <- cglasso_example$f_hat m <- floor(sqrt(cglasso_example$n)) cglasso(S = f_hat, m = m, type = "I") cglasso(S = f_hat, m = m, type = "II")
Computes the one-step debiased (desparsified) estimator of the spectral
precision matrix from a fitted cglasso object. The debiasing
correction follows the formula
where is the cglasso estimate and
is the smoothed periodogram at the target frequency.
decglasso(object, fhat, index = NULL)decglasso(object, fhat, index = NULL)
object |
A fitted object of class |
fhat |
A |
index |
Integer. When |
A list of class "decglasso" with the following components:
Theta_tildeThe complex-valued debiased
spectral precision matrix estimate.
Theta_hatThe complex-valued cglasso
estimate used as input to the debiasing step.
fhatThe smoothed spectral density matrix supplied via
fhat.
Navonil Deb, Younghoon Kim, Sumanta Basu
Maintainer: Younghoon Kim
[email protected]
Deb, N., Kim Y., Basu, S. (2026) Inference for High-Dimensional Sparse Spectral Precision Matrices, https://arxiv.org/abs/2606.07986.
library(mvtnorm) 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 <- rmvnorm(n = n, mean = rep(0, p), sigma = Sigma) dft <- dft.all(X_t) fhat <- fhat_at(dft, j, m) fit <- cglasso(S = fhat, m = m) res <- decglasso(object = fit, fhat = fhat) Theta_tilde <- res$Theta_tildelibrary(mvtnorm) 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 <- rmvnorm(n = n, mean = rep(0, p), sigma = Sigma) dft <- dft.all(X_t) fhat <- fhat_at(dft, j, m) fit <- cglasso(S = fhat, m = m) res <- decglasso(object = fit, fhat = fhat) Theta_tilde <- res$Theta_tilde
Computes the (normalized) discrete Fourier transform (DFT) of a matrix X row-wise using mvfft over all Fourier frequencies.
dft.all(X)dft.all(X)
X |
A numeric matrix of size |
A complex-valued matrix of dimension representing all DFT components of the original matrix.
Computes the (normalized) discrete Fourier transform (DFT) of a matrix X row-wise using mvfft, and extracts a window of frequencies centered at a target index.
dft.j(X, j, m)dft.j(X, j, m)
X |
A numeric matrix of size |
j |
An integer index in |
m |
A non-negative integer specifying the window half-width. The function returns |
A complex-valued matrix of dimension representing selected DFT components of the original matrix.
Returns the model family for objects fitted by classo or
cv.classo. All classo models fit a complex-valued
Gaussian likelihood, so the family is always "gaussian".
## S3 method for class 'classo' family(object, ...) ## S3 method for class 'classofit' family(object, ...) ## S3 method for class 'cv.classo' family(object, ...)## S3 method for class 'classo' family(object, ...) ## S3 method for class 'classofit' family(object, ...) ## S3 method for class 'cv.classo' family(object, ...)
object |
A fitted model object of class |
... |
Not used. |
A character string: "gaussian".
Extracts a window of 2m + 1 DFT components centered at index j
from a pre-computed full DFT matrix and returns their averaged outer product,
i.e. the smoothed periodogram (spectral density) estimate at frequency
:
where is the -th row of the DFT matrix (as a column vector)
and denotes the conjugate transpose.
fhat_at(dft, j, m)fhat_at(dft, j, m)
dft |
A complex-valued matrix of dimension |
j |
An integer index in |
m |
A non-negative integer specifying the window half-width. Frequency
indices outside |
A complex-valued Hermitian matrix giving the
smoothed periodogram estimate at frequency .
Navonil Deb, Younghoon Kim, Sumanta Basu
Maintainer: Younghoon Kim
[email protected]
Deb, N., Kim Y., Basu, S. (2026) Inference for High-Dimensional Sparse Spectral Precision Matrices, https://arxiv.org/abs/2606.07986.
p <- 30 n <- 500 set.seed(1010) X_t <- matrix(rnorm(n * p), n, p) dft <- dft.all(X_t) m <- floor(sqrt(n)); j <- 1 fhat <- fhat_at(dft, j, m)p <- 30 n <- 500 set.seed(1010) X_t <- matrix(rnorm(n * p), n, p) dft <- dft.all(X_t) m <- floor(sqrt(n)); j <- 1 fhat <- fhat_at(dft, j, m)
Produces a heatmap of the estimated spectral precision matrix for a fitted
"cglasso" object. An inverse spectral matrix heatmap is produced.
## S3 method for class 'cglasso' plot( x, index = 1, type = c("mod", "real", "imaginary", "both"), label = FALSE, ... )## S3 method for class 'cglasso' plot( x, index = 1, type = c("mod", "real", "imaginary", "both"), label = FALSE, ... )
x |
Fitted |
index |
Integer index selecting which element of |
type |
Which component to plot: |
label |
If |
... |
Other graphical parameters passed to |
No return value; called for its side effect of producing a plot.
Navonil Deb, Younghoon Kim, Sumanta Basu
Maintainer: Younghoon Kim
[email protected]
Produces a coefficient profile plot of the coefficient paths for a fitted
"classo" object.
## S3 method for class 'classo' plot(x, xvar = c("norm", "lambda", "dev"), label = FALSE, ...)## S3 method for class 'classo' plot(x, xvar = c("norm", "lambda", "dev"), label = FALSE, ...)
x |
fitted |
xvar |
What is on the X-axis. |
label |
If |
... |
Other graphical parameters to plot |
A coefficient profile plot is produced.
No return value, called for side effects (produces a plot).
Navonil Deb, Younghoon Kim, Sumanta Basu
Maintainer: Younghoon Kim
[email protected]
classo
Plots the cross-validation curve, and upper and lower standard deviation
curves, as a function of the lambda values used.
## S3 method for class 'cv.classo' plot(x, sign.lambda = 1, ...)## S3 method for class 'cv.classo' plot(x, sign.lambda = 1, ...)
x |
fitted |
sign.lambda |
Either plot against |
... |
Other graphical parameters to plot. |
A plot is produced, and nothing is returned.
No return value, called for side effects (produces a plot).
Navonil Deb, Younghoon Kim, Sumanta Basu
Maintainer: Younghoon Kim
[email protected]
classo and plot methods for "cv.classo".
set.seed(1010) n <- 1000 p <- 200 x <- array(rnorm(n*p), c(n,p)) + (1+1i) * array(rnorm(n*p), c(n,p)) for (j in 1:p) x[,j] <- x[,j] / sqrt(mean(Mod(x[,j])^2)) e <- rnorm(n) + (1+1i) * rnorm(n) b <- c(1, -1, rep(0, p-2)) + (1+1i) * c(-0.5, 2, rep(0, p-2)) y <- x %*% b + e cv.test <- cv.classo(x, y) plot(cv.test)set.seed(1010) n <- 1000 p <- 200 x <- array(rnorm(n*p), c(n,p)) + (1+1i) * array(rnorm(n*p), c(n,p)) for (j in 1:p) x[,j] <- x[,j] / sqrt(mean(Mod(x[,j])^2)) e <- rnorm(n) + (1+1i) * rnorm(n) b <- c(1, -1, rep(0, p-2)) + (1+1i) * c(-0.5, 2, rep(0, p-2)) y <- x %*% b + e cv.test <- cv.classo(x, y) plot(cv.test)
This function makes predictions from a cross-validated classo model, using
the stored "classo.fit" object and a chosen lambda value.
## S3 method for class 'cv.classo' predict(object, newx, s = c("lambda.1se", "lambda.min"), ...)## S3 method for class 'cv.classo' predict(object, newx, s = c("lambda.1se", "lambda.min"), ...)
object |
Fitted |
newx |
Matrix of new values for |
s |
Value(s) of the penalty parameter |
... |
Additional arguments passed to the |
The object returned by predict.classo for the chosen
s: a complex-valued matrix of predicted values, or a coefficient
matrix, depending on type.
Younghoon Kim, Navonil Deb, Sumanta Basu
Maintainer:
Younghoon Kim [email protected]
classo, predict.classo,
coef.cv.classo, cv.classo.
Print a summary of the classo path at each step along the path.
## S3 method for class 'classo' print(x, digits = max(3, getOption("digits") - 3), ...)## S3 method for class 'classo' print(x, digits = max(3, getOption("digits") - 3), ...)
x |
fitted classo object |
digits |
significant digits in printout |
... |
additional print arguments |
The call that produced the object x is printed, followed by a
three-column matrix with columns Df, %Dev and Lambda.
The Df column is the number of nonzero coefficients (Df is a
reasonable name only for lasso fits). %Dev is the percent deviance
explained (relative to the null deviance).
The matrix above is silently returned
classo, predict and coef methods.
Print a summary of the results of cross-validation for a classo model.
## S3 method for class 'cv.classo' print(x, digits = max(3, getOption("digits") - 3), ...)## S3 method for class 'cv.classo' print(x, digits = max(3, getOption("digits") - 3), ...)
x |
fitted 'cv.classo' object |
digits |
significant digits in printout |
... |
additional print arguments |
A two-row table is printed showing the optimal lambda values
selected by the minimum CV error (lambda.min) and the 1-standard-error
rule (lambda.1se), along with the corresponding CV error, its standard
error, and the number of nonzero coefficients.
The matrix above is silently returned
classo, predict and coef methods.
m for spectral density estimationSearches over a grid of half-bandwidths m and selects the one that
minimises a generalised cross-validation (GCV) criterion derived from the
gamma deviance of the periodogram, as proposed by Ombao et al. (2001).
For each candidate m, the smoothed diagonal periodogram
is compared to the raw diagonal periodogram
via the average gamma deviance
and the GCV score is .
select_m( X, m_grid = NULL, freq_idx = NULL, q_weights = NULL, lambda_fun = NULL, eps = 1e-10, verbose = TRUE )select_m( X, m_grid = NULL, freq_idx = NULL, q_weights = NULL, lambda_fun = NULL, eps = 1e-10, verbose = TRUE )
X |
A numeric matrix of size |
m_grid |
An integer vector of candidate half-bandwidths to search over.
Default is a data-driven grid of multiples of |
freq_idx |
An integer vector of frequency indices (0-based) over which
the GCV criterion is averaged. Default is |
q_weights |
A numeric vector of non-negative weights of the same
length as |
lambda_fun |
A function of the form |
eps |
A small positive number used as a lower bound when clamping
diagonal periodogram values to avoid |
verbose |
Logical. If |
A list with the following components:
m_optThe optimal half-bandwidth minimising the GCV score.
bw_optThe corresponding full bandwidth 2*m_opt + 1.
lambda_optThe value returned by
lambda_fun at m_opt.
gcv_minThe minimum GCV score.
gcv_tableA data.frame with columns m,
bw, lambda, deviance, gcv, and
gcv_denom, one row per candidate in m_grid.
allA list of full output from gcv_theta_one_m for
each candidate m.
Navonil Deb, Younghoon Kim, Sumanta Basu
Maintainer: Younghoon Kim
[email protected]
Ombao, H. C., Raz, J. A., Strawderman, R. L., Von Sachs, R. (2001). A simple generalised crossvalidation method of span selection for periodogram smoothing. Biometrika, 88(4), 1186–1192. doi:10.1093/biomet/88.4.1186.
p <- 10 n <- 200 set.seed(42) X <- matrix(rnorm(n * p), n, p) res <- select_m(X) res$m_opt res$gcv_tablep <- 10 n <- 200 set.seed(42) X <- matrix(rnorm(n * p), n, p) res <- select_m(X) res$m_opt res$gcv_table
Applies an asymptotic FDR control procedure to the matrix of chi-squared
test statistics produced by spec.test, returning the
rejection threshold, the binary decision matrix, and (optionally) the
empirical FDR and power when the true support is known.
spec.fdr(Chi_sq, alpha, diag = FALSE, Truth = NULL, grid_size = 100)spec.fdr(Chi_sq, alpha, diag = FALSE, Truth = NULL, grid_size = 100)
Chi_sq |
A |
alpha |
A number in |
diag |
Logical. If |
Truth |
An optional |
grid_size |
Integer. Number of points in the threshold grid.
Default |
The threshold is the infimum over a grid of values
of
where is the number of upper-triangular entries tested and
approximates the tail probability of a
distribution. Entries with are rejected.
A list of class "specfdr" with the following components:
DecisionA binary matrix with 1
for rejected entries.
tauThe selected threshold , or NA
if no threshold satisfies the FDR constraint.
FDREmpirical FDR (only present when Truth is
supplied).
PowerEmpirical power (only present when Truth is
supplied).
Navonil Deb, Younghoon Kim, Sumanta Basu
Maintainer: Younghoon Kim
[email protected]
Deb, N., Kim Y., Basu, S. (2026) Inference for High-Dimensional Sparse Spectral Precision Matrices, https://arxiv.org/abs/2606.07986.
library(mvtnorm) p <- 10; n <- 200 set.seed(42) X <- rmvnorm(n, mean = rep(0, p), sigma = diag(p)) m <- floor(sqrt(n)); j <- 1; alpha <- 0.05 dft <- dft.all(X) fhat <- fhat_at(dft, j, m) fit <- cglasso(S = fhat, m = m) res <- decglasso(object = fit, fhat = fhat) vc <- var.cov(Theta = res$Theta_tilde, X = X, j = j, m = m, type = "plug-in") st <- spec.test(Est = res$Theta_tilde, varcov = vc, m = m, alpha = alpha) # FDR-controlled test (no truth known): fdr_res <- spec.fdr(Chi_sq = st$Chi_sq, alpha = alpha, diag = FALSE) fdr_res$tau fdr_res$Decisionlibrary(mvtnorm) p <- 10; n <- 200 set.seed(42) X <- rmvnorm(n, mean = rep(0, p), sigma = diag(p)) m <- floor(sqrt(n)); j <- 1; alpha <- 0.05 dft <- dft.all(X) fhat <- fhat_at(dft, j, m) fit <- cglasso(S = fhat, m = m) res <- decglasso(object = fit, fhat = fhat) vc <- var.cov(Theta = res$Theta_tilde, X = X, j = j, m = m, type = "plug-in") st <- spec.test(Est = res$Theta_tilde, varcov = vc, m = m, alpha = alpha) # FDR-controlled test (no truth known): fdr_res <- spec.fdr(Chi_sq = st$Chi_sq, alpha = alpha, diag = FALSE) fdr_res$tau fdr_res$Decision
Computes entry-wise Z-statistics, half-widths of marginal confidence
intervals, Mahalanobis chi-squared statistics, and joint elliptical
confidence region areas for the real and imaginary parts of the debiased
spectral precision matrix estimator .
spec.test(Est, varcov, m, alpha, Truth = NULL, eps = 1e-08)spec.test(Est, varcov, m, alpha, Truth = NULL, eps = 1e-08)
Est |
A |
varcov |
A |
m |
A positive integer. The half-bandwidth used to compute
|
alpha |
A number in |
Truth |
A |
eps |
A small positive number used to regularise near-zero variances.
Default |
For each entry , the joint asymptotic distribution of
is bivariate normal with covariance , where
is the matrix built from the
Vre, Vim, and Cov components of varcov. Diagonal
entries are treated as real-valued (one degree of freedom); off-diagonal
entries use a 2-df chi-squared statistic. The default null hypothesis is
(i.e. Truth = 0), which corresponds to
hypothesis testing. A non-zero Truth can be supplied for coverage
evaluation in simulation studies.
A list of class "spectest" with the following
matrices:
Chi_sqMahalanobis chi-squared test statistics. For
off-diagonal entries these are asymptotically under
the null; for diagonal entries .
areaArea of the joint confidence ellipse
for .
Z_reMarginal Z-statistics for the real parts.
wing_reHalf-widths of marginal confidence
intervals for the real parts.
Z_imMarginal Z-statistics for the imaginary parts.
wing_imHalf-widths of marginal confidence
intervals for the imaginary parts.
Navonil Deb, Younghoon Kim, Sumanta Basu
Maintainer: Younghoon Kim
[email protected]
Deb, N., Kim Y., Basu, S. (2026) Inference for High-Dimensional Sparse Spectral Precision Matrices, https://arxiv.org/abs/2606.07986.
library(mvtnorm) p <- 10; n <- 200 set.seed(42) X <- rmvnorm(n, mean = rep(0, p), sigma = diag(p)) m <- floor(sqrt(n)); j <- 1; alpha <- 0.05 dft <- dft.all(X) fhat <- fhat_at(dft, j, m) fit <- cglasso(S = fhat, m = m) res <- decglasso(object = fit, fhat = fhat) vc <- var.cov(Theta = res$Theta_tilde, X = X, j = j, m = m, type = "plug-in") # Hypothesis test (H0: Theta = 0): st <- spec.test(Est = res$Theta_tilde, varcov = vc, m = m, alpha = alpha) st$Chi_sq[1:3, 1:3]library(mvtnorm) p <- 10; n <- 200 set.seed(42) X <- rmvnorm(n, mean = rep(0, p), sigma = diag(p)) m <- floor(sqrt(n)); j <- 1; alpha <- 0.05 dft <- dft.all(X) fhat <- fhat_at(dft, j, m) fit <- cglasso(S = fhat, m = m) res <- decglasso(object = fit, fhat = fhat) vc <- var.cov(Theta = res$Theta_tilde, X = X, j = j, m = m, type = "plug-in") # Hypothesis test (H0: Theta = 0): st <- spec.test(Est = res$Theta_tilde, varcov = vc, m = m, alpha = alpha) st$Chi_sq[1:3, 1:3]
Estimates the asymptotic variance and pseudovariance of the debiased
(desparsified) cglasso estimator at a target
Fourier frequency , then decomposes them into the
variance of the real part, variance of the imaginary part, and their
cross-covariance. Two estimators are available: a plug-in estimator
based on the theoretical sandwich formula, and a heteroscedasticity- and
autocorrelation-consistent (HAC) estimator.
var.cov(Theta, X, j, m, type = c("plug-in", "HAC"))var.cov(Theta, X, j, m, type = c("plug-in", "HAC"))
Theta |
A |
X |
A numeric matrix of size |
j |
An integer frequency index (1-based) identifying the target Fourier
frequency |
m |
A positive integer. The half-bandwidth used in the smoothed
periodogram estimator; must satisfy |
type |
Character string selecting the variance estimator. Either
|
For a complex-valued estimator ,
the asymptotic distribution involves both the variance matrix
and the
pseudovariance matrix .
From these, the variances and covariance of the real and imaginary parts are
recovered via
A list of class "varcov" with the following components:
VreA real matrix. Estimated variance of
the real part of .
VimA real matrix. Estimated variance of
the imaginary part of .
CovA real matrix. Estimated covariance
between the real and imaginary parts of .
VA complex matrix. The raw variance
matrix before decomposition.
PVA complex matrix. The raw
pseudovariance matrix before decomposition.
typeCharacter string indicating which estimator was used.
Navonil Deb, Younghoon Kim, Sumanta Basu
Maintainer: Younghoon Kim
[email protected]
Deb, N., Kim Y., Basu, S. (2026) Inference for High-Dimensional Sparse Spectral Precision Matrices, https://arxiv.org/abs/2606.07986.
library(mvtnorm) p <- 10 n <- 200 set.seed(42) X <- rmvnorm(n, mean = rep(0, p), sigma = diag(p)) m <- floor(sqrt(n)); j <- 1 dft <- dft.all(X) fhat <- fhat_at(dft, j, m) fit <- cglasso(S = fhat, m = m) res <- decglasso(object = fit, fhat = fhat) # Plug-in variance estimator: vc_plug <- var.cov(Theta = res$Theta_tilde, X = X, j = j, m = m, type = "plug-in") # HAC variance estimator: vc_hac <- var.cov(Theta = res$Theta_tilde, X = X, j = j, m = m, type = "HAC")library(mvtnorm) p <- 10 n <- 200 set.seed(42) X <- rmvnorm(n, mean = rep(0, p), sigma = diag(p)) m <- floor(sqrt(n)); j <- 1 dft <- dft.all(X) fhat <- fhat_at(dft, j, m) fit <- cglasso(S = fhat, m = m) res <- decglasso(object = fit, fhat = fhat) # Plug-in variance estimator: vc_plug <- var.cov(Theta = res$Theta_tilde, X = X, j = j, m = m, type = "plug-in") # HAC variance estimator: vc_hac <- var.cov(Theta = res$Theta_tilde, X = X, j = j, m = m, type = "HAC")