This function provides a Monte-Carlo estimate of the power of the permutation tests proposed in this package.

power2(
  model1 = "gnp",
  model2 = "k_regular",
  n1 = 20L,
  n2 = 20L,
  num_vertices = 25L,
  model1_params = NULL,
  model2_params = NULL,
  representation = "adjacency",
  distance = "frobenius",
  stats = c("flipr:t_ip", "flipr:f_ip"),
  B = 1000L,
  alpha = 0.05,
  test = "exact",
  k = 5L,
  R = 1000L,
  seed = 1234
)

Arguments

model1

A string specifying the model to be used for generating the first sample. Choices are "sbm", "k_regular", "gnp", "smallworld", "pa", "poisson" and "binomial". Defaults to "gnp".

model2

A string specifying the model to be used for generating the second sample. Choices are "sbm", "k_regular", "gnp", "smallworld", "pa", "poisson" and "binomial". Defaults to "k_regular".

n1

The size of the first sample. Defaults to 20L.

n2

The size of the second sample. Defaults to 20L.

num_vertices

The number of nodes in the generated graphs. Defaults to 25L.

model1_params

A named list setting the parameters of the first chosen model. Defaults to list(p = 1/3).

model2_params

A named list setting the parameters of the second chosen model. Defaults to list(k = 8L).

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 to c("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 to 1000L.

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.

seed

An integer specifying the random generator seed. Defaults to `1234.

Value

A numeric value estimating the power of the test.

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(p = 1/3)
k_regular_params <- list(k = 8L)
power2(
  model1_params = gnp_params,
  model2_params = k_regular_params,
  R = 10,
  B = 100,
  seed = 1234
)
#> [1] 0.1