Fast, single-call bootstrap for EBICglasso partial correlation networks. Combines nonparametric edge/centrality bootstrap, case-dropping stability analysis, edge/centrality difference tests, predictability CIs, and thresholded network into one function. Designed as a faster alternative to bootnet with richer output.
Arguments
- x
A data frame, numeric matrix (observations x variables), or a
netobjectwithmethod = "glasso".- iter
Integer. Number of nonparametric bootstrap iterations (default: 1000).
- cs_iter
Integer. Number of case-dropping iterations per drop proportion (default: 500).
- cs_drop
Numeric vector. Drop proportions for CS-coefficient computation (default:
seq(0.1, 0.9, by = 0.1)).- alpha
Numeric. Significance level for CIs (default: 0.05).
- gamma
Numeric. EBIC hyperparameter (default: 0.5).
- nlambda
Integer. Number of lambda values in the regularization path (default: 100).
- centrality
Character vector. Centrality measures to compute. All four built-in measures (
"strength","expected_influence","betweenness","closeness") are computed internally with no extra dependencies and are always taken from the built-in path even ifcentrality_fnis supplied. Names that are not one of these four are valid only when acentrality_fnis supplied; that function is then responsible for returning them. Default:c("strength", "expected_influence", "betweenness", "closeness").- centrality_fn
Optional function. A custom centrality function that takes a weight matrix and returns a named list of centrality vectors. When
NULL(default), all four built-in measures are computed internally:"strength"/"expected_influence"viarowSums, and"betweenness"/"closeness"via an internal Floyd-Warshall shortest-path routine. When provided, the function is called ascentrality_fn(mat)and is used only for requested measures that are not one of the four built-ins; it should return a named list (e.g.,list(my_metric = ...)).- cor_method
Character. Correlation method:
"pearson"(default),"spearman", or"kendall".- ncores
Integer. Number of parallel cores for mclapply (default: 1, sequential).
- seed
Integer or NULL. RNG seed for reproducibility.
Value
An object of class "boot_glasso" containing:
- original_pcor
Original partial correlation matrix.
- original_precision
Original precision matrix.
- original_centrality
Named list of original centrality vectors.
- original_predictability
Named numeric vector of node R-squared.
- edge_ci
Data frame of edge CIs (edge, weight, ci_lower, ci_upper, inclusion).
- edge_inclusion
Named numeric vector of edge inclusion probabilities.
- thresholded_pcor
Partial correlation matrix with non-significant edges zeroed.
- centrality_ci
Named list of data frames (node, value, ci_lower, ci_upper) per centrality measure.
- cs_coefficient
Named numeric vector of CS-coefficients per centrality measure.
- cs_data
Data frame of case-dropping correlations (drop_prop, measure, correlation).
- edge_diff_p
Symmetric matrix of pairwise edge difference p-values.
- centrality_diff_p
Named list of symmetric p-value matrices per centrality measure.
- predictability_ci
Data frame of node predictability CIs (node, r2, ci_lower, ci_upper).
- boot_edges
iter x n_edges matrix of bootstrap edge weights.
- boot_centrality
Named list of iter x p bootstrap centrality matrices.
- boot_predictability
iter x p matrix of bootstrap R-squared.
- nodes
Character vector of node names.
- n
Sample size.
- p
Number of variables.
- iter
Number of nonparametric iterations.
- cs_iter
Number of case-dropping iterations.
- cs_drop
Drop proportions used.
- alpha
Significance level.
- gamma
EBIC hyperparameter.
- nlambda
Lambda path length.
- centrality_measures
Character vector of centrality measures.
- cor_method
Correlation method.
- lambda_path
Lambda sequence used.
- lambda_selected
Selected lambda for original data.
- timing
Named numeric vector with timing in seconds.
Examples
set.seed(1)
dat <- as.data.frame(matrix(rnorm(60), ncol = 3))
net <- build_network(dat, method = "glasso")
bg <- boot_glasso(net, iter = 10, cs_iter = 5, centrality = "strength")
# \donttest{
set.seed(42)
mat <- matrix(rnorm(60), ncol = 4)
colnames(mat) <- LETTERS[1:4]
net <- build_network(as.data.frame(mat), method = "glasso")
boot <- boot_glasso(net, iter = 100, cs_iter = 50, seed = 42,
centrality = c("strength", "expected_influence"))
print(boot)
#> GLASSO Bootstrap (100 iterations, 50 case-drop per proportion)
#> Data: 15 x 4 | Alpha: 0.05 | Gamma: 0.50
#> Edges: 0/6 significant (CI excludes zero)
#> Mean inclusion probability: 0.32
#>
#> Centrality Stability (CS-coefficient):
#> strength: 0.00 [Unstable]
#> expected_influence: 0.00 [Unstable]
#>
#> Edge differences: 1/15 pairs significantly different
#> Timing: 5.7s (bootstrap: 3.4s, case-drop: 2.2s)
summary(boot, type = "edges")
#> edge weight ci_lower ci_upper inclusion
#> 1 A -- B 0 -0.15265878 0.3016131 0.24
#> 2 A -- C 0 -0.41694566 0.0000000 0.45
#> 3 B -- C 0 -0.37041116 0.2982661 0.43
#> 4 A -- D 0 0.00000000 0.3870411 0.41
#> 5 B -- D 0 -0.19093175 0.2384451 0.21
#> 6 C -- D 0 -0.01732718 0.2188424 0.18
# }