| global_test | R Documentation |
Tests for differences between two or more populations of brain networks,
using the L1-distance ANOVA statistic T of Fraiman and Fraiman (2018)
and a permutation null distribution. Valid inference requires exchangeable
group labels under the null; equal central graphs alone are not enough.
This is the global test
that identify_critical_links runs before it starts removing
edges; here it is available on its own, so that the population-level
question can be answered, and reported, before any edge is singled out.
global_test(
populations,
n_permutations = 1000,
seed = NULL,
criterion = c("combined", "original"),
method = "fisher"
)
populations |
A named |
n_permutations |
Positive integer giving the number of permutation
replicates used to approximate the null distribution of T. Default
|
seed |
Optional integer seed for reproducibility of the permutation
replicates. Default |
criterion |
|
method |
Marginal edge test used for U when |
The statistic T contrasts the mean distance of each graph to its
own population's central graph with its mean distance to every
population's central graph (see compute_test_statistic).
The test uses the lower tail of T and does not use a normal approximation.
Replicates are generated by
permuting the group labels across the pooled sample while preserving the
group sizes, T is recomputed for each, and
p = (1 + \#\{b : T_b \le T_{obs}\}) / (B + 1), which is never below
1 / (B + 1). Ties are counted by comparing the stored values
directly. On sparse networks, floating-point roundoff can separate
mathematically equal statistics and produce spuriously small p-values.
See identify_critical_links for the combined criterion.
Group labels must be exchangeable under the null: shuffling whole graphs must preserve the joint distribution of the observations. Independent graphs drawn from the same graph distribution satisfy this condition. Matching edge means alone does not, because dependence between edges can differ. Unrestricted permutations do not support paired observations, repeated measures, blocks or adjustment for covariates.
The normalisation constant a of
compute_test_statistic is fixed at 1. The p value
does not depend on it: a rescales the observed statistic and every
replicate by the same positive factor, which leaves their comparison
unchanged.
Distances sum all matrix entries. For symmetric graphs with zero diagonal, this counts each undirected edge twice, so reported T is twice the value from an upper-triangle-only distance. This shared positive factor does not change the permutation p-value.
The computation uses the edge-wise decomposition of T described in
identify_critical_links: the statistic of every replicate
is obtained from permuted edge counts through matrix products,
rather than by rebuilding graphs and recomputing distances. That
decomposition holds for binary graphs, which is why the input must be
binary. Calling global_test() and
identify_critical_links with the same populations,
n_permutations and seed evaluates the same permutations, so
the p value returned here is the one that
identify_critical_links() records in its p_value component.
An object of class "global_test": a list with the
components
the observed value of T, computed with normalisation
constant a = 1.
the permutation p value of the chosen
criterion, computed among the B + 1 values that include
the observed one; NA when the graphs have a single node and
hence no edges.
the permutation p values of
T and of U on their own (p_value_local is NA with
criterion = "original").
the observed value of U, the smallest marginal
p-value (NA with criterion = "original").
the criterion used.
numeric vector of length
n_permutations holding the statistic of every replicate.
the number of replicates.
named integer vector with the number of graphs in each population.
the number of nodes.
the matched call.
A print method is provided.
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")}.
Winkler, A. M. et al. (2014) Permutation inference for the general linear model. NeuroImage, 92, 381–397. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.neuroimage.2014.01.060")}.
compute_test_statistic for the statistic alone,
identify_critical_links for the edges behind a rejection,
print.global_test.
control <- generate_category_graphs(n_graphs = 20, n_nodes = 10,
n_communities = 2, base_intra_prob = 0.6, base_inter_prob = 0.2, seed = 1)
patient <- generate_category_graphs(n_graphs = 20, n_nodes = 10,
n_communities = 2, base_intra_prob = 0.6, base_inter_prob = 0.4, seed = 2)
populations <- list(Control = control, Patient = patient)
gt <- global_test(populations, n_permutations = 500, seed = 42)
gt
gt$p_value
# The observed statistic is the one compute_test_statistic() returns
all.equal(gt$statistic, compute_test_statistic(populations, a = 1))
# The null distribution is kept, so it can be inspected
summary(gt$null_distribution)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.