| cellNetCoDa | R Documentation |
Estimates a sparse conditional-independence (Gaussian graphical) network among the parts of a composition that is robust against cellwise contamination — individual corrupted parts — on top of the closure constraint of the simplex.
cellNetCoDa(
X,
method = c("mb", "glasso"),
rho_grid = NULL,
lambda_grid = NULL,
B = 20,
sub_ratio = 0.7,
thresh = 0.05,
k = NULL,
rule = "and",
taxa = colnames(X),
...
)
X |
an |
method |
back end for the sparse network estimate: |
rho_grid |
numeric vector of graphical-lasso penalties (decreasing
order recommended). Required when |
lambda_grid |
numeric vector of neighbourhood-selection penalties
(decreasing). Required when |
B |
number of subsamples used by the StARS penalty selection (default: 20). |
sub_ratio |
subsample fraction for StARS (default: 0.7). |
thresh |
StARS edge-instability threshold (default: 0.05). The densest
graph whose monotonised instability stays at or below |
k |
number of principal components passed to the cellwise detector
|
rule |
neighbourhood-combination rule for |
taxa |
optional character vector of node (part) names for the returned
graph; defaults to |
... |
further arguments for the cellwise detector, e.g.
|
The estimator chains four steps. (i) Count zeros are replaced by a
Bayesian-multiplicative replacement and the rows are closed to the simplex.
(ii) Cellwise outliers are flagged by a masking-resistant conditional-pivot
test together with the projection flags of cellPcaCoDa and
turned into per-cell weights; a cell-cleaned centred-logratio (clr)
covariance is then formed by shrinking each flagged cell toward the robust
clr centre,
\tilde{C}_{ij} = w_{ij}\,C_{ij} + (1 - w_{ij})\,\mu_j,
where C is the clr matrix, w_{ij}\in[0,1] the cell weight and
\mu the robust clr centre. (iii) A sparse graph is read off the
cleaned covariance, either by cellwise-robust Meinshausen–Buhlmann
neighbourhood selection (method = "mb", the default) or by the
graphical lasso on the clr covariance (method = "glasso"). (iv) The
sparsity penalty is chosen by StARS.
Penalty selection (StARS). For each penalty on the supplied grid
the graph is refitted on B random subsamples (fraction
sub_ratio); the edge-selection frequency \theta gives the edge
instability 2\theta(1-\theta), averaged over edges. Following Liu et
al. (2010) the instability is monotonised and the densest graph whose
instability stays at or below thresh (the smallest stable penalty) is
returned.
Back ends. "mb" regresses each part's clr value on the
cell-cleaned clr of the remaining parts by a weighted lasso and combines the
neighbourhoods by rule; "glasso" penalises the clr covariance
directly and reads the graph from the exact zeros of the estimated precision
matrix (the SPIEC-EASI convention). Both share the same subsampling, grid
and instability convention, so penalties are comparable across back ends.
An object of class "cellNetCoDa" with components:
adj |
|
taxa |
character vector of node (part) names |
n_edges |
number of edges (the upper-triangle sum of |
weights |
|
penalty |
the StARS-selected penalty ( |
instability |
the StARS instability curve over the penalty grid |
grid |
the penalty grid the StARS curve was evaluated on |
thresh |
the StARS instability threshold used for selection |
method |
the back end used, |
flags |
|
The input must be compositional (positive parts); count zeros are handled
internally, but structural / below-detection zeros are better addressed
first (e.g. imputeBDL). At least three parts are required.
method = "mb" needs lambda_grid and method = "glasso"
needs rho_grid; supplying neither is an error. Although the nodes
are labelled taxa (the method originates in microbiome network
analysis), the parts may be any compositional variables. StARS is
stochastic — use set.seed for reproducible penalty selection.
Matthias Templ
Liu, H., Roeder, K. and Wasserman, L. (2010). Stability approach to regularization selection (StARS) for high-dimensional graphical models. Advances in Neural Information Processing Systems 23.
Meinshausen, N. and Buhlmann, P. (2006). High-dimensional graphs and variable selection with the lasso. The Annals of Statistics 34(3), 1436–1462.
Friedman, J., Hastie, T. and Tibshirani, R. (2008). Sparse inverse covariance estimation with the graphical lasso. Biostatistics 9(3), 432–441.
Kurtz, Z. D., Muller, C. L., Miraldi, E. R., Littman, D. R., Blaser, M. J. and Bonneau, R. A. (2015). Sparse and compositionally robust inference of microbial ecological networks. PLoS Computational Biology 11(5), e1004226.
Raymaekers, J. and Rousseeuw, P. J. (2024). The cellwise minimum covariance determinant estimator. Journal of the American Statistical Association 119(548), 2610–2621.
Martin-Fernandez, J. A., Hron, K., Templ, M., Filzmoser, P. and Palarea-Albaladejo, J. (2015). Bayesian-multiplicative treatment of count zeros in compositional data sets. Statistical Modelling 15(2), 134–158.
cellPcaCoDa for the cellwise detector it builds on,
pcaCoDa and outCoDa for rowwise robustness,
pivotCoord, orthbasis
data(expenditures) # 5-part compositional budget data
set.seed(1)
## cellwise-robust network via MB neighbourhood selection (needs 'glmnet')
if (requireNamespace("glmnet", quietly = TRUE)) {
net <- cellNetCoDa(expenditures, method = "mb",
lambda_grid = c(0.4, 0.3, 0.2, 0.1, 0.05),
B = 10, k = 2)
net # print method: back end, edges, penalty
net$adj # estimated 0/1 adjacency among the parts
}
## graphical-lasso back end, SPIEC-EASI style (needs 'glasso')
if (requireNamespace("glasso", quietly = TRUE)) {
net_gl <- cellNetCoDa(expenditures, method = "glasso",
rho_grid = c(0.4, 0.3, 0.2, 0.1, 0.05),
B = 10, k = 2)
net_gl$n_edges
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.