
Compare Two Networks from Sequence Data using a Permutation Test
Source:R/permutation.R
permutation_test.RdThis function compares two networks built from sequence data using permutation tests. The function builds Markov models for two sequence objects, computes the transition probabilities, and compares them by performing permutation tests. It returns the differences in transition probabilities, effect sizes, estimated p-values, and confidence intervals.
Usage
permutation_test(x, ...)
# S3 method for class 'tna'
permutation_test(
x,
y,
adjust = "none",
iter = 1000,
paired = FALSE,
level = 0.05,
measures = character(0),
...
)Arguments
- x
A
tnaobject containing sequence data for the firsttnamodel.- ...
Additional arguments passed to
centralities().- y
A
tnaobject containing sequence data for the secondtnamodel.- 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.- 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.
Value
A tna_permutation object which is a list with two elements:
edges and centralities, both containing the following elements:
stats: Adata.frameof original differences, effect sizes, and estimated p-values for each edge or centrality measure. The effect size is computed as the observed difference divided by the standard deviation of the differences of the permuted samples.diffs_true: Amatrixof differences in the data.diffs_sig: Amatrixshowing the significant differences.
See also
Validation functions
bootstrap(),
deprune(),
estimate_cs(),
permutation_test.group_tna(),
plot.group_tna_bootstrap(),
plot.group_tna_permutation(),
plot.group_tna_stability(),
plot.tna_bootstrap(),
plot.tna_permutation(),
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.tna_bootstrap(),
print.tna_permutation(),
print.tna_stability(),
prune(),
pruning_details(),
reprune(),
summary.group_tna_bootstrap(),
summary.tna_bootstrap()
Examples
model_x <- tna(group_regulation[1:200, ])
model_y <- tna(group_regulation[1001:1200, ])
# Small number of iterations for CRAN
permutation_test(model_x, model_y, iter = 20)
#> # A tibble: 81 × 4
#> edge_name diff_true effect_size p_value
#> <chr> <dbl> <dbl> <dbl>
#> 1 adapt -> adapt 0 NaN 1
#> 2 cohesion -> adapt 0.00541 0.944 0.810
#> 3 consensus -> adapt -0.000679 -0.191 0.714
#> 4 coregulate -> adapt 0.00769 0.658 0.476
#> 5 discuss -> adapt -0.130 -9.94 0.0476
#> 6 emotion -> adapt 0.0101 1.38 0.333
#> 7 monitor -> adapt -0.00480 -0.367 0.905
#> 8 plan -> adapt 0.00339 1.70 0.143
#> 9 synthesis -> adapt -0.159 -1.76 0.143
#> 10 adapt -> cohesion -0.0907 -1.41 0.190
#> # ℹ 71 more rows