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.23  0.0476
#> 2 Average -> Active           0.188         4.18  0.0476
#> 3 Disengaged -> Active        0             0     1     
#> 4 Active -> Average          -0.148        -3.46  0.0476
#> 5 Average -> Average         -0.126        -2.68  0.0476
#> 6 Disengaged -> Average      -0.192        -2.70  0.0476
#> 7 Active -> Disengaged       -0.0657       -5.36  0.0476
#> 8 Average -> Disengaged      -0.0622       -3.16  0.0476
#> 9 Disengaged -> Disengaged    0.192         3.40  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         6.31  0.0476
#> 2 Average -> Active           0.354         8.08  0.0476
#> 3 Disengaged -> Active        0.268        10.1   0.0476
#> 4 Active -> Average          -0.314        -5.57  0.0476
#> 5 Average -> Average         -0.113        -4.29  0.0476
#> 6 Disengaged -> Average      -0.0898       -2.48  0.0952
#> 7 Active -> Disengaged       -0.0912       -5.23  0.0476
#> 8 Average -> Disengaged      -0.241        -5.63  0.0476
#> 9 Disengaged -> Disengaged   -0.178        -3.50  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.00   0.0476
#> 2 Average -> Active           0.166        5.63   0.0476
#> 3 Disengaged -> Active        0.268       10.2    0.0476
#> 4 Active -> Average          -0.166       -3.77   0.0476
#> 5 Average -> Average          0.0129       0.365  0.762 
#> 6 Disengaged -> Average       0.103        3.02   0.0476
#> 7 Active -> Disengaged       -0.0256      -1.16   0.286 
#> 8 Average -> Disengaged      -0.178       -7.56   0.0476
#> 9 Disengaged -> Disengaged   -0.370       -9.31   0.0476