Local Two-Sample Test for Network-Valued Data
test2_local(
x,
y,
partition,
representation = "adjacency",
distance = "frobenius",
stats = c("flipr:t_ip", "flipr:f_ip"),
B = 1000L,
alpha = 0.05,
test = "exact",
k = 5L,
seed = NULL,
verbose = FALSE
)
An nvd
object listing networks in sample 1.
An nvd
object listing networks in sample 2.
Either a list or an integer vector specifying vertex memberships into partition elements.
A string specifying the desired type of representation,
among: "adjacency"
, "laplacian"
and "modularity"
.
Defaults to "adjacency"
.
A string specifying the chosen distance for calculating the
test statistic, among: "hamming"
, "frobenius"
,
"spectral"
and "root-euclidean"
. Defaults to
"frobenius"
.
A character vector specifying the chosen test statistic(s),
among: "original_edge_count"
, "generalized_edge_count"
,
"weighted_edge_count"
, "student_euclidean"
, "welch_euclidean"
or any
statistics based on inter-point distances available in the flipr
package: "flipr:student_ip"
, "flipr:fisher_ip"
, "flipr:bg_ip"
,
"flipr:energy_ip"
, "flipr:cq_ip"
. Defaults to c("flipr:student_ip", "flipr:fisher_ip")
.
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 1000L
.
Significance level for hypothesis testing. If set to 1, the
function outputs properly adjusted p-values. If lower than 1, then only
p-values lower than alpha are properly adjusted. Defaults to 0.05
.
A character string specifying the formula to be used to compute
the permutation p-value. Choices are "estimate"
, "upper_bound"
and
"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 5L
.
An integer for specifying the seed of the random generator for
result reproducibility. Defaults to NULL
.
Boolean specifying whether information on intermediate tests
should be printed in the process (default: FALSE
).
A length-2 list reporting the adjusted p-values of each element of the partition for the intra- and inter-tests.
n <- 10
p1 <- matrix(
data = c(0.1, 0.4, 0.1, 0.4,
0.4, 0.4, 0.1, 0.4,
0.1, 0.1, 0.4, 0.4,
0.4, 0.4, 0.4, 0.4),
nrow = 4,
ncol = 4,
byrow = TRUE
)
p2 <- matrix(
data = c(0.1, 0.4, 0.4, 0.4,
0.4, 0.4, 0.4, 0.4,
0.4, 0.4, 0.1, 0.1,
0.4, 0.4, 0.1, 0.4),
nrow = 4,
ncol = 4,
byrow = TRUE
)
sim <- sample2_sbm(n, 68, p1, c(17, 17, 17, 17), p2, seed = 1234)
m <- as.integer(c(rep(1, 17), rep(2, 17), rep(3, 17), rep(4, 17)))
test2_local(sim$x, sim$y, m,
seed = 1234,
alpha = 0.05,
B = 100)
#> $intra
#> # A tibble: 4 × 3
#> E pvalue truncated
#> <chr> <dbl> <lgl>
#> 1 P1 0.0693 TRUE
#> 2 P2 0.0693 TRUE
#> 3 P3 0.00990 FALSE
#> 4 P4 0.0693 TRUE
#>
#> $inter
#> # A tibble: 6 × 4
#> E1 E2 pvalue truncated
#> <chr> <chr> <dbl> <lgl>
#> 1 P1 P2 0.0594 TRUE
#> 2 P1 P3 0.00990 FALSE
#> 3 P1 P4 0.0594 TRUE
#> 4 P2 P3 0.00990 FALSE
#> 5 P2 P4 0.0594 TRUE
#> 6 P3 P4 0.00990 FALSE
#>