Skip to contents

Test edge weight differences between all pairs or a subset of pairs of a group_tna object. See permutation_test.tna() for more details.

Usage

# S3 method for class 'group_tna'
permutation_test(
  x,
  groups,
  adjust = "none",
  iter = 1000,
  paired = FALSE,
  level = 0.05,
  measures = character(0),
  ...
)

Arguments

x

A group_tna object

groups

An integer vector or a character vector of group indices or names, respectively, defining which groups to compare. When not provided, all pairs are compared (the default).

adjust

A character string for the method to adjust p-values with for multiple comparisons. The default is "none" for no adjustment. See stats::p.adjust() for details and available adjustment methods.

iter

An integer giving the number of permutations to perform. The default is 1000.

paired

A logical value. If TRUE, perform paired permutation tests; if FALSE, perform unpaired tests. The default is FALSE.

level

A numeric value giving the significance level for the permutation tests. The default is 0.05.

measures

A character vector of centrality measures to test. See centralities() for a list of available centrality measures.

...

Additional arguments passed to centralities().

Examples

model <- group_model(engagement_mmm)
# Small number of iterations for CRAN
permutation_test(model, iter = 20)
#> Cluster 1 vs. Cluster 2
#> 
#> # A tibble: 9 × 4
#>   edge_name                diff_true effect_size p_value
#>   <chr>                        <dbl>       <dbl>   <dbl>
#> 1 Active -> Active            0.214         4.39  0.0476
#> 2 Average -> Active           0.188         4.05  0.0476
#> 3 Disengaged -> Active        0             0     1     
#> 4 Active -> Average          -0.148        -3.35  0.0476
#> 5 Average -> Average         -0.126        -3.23  0.0476
#> 6 Disengaged -> Average      -0.192        -2.74  0.0476
#> 7 Active -> Disengaged       -0.0657       -7.44  0.0476
#> 8 Average -> Disengaged      -0.0622       -3.24  0.0476
#> 9 Disengaged -> Disengaged    0.192         3.00  0.0476
#> 
#> Cluster 1 vs. Cluster 3
#> 
#> # A tibble: 9 × 4
#>   edge_name                diff_true effect_size p_value
#>   <chr>                        <dbl>       <dbl>   <dbl>
#> 1 Active -> Active            0.405         5.04  0.0476
#> 2 Average -> Active           0.354        11.0   0.0476
#> 3 Disengaged -> Active        0.268        12.5   0.0476
#> 4 Active -> Average          -0.314        -4.59  0.0476
#> 5 Average -> Average         -0.113        -3.76  0.0476
#> 6 Disengaged -> Average      -0.0898       -2.47  0.0952
#> 7 Active -> Disengaged       -0.0912       -3.91  0.0476
#> 8 Average -> Disengaged      -0.241        -7.32  0.0476
#> 9 Disengaged -> Disengaged   -0.178        -3.99  0.0476
#> 
#> Cluster 2 vs. Cluster 3
#> 
#> # A tibble: 9 × 4
#>   edge_name                diff_true effect_size p_value
#>   <chr>                        <dbl>       <dbl>   <dbl>
#> 1 Active -> Active            0.192        5.29   0.0476
#> 2 Average -> Active           0.166        5.92   0.0476
#> 3 Disengaged -> Active        0.268       11.4    0.0476
#> 4 Active -> Average          -0.166       -4.35   0.0476
#> 5 Average -> Average          0.0129       0.367  0.619 
#> 6 Disengaged -> Average       0.103        2.84   0.0476
#> 7 Active -> Disengaged       -0.0256      -1.42   0.238 
#> 8 Average -> Disengaged      -0.178       -7.31   0.0476
#> 9 Disengaged -> Disengaged   -0.370       -9.98   0.0476