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,
actor = NULL,
...
)Arguments
- x
A
group_tnaobject. Grouped models with scaled edge weights, and their networks, are not resampled (an error of classtna_error_scaling).- groups
An
integervector or acharactervector of group indices or names, respectively, defining which groups to compare. When not provided, all pairs are compared (the default).- adjust
A
characterstring for the method to adjust p-values with for multiple comparisons. The default is"none"for no adjustment. See themethodargument ofstats::p.adjust()for details and available adjustment methods. The edge p-values are corrected over the edges tested: the transitions present in either network, each pair of a co-occurrence network counted once. A transition absent from both keeps its p-value of 1.- iter
An
integergiving the number of permutations to perform. The default is 1000.- paired
A
logicalvalue. IfTRUE, perform paired permutation tests; ifFALSE, perform unpaired tests. The default isFALSE.- level
A
numericvalue giving the significance level for the permutation tests. The default is 0.05.- measures
A
charactervector of centrality measures to test. Seecentralities()for a list of available centrality measures.- consecutive
A
logicalvalue. IfFALSE(the default), all pairwise comparisons are performed in lexicographic order with respect to the order of the groups. IfTRUE, only comparisons between consecutive pairs of groups are performed.- actor
An optional actor identifier for sequences nested in actors (for example, several sessions per student). Either a
characterstring naming a non-sequence column of the data the models were built from (such as a column ofmeta_datafromprepare_data()), or a vector with one identifier per sequence (the sequences ofxfirst, then those ofy). When given, the permutation respects the nesting: actors whose sequences are all in one group are reassigned between the groups as whole units, and the sequences of actors present in both groups are shuffled within the actor (Good, 2005). A warning is given when the actors allow too few distinct permutations to reachlevel. Cannot be combined withpaired = TRUE. The defaultNULLpermutes single sequences.- ...
Additional arguments passed to
centralities().
Value
A group_tna_permutation object, which is a list of
tna_permutation objects (see permutation_test()), one per compared
pair of groups, named after the pair.
See also
Validation functions
bootstrap(),
deprune(),
estimate_cs(),
markov_order(),
permutation_test(),
plot.group_tna_bootstrap(),
plot.group_tna_permutation(),
plot.group_tna_stability(),
plot.tna_bootstrap(),
plot.tna_markov_order(),
plot.tna_permutation(),
plot.tna_reliability(),
plot.tna_stability(),
print.group_tna_bootstrap(),
print.group_tna_permutation(),
print.group_tna_stability(),
print.summary.group_tna_bootstrap(),
print.summary.tna_bootstrap(),
print.summary.tna_markov_order(),
print.tna_bootstrap(),
print.tna_markov_order(),
print.tna_permutation(),
print.tna_reliability(),
print.tna_stability(),
prune(),
pruning_details(),
reliability(),
reprune(),
summary.group_tna_bootstrap(),
summary.tna_bootstrap(),
summary.tna_markov_order(),
summary.tna_permutation(),
summary.tna_reliability(),
summary.tna_stability()
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 Disengaged -> Disengaged -0.230 -14.2 0.0476
#> 2 Engaged -> Disengaged -0.288 -17.3 0.0476
#> 3 Moderate -> Disengaged 0.00235 0.245 0.762
#> 4 Disengaged -> Engaged 0.0706 7.13 0.0476
#> 5 Engaged -> Engaged -0.00994 -0.402 0.571
#> 6 Moderate -> Engaged 0.0706 6.74 0.0476
#> 7 Disengaged -> Moderate 0.160 14.9 0.0476
#> 8 Engaged -> Moderate 0.298 11.2 0.0476
#> 9 Moderate -> Moderate -0.0730 -5.07 0.0476
#>
#> Cluster 1 vs. Cluster 3 :
#> # A tibble: 9 × 4
#> edge_name diff_true effect_size p_value
#> <chr> <dbl> <dbl> <dbl>
#> 1 Disengaged -> Disengaged -0.195 -19.6 0.0476
#> 2 Engaged -> Disengaged -0.0422 -10.6 0.0476
#> 3 Moderate -> Disengaged -0.0609 -6.63 0.0476
#> 4 Disengaged -> Engaged 0.0471 5.76 0.0476
#> 5 Engaged -> Engaged -0.00360 -0.271 0.762
#> 6 Moderate -> Engaged -0.0256 -2.79 0.0476
#> 7 Disengaged -> Moderate 0.147 22.3 0.0476
#> 8 Engaged -> Moderate 0.0458 3.30 0.0476
#> 9 Moderate -> Moderate 0.0864 7.11 0.0476
#>
#> Cluster 2 vs. Cluster 3 :
#> # A tibble: 9 × 4
#> edge_name diff_true effect_size p_value
#> <chr> <dbl> <dbl> <dbl>
#> 1 Disengaged -> Disengaged 0.0358 3.52 0.0476
#> 2 Engaged -> Disengaged 0.246 29.5 0.0476
#> 3 Moderate -> Disengaged -0.0632 -5.89 0.0476
#> 4 Disengaged -> Engaged -0.0234 -2.32 0.0476
#> 5 Engaged -> Engaged 0.00633 0.403 0.571
#> 6 Moderate -> Engaged -0.0962 -7.47 0.0476
#> 7 Disengaged -> Moderate -0.0124 -4.62 0.0476
#> 8 Engaged -> Moderate -0.252 -15.4 0.0476
#> 9 Moderate -> Moderate 0.159 8.70 0.0476
#>
