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),
  consecutive = FALSE,
  ...
)

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 the method argument of 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.

consecutive

A logical value. If FALSE (the default), all pairwise comparisons are performed in lexicographic order with respect to the order of the groups. If TRUE, only comparisons between consecutive pairs of groups are performed.

...

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.0189       0.740  0.429 
#> 2 Average -> Active           0.220        3.62   0.0476
#> 3 Disengaged -> Active       -0.108       -3.61   0.0476
#> 4 Active -> Average          -0.0699      -3.68   0.0476
#> 5 Average -> Average         -0.0875      -1.44   0.238 
#> 6 Disengaged -> Average      -0.349       -7.99   0.0476
#> 7 Active -> Disengaged        0.0509       2.33   0.0476
#> 8 Average -> Disengaged      -0.132       -3.00   0.0476
#> 9 Disengaged -> Disengaged    0.457        8.57   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.277        6.40   0.0476
#> 2 Average -> Active           0.159        1.98   0.143 
#> 3 Disengaged -> Active        0.0479       1.22   0.381 
#> 4 Active -> Average          -0.0358      -0.830  0.381 
#> 5 Average -> Average         -0.277       -2.67   0.0476
#> 6 Disengaged -> Average      -0.438       -6.08   0.0476
#> 7 Active -> Disengaged       -0.241       -8.55   0.0476
#> 8 Average -> Disengaged       0.118        2.36   0.0952
#> 9 Disengaged -> Disengaged    0.390        4.49   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.258        4.69   0.0476
#> 2 Average -> Active          -0.0602      -1.40   0.190 
#> 3 Disengaged -> Active        0.156        2.26   0.0476
#> 4 Active -> Average           0.0341       0.875  0.381 
#> 5 Average -> Average         -0.190       -2.56   0.0476
#> 6 Disengaged -> Average      -0.0889      -1.05   0.333 
#> 7 Active -> Disengaged       -0.292       -8.40   0.0476
#> 8 Average -> Disengaged       0.25         3.90   0.0476
#> 9 Disengaged -> Disengaged   -0.0667      -0.843  0.429 
#>