View source: R/identify_critical_links.R
| identify_critical_links | R Documentation |
Iteratively explores edges associated with the observed difference between two or more populations of brain networks, using the permutation-based L1-distance ANOVA test of Fraiman and Fraiman (2018). Edges are ranked by their marginal p-value, then removed in batches until the global test is no longer significant. The permutation null is re-evaluated using cumulative sums of edge contributions to T, which avoid recomputing the statistic from scratch at every step.
identify_critical_links(
populations,
alpha = 0.05,
method = "fisher",
adjust_method = "none",
batch_size = 1,
n_permutations = 1000,
a = 1,
seed = NULL,
criterion = c("combined", "original")
)
populations |
A named |
alpha |
Numeric significance level used both for the global test and
for the iterative edge-removal stopping rule. Default |
method |
Character string selecting the marginal edge test used to
rank candidate edges. One of |
adjust_method |
Character string passed to |
batch_size |
Positive integer giving the number of edges to drop per
iteration. Larger values speed up the procedure at the cost of coarser
resolution. A batch larger than the remaining candidate set removes all
remaining edges. Default |
n_permutations |
Positive integer giving the number of permutation
replicates used to approximate the null distribution of T. Default
|
a |
Positive numeric normalisation constant for the test statistic T
(see |
seed |
Optional integer seed for reproducibility of the permutation
replicates. Default |
criterion |
Character string selecting the test used at every step
of the procedure. |
The implementation uses the decomposition of T into per-edge
contributions \Delta_e. After each removal, the statistic equals
the initial total minus the cumulative sum for the removed edges.
Let n be the total number of graphs, m the number of groups, E the number
of possible edges, B the number of permutations and K the number of
removal steps. The dense matrix products for permuted counts cost
O(m * n * B * E); summing contributions costs O(m * B * E). The naive
distance-based path repeats O(m * n * B * E) work at each of K steps.
These bounds exclude ranking and marginal tests. The Fisher lookup table
can cost O(n^3) for balanced groups; other methods test each distinct count
vector. With the combined criterion, ranking B + 1 values at each of K
removal steps adds O(K * B * log B) time. Stored graph, label and count
matrices need O(n * E + m * n * B + m * E * B) memory. The combined
criterion also stores O(E * B) marginal p-values.
Permutation replicates are generated by uniformly permuting the group labels across the pooled sample of all graphs, while preserving the original group sizes (sampling without replacement).
All p-values treat the observed data as one more element of the set of
B + 1 values: p = (1 + \#\{b : T_b \le T_{obs}\}) / (B + 1),
giving p \ge 1 / (B + 1) (Phipson and Smyth, 2010). For the initial
global test, the false-positive bound assumes exact arithmetic and
exchangeable group labels under the null. Equal central graphs alone
do not ensure this condition. See global_test.
With criterion = "combined", the global p-value of T and the
local p-value of U are computed for the observed data and for every
replicate, among the same B + 1 values; Q_j is the smaller of
the two, and the combined p-value is the proportion of the B + 1
values of Q that are at most Q_0, the observed one. Because both
statistics come from the same permutations, no correction for using two
statistics is needed for the initial global test. After removing the
first s ranked edges, U is the smallest raw marginal p-value among the
remaining edges, evaluated separately for each replicate. The observed
edge order is held fixed across replicates. For two populations and
Fisher's test, the observed and permuted marginal p-values are read from
a hypergeometric lookup table indexed by the total count and the count
in the first population. Other methods and tests with more than two
populations evaluate each distinct count vector once. The combined
criterion stores an |E| x B matrix of p-values in addition to the
matrix of contributions to T.
The selected edges are exploratory. The false-positive bound applies to
the initial global test. The procedure does not establish edge-level
family-wise error or false discovery rate control. This is not
because the removal order is learned from the data: step-down procedures
such as the minimum-p method of Westfall and Young (1993) do the same and
still control the family-wise error rate (under subset pivotality),
because their statistic can only become less extreme as edges are
removed. T sums signed contributions of the remaining edges and has no
such monotonicity, so the later tests do not form a closed testing
procedure. Multiplicity adjustment with adjust_method does not
provide such a guarantee either: it rescales the marginal p-values but
preserves their order. A stopping p-value above alpha does not prove that
the remaining networks are equal. Report the initial global p-value
separately from the selected edges.
With criterion = "original" and the same seed, the critical edges
can differ slightly from those of versions up to 0.2.2, which estimated the
p-value as \#\{b : T_b < T_{obs}\} / B.
Permutation ranks compare the stored T and U values directly and assign exactly equal values their largest rank. Roundoff can split mathematical ties, particularly in sparse networks, or affect a small residual obtained by subtracting two large totals. This can produce spuriously small p-values and change which edges are selected. When reproducing a result, record the R version and BLAS library as well as the seed.
An object of class "critical_links": a list with the
components
a data.frame with columns node1,
node2, p_value, listing the edges removed until the test
became non-significant, ordered from most to least significant;
NULL if the global test was not significant. p_value
holds the marginal p-values after adjust_method. Because
p.adjust preserves their order and the ties it
creates are broken by the unadjusted p-values, the adjustment does
not change which edges are removed.
a list of length-2 integer vectors giving the
(i, j) indices of the removed edges, in removal order.
the input populations with the
critical edges zeroed out in every graph.
the permutation p value of the global test on the
unmodified data (combined or original, according to
criterion), NA when there were no candidate edges.
the number of candidate edges considered.
the arguments the analysis ran with.
the matched call.
Methods are provided for print,
summary and
plot. The first three components are
unchanged from earlier versions, so code that extracts them keeps working.
Fraiman, D. and Fraiman, R. (2018) An ANOVA approach for statistical comparisons of brain networks. Scientific Reports, 8, 4746. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1038/s41598-018-23152-5")}.
Phipson, B. and Smyth, G. K. (2010) Permutation p-values should never be zero: calculating exact p-values when permutations are randomly drawn. Statistical Applications in Genetics and Molecular Biology, 9(1), Article 39. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.2202/1544-6115.1585")}.
Westfall, P. H. and Young, S. S. (1993) Resampling-Based Multiple Testing. Wiley, New York.
print.critical_links,
summary.critical_links, plot.critical_links,
compute_test_statistic,
compute_edge_pvalues, get_critical_nodes.
set.seed(1)
control <- generate_category_graphs(
n_graphs = 15, n_nodes = 10, n_communities = 2,
base_intra_prob = 0.8, base_inter_prob = 0.2, seed = 1)
patient <- generate_category_graphs(
n_graphs = 15, n_nodes = 10, n_communities = 2,
base_intra_prob = 0.5, base_inter_prob = 0.5, seed = 2)
populations <- list(Control = control, Patient = patient)
result <- identify_critical_links(
populations, alpha = 0.05, method = "fisher",
n_permutations = 200, seed = 42)
result
summary(result)
head(result$critical_edges)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.