This function provides a Monte-Carlo estimate of the power of the permutation tests proposed in this package.
Usage
power2(
sample_size1,
model1,
params1,
sample_size2,
model2,
params2,
representation = "adjacency",
distance = "frobenius",
stats = c("flipr:t_ip", "flipr:f_ip"),
B = 1000L,
alpha = 0.05,
test = "exact",
k = 5L,
R = 1000L
)
Arguments
- sample_size1
An integer specifying the size of the first sample.
- model1
A string specifying the model to be used for sampling networks in the first sample. All
tidygraph::play_
functions are supported. The model name corresponds to the name of the function without theplay_
prefix.- params1
A list specifying the parameters to be passed to the model function that will generate the first sample.
- sample_size2
An integer specifying the size of the second sample.
- model2
A string specifying the model to be used for sampling networks in the second sample. All
tidygraph::play_
functions are supported. The model name corresponds to the name of the function without theplay_
prefix.- params2
A list specifying the parameters to be passed to the model
- representation
A string specifying the desired type of representation, among:
"adjacency"
,"laplacian"
and"modularity"
. Defaults to"adjacency"
.- distance
A string specifying the chosen distance for calculating the test statistic, among:
"hamming"
,"frobenius"
,"spectral"
and"root-euclidean"
. Defaults to"frobenius"
.- stats
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 toc("flipr:student_ip", "flipr:fisher_ip")
.- B
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 to1000L
.- alpha
Significance level for hypothesis testing. Defaults to
0.05
.- test
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.- k
An integer specifying the density of the minimum spanning tree used for the edge count statistics. Defaults to
5L
.- R
Number of Monte-Carlo trials used to estimate the power. Defaults to
1000L
.
Details
Currently, six scenarios of pairs of populations are implemented. Scenario 0 allows to make sure that all our permutation tests are exact.
Examples
gnp_params <- list(n = 24L, p = 1/3)
degree_params <- list(out_degree = rep(2, 24L), method = "configuration")
power2(
sample_size1 = 10L, model1 = "gnp", params1 = gnp_params,
sample_size2 = 10L, model2 = "degree", params2 = degree_params,
R = 10L,
B = 100L
)
#> ℹ Calling the `tidygraph::play_gnp()` function with the following arguments:
#> • n: 24
#> • p: 0.333333333333333
#> • directed: TRUE
#> • loops: FALSE
#> ℹ Calling the `tidygraph::play_degree()` function with the following arguments:
#> • out_degree: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, …, 2, and 2
#> • method: configuration
#> • in_degree: NULL
#> ! Setting the seed for sampling permutations is mandatory for obtaining a continuous p-value function. Using `seed = 1234`.
#> ℹ Calling the `tidygraph::play_gnp()` function with the following arguments:
#> • n: 24
#> • p: 0.333333333333333
#> • directed: TRUE
#> • loops: FALSE
#> ℹ Calling the `tidygraph::play_degree()` function with the following arguments:
#> • out_degree: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, …, 2, and 2
#> • method: configuration
#> • in_degree: NULL
#> ! Setting the seed for sampling permutations is mandatory for obtaining a continuous p-value function. Using `seed = 1234`.
#> ℹ Calling the `tidygraph::play_gnp()` function with the following arguments:
#> • n: 24
#> • p: 0.333333333333333
#> • directed: TRUE
#> • loops: FALSE
#> ℹ Calling the `tidygraph::play_degree()` function with the following arguments:
#> • out_degree: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, …, 2, and 2
#> • method: configuration
#> • in_degree: NULL
#> ! Setting the seed for sampling permutations is mandatory for obtaining a continuous p-value function. Using `seed = 1234`.
#> ℹ Calling the `tidygraph::play_gnp()` function with the following arguments:
#> • n: 24
#> • p: 0.333333333333333
#> • directed: TRUE
#> • loops: FALSE
#> ℹ Calling the `tidygraph::play_degree()` function with the following arguments:
#> • out_degree: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, …, 2, and 2
#> • method: configuration
#> • in_degree: NULL
#> ! Setting the seed for sampling permutations is mandatory for obtaining a continuous p-value function. Using `seed = 1234`.
#> ℹ Calling the `tidygraph::play_gnp()` function with the following arguments:
#> • n: 24
#> • p: 0.333333333333333
#> • directed: TRUE
#> • loops: FALSE
#> ℹ Calling the `tidygraph::play_degree()` function with the following arguments:
#> • out_degree: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, …, 2, and 2
#> • method: configuration
#> • in_degree: NULL
#> ! Setting the seed for sampling permutations is mandatory for obtaining a continuous p-value function. Using `seed = 1234`.
#> ℹ Calling the `tidygraph::play_gnp()` function with the following arguments:
#> • n: 24
#> • p: 0.333333333333333
#> • directed: TRUE
#> • loops: FALSE
#> ℹ Calling the `tidygraph::play_degree()` function with the following arguments:
#> • out_degree: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, …, 2, and 2
#> • method: configuration
#> • in_degree: NULL
#> ! Setting the seed for sampling permutations is mandatory for obtaining a continuous p-value function. Using `seed = 1234`.
#> ℹ Calling the `tidygraph::play_gnp()` function with the following arguments:
#> • n: 24
#> • p: 0.333333333333333
#> • directed: TRUE
#> • loops: FALSE
#> ℹ Calling the `tidygraph::play_degree()` function with the following arguments:
#> • out_degree: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, …, 2, and 2
#> • method: configuration
#> • in_degree: NULL
#> ! Setting the seed for sampling permutations is mandatory for obtaining a continuous p-value function. Using `seed = 1234`.
#> ℹ Calling the `tidygraph::play_gnp()` function with the following arguments:
#> • n: 24
#> • p: 0.333333333333333
#> • directed: TRUE
#> • loops: FALSE
#> ℹ Calling the `tidygraph::play_degree()` function with the following arguments:
#> • out_degree: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, …, 2, and 2
#> • method: configuration
#> • in_degree: NULL
#> ! Setting the seed for sampling permutations is mandatory for obtaining a continuous p-value function. Using `seed = 1234`.
#> ℹ Calling the `tidygraph::play_gnp()` function with the following arguments:
#> • n: 24
#> • p: 0.333333333333333
#> • directed: TRUE
#> • loops: FALSE
#> ℹ Calling the `tidygraph::play_degree()` function with the following arguments:
#> • out_degree: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, …, 2, and 2
#> • method: configuration
#> • in_degree: NULL
#> ! Setting the seed for sampling permutations is mandatory for obtaining a continuous p-value function. Using `seed = 1234`.
#> ℹ Calling the `tidygraph::play_gnp()` function with the following arguments:
#> • n: 24
#> • p: 0.333333333333333
#> • directed: TRUE
#> • loops: FALSE
#> ℹ Calling the `tidygraph::play_degree()` function with the following arguments:
#> • out_degree: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, …, 2, and 2
#> • method: configuration
#> • in_degree: NULL
#> ! Setting the seed for sampling permutations is mandatory for obtaining a continuous p-value function. Using `seed = 1234`.
#> [1] 1