Global Two-Sample Test for Network-Valued DataSource:
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.
Either an object of class nvd listing networks in sample 1 or a distance matrix of size \(n_1 + n_2\).
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.
A string specifying the desired type of representation, among:
"modularity". Defaults to
A string specifying the chosen distance for calculating the test statistic, among:
"root-euclidean". Defaults to
A character vector specifying the chosen test statistic(s), among:
"welch_euclidean"or any statistics based on inter-point distances available in the flipr package:
"flipr:cq_ip". Defaults to
The number of permutation or the tolerance. If this number is lower than
1, it is intended as a tolerance. Otherwise, it is intended as the number of required permutations. Defaults to
A character string specifying the formula to be used to compute the permutation p-value. Choices are
"exact". Defaults to
"exact"which provides exact tests.
An integer specifying the density of the minimum spanning tree used for the edge count statistics. Defaults to
An integer for specifying the seed of the random generator for result reproducibility. Defaults to
Extra arguments to be passed to the distance function.
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
n <- 10L 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") #> ! Setting the seed for sampling permutations is mandatory for obtaining a continuous p-value function. Using `seed = 1234`. t1$pvalue #>  0.0009962984 # 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") #> ! Setting the seed for sampling permutations is mandatory for obtaining a continuous p-value function. Using `seed = 1234`. t2$pvalue #>  0.9960013