test2_global {nevada} | R Documentation |
Global Two-Sample Test for Network-Valued Data
Description
This function carries out an hypothesis test where the null hypothesis is that the two populations of networks share the same underlying probabilistic distribution against the alternative hypothesis that the two populations come from different distributions. The test is performed in a non-parametric fashion using a permutational framework in which several statistics can be used, together with several choices of network matrix representations and distances between networks.
Usage
test2_global(
x,
y,
representation = c("adjacency", "laplacian", "modularity", "transitivity"),
distance = c("frobenius", "hamming", "spectral", "root-euclidean"),
stats = c("flipr:t_ip", "flipr:f_ip"),
B = 1000L,
test = "exact",
k = 5L,
seed = NULL,
...
)
Arguments
x |
Either an object of class nvd listing networks in sample 1 or a
distance matrix of size |
y |
Either an object of class nvd listing networks in sample 2 or an integer value specifying the size of sample 1 or an integer vector specifying the indices of the observations belonging to sample 1. |
representation |
A string specifying the desired type of representation,
among: |
distance |
A string specifying the chosen distance for calculating the
test statistic, among: |
stats |
A character vector specifying the chosen test statistic(s),
among: |
B |
The number of permutation or the tolerance. If this number is lower
than |
test |
A character string specifying the formula to be used to compute
the permutation p-value. Choices are |
k |
An integer specifying the density of the minimum spanning tree used
for the edge count statistics. Defaults to |
seed |
An integer for specifying the seed of the random generator for
result reproducibility. Defaults to |
... |
Extra arguments to be passed to the distance function. |
Value
A list
with three components: the value of the
statistic for the original two samples, the p-value of the resulting
permutation test and a numeric vector storing the values of the permuted
statistics.
Examples
n <- 5L
gnp_params <- list(p = 1/3)
k_regular_params <- list(k = 8L)
# Two different models for the two populations
x <- nvd(model = "gnp", n = n, model_params = gnp_params)
y <- nvd(model = "k_regular", n = n, model_params = k_regular_params)
t1 <- test2_global(x, y, representation = "modularity")
t1$pvalue
# Same model for the two populations
x <- nvd(model = "gnp", n = 10L, model_params = gnp_params)
y <- nvd(model = "gnp", n = 10L, model_params = gnp_params)
t2 <- test2_global(x, y, representation = "modularity")
t2$pvalue