Skip to contents

Perform bootstrapping on transition networks created from sequence data stored in a tna object. Bootstrapped estimates of edge weights are returned with confidence intervals and significance testing.

Usage

bootstrap(x, ...)

# S3 method for class 'tna'
bootstrap(
  x,
  iter = 1000,
  level = 0.05,
  method = "stability",
  threshold,
  consistency_range = c(0.75, 1.25),
  ...
)

# S3 method for class 'group_tna'
bootstrap(
  x,
  iter = 1000,
  level = 0.05,
  method = "stability",
  threshold,
  consistency_range = c(0.75, 1.25),
  ...
)

Arguments

x

A tna or a group_tna object created from sequence data.

...

Ignored.

iter

An integer specifying the number of bootstrap samples to draw. Defaults to 1000.

level

A numeric value representing the significance level for hypothesis testing and confidence intervals. Defaults to 0.05.

method

A character string. This argument defines the bootstrap test statistic. The "stability" option (the default) compares edge weights against a range of "consistent" values defined by consistency_range. Weights that fall outside this range are considered insignificant. In other words, an edge is considered significant if its value is within the range in (1 - level) * 100% of the bootstrap samples. The "threshold" option instead compares the edge weights against a user-specified threshold value.

threshold

A numeric value to compare edge weights against. The default is the 10th percentile of the edge weights. Used only when method = "threshold".

consistency_range

A numeric vector of length 2. Determines how much the edge weights may deviate (multiplicatively) from their observed values (below and above) before they are considered insignificant. The default is c(0.75, 1.25) which corresponds to a symmetric 25% deviation range. Used only when method = "stability".

Value

A tna_bootstrap object which is a list containing the following elements:

  • weights_orig: The original edge weight matrix.

  • weights_sig: The matrix of significant transitions (those with estimated p-values below the significance level).

  • weights_mean: The mean weight matrix from the bootstrap samples.

  • weights_sd: The standard deviation matrix from the bootstrap samples.

  • cr_lower: The lower bound matrix of the consistency range for the edge weights.

  • cr_upper: The upper bound matrix of the consistency range for the edge weights.

  • ci_lower: The lower bound matrix of the bootstrap confidence intervals for the edge weights.

  • ci_upper: The upper bound matrix of the bootstrap confidence intervals for the edge weights.

  • p_values: The matrix of estimated p-values for the edge weights.

  • summary: A data.frame summarizing the edges, their weights, p-values, statistical significance, consistency ranges, and confidence intervals.

If x is a group_tna object, the output is a group_tna_bootstrap object, which is a list of tna_bootstrap objects.

Details

The function first computes the original edge weights for the specified cluster from the tna object. It then performs bootstrapping by resampling the sequence data and recalculating the edge weights for each bootstrap sample. The mean and standard deviation of the transitions are computed, and confidence intervals are derived. The function also estimates p-values for each edge and identifies significant edges based on the specified significance level. A matrix of significant edges (those with estimated p-values below the significance level) is generated. Additional statistics on removed edges (those not considered significant) are provided.

All results, including the original transition matrix, bootstrapped estimates, and summary statistics for removed edges, are returned in a structured list.

Examples

model <- tna(group_regulation)
# Small number of iterations for CRAN
bootstrap(model, iter = 10)
#> Non-significant Edges
#> 
#>          from         to       weight    p_value     cr_lower    cr_upper
#> 2    cohesion      adapt 0.0029498525 0.72727273 0.0022123894 0.003687316
#> 3   consensus      adapt 0.0047400853 0.18181818 0.0035550640 0.005925107
#> 4  coregulate      adapt 0.0162436548 0.27272727 0.0121827411 0.020304569
#> 5     discuss      adapt 0.0713743356 0.09090909 0.0535307517 0.089217920
#> 6     emotion      adapt 0.0024673951 0.54545455 0.0018505464 0.003084244
#> 7     monitor      adapt 0.0111653873 0.18181818 0.0083740405 0.013956734
#> 8        plan      adapt 0.0009745006 0.54545455 0.0007308754 0.001218126
#> 9   synthesis      adapt 0.2346625767 0.09090909 0.1759969325 0.293328221
#> 10      adapt   cohesion 0.2730844794 0.09090909 0.2048133595 0.341355599
#> 11   cohesion   cohesion 0.0271386431 0.18181818 0.0203539823 0.033923304
#> 12  consensus   cohesion 0.0148522673 0.09090909 0.0111392005 0.018565334
#> 13 coregulate   cohesion 0.0360406091 0.18181818 0.0270304569 0.045050761
#> 14    discuss   cohesion 0.0475828904 0.09090909 0.0356871678 0.059478613
#> 15    emotion   cohesion 0.3253436729 0.09090909 0.2440077547 0.406679591
#> 16    monitor   cohesion 0.0558269365 0.18181818 0.0418702024 0.069783671
#> 17       plan   cohesion 0.0251745980 0.09090909 0.0188809485 0.031468248
#> 18  synthesis   cohesion 0.0337423313 0.18181818 0.0253067485 0.042177914
#> 19      adapt  consensus 0.4774066798 0.09090909 0.3580550098 0.596758350
#> 20   cohesion  consensus 0.4979351032 0.09090909 0.3734513274 0.622418879
#> 21  consensus  consensus 0.0820034761 0.09090909 0.0615026070 0.102504345
#> 22 coregulate  consensus 0.1345177665 0.09090909 0.1008883249 0.168147208
#> 23    discuss  consensus 0.3211845103 0.09090909 0.2408883827 0.401480638
#> 24    emotion  consensus 0.3204088826 0.09090909 0.2403066620 0.400511103
#> 25    monitor  consensus 0.1591067690 0.09090909 0.1193300768 0.198883461
#> 26       plan  consensus 0.2904011694 0.09090909 0.2178008771 0.363001462
#> 27  synthesis  consensus 0.4662576687 0.09090909 0.3496932515 0.582822086
#> 28      adapt coregulate 0.0216110020 0.54545455 0.0162082515 0.027013752
#> 29   cohesion coregulate 0.1191740413 0.09090909 0.0893805310 0.148967552
#> 30  consensus coregulate 0.1877073787 0.09090909 0.1407805340 0.234634223
#> 31 coregulate coregulate 0.0233502538 0.09090909 0.0175126904 0.029187817
#> 32    discuss coregulate 0.0842824601 0.09090909 0.0632118451 0.105353075
#> 33    emotion coregulate 0.0341910469 0.09090909 0.0256432852 0.042738809
#> 34    monitor coregulate 0.0579204466 0.09090909 0.0434403350 0.072400558
#> 35       plan coregulate 0.0172161767 0.09090909 0.0129121325 0.021520221
#> 36  synthesis coregulate 0.0444785276 0.36363636 0.0333588957 0.055598160
#> 37      adapt    discuss 0.0589390963 0.27272727 0.0442043222 0.073673870
#> 38   cohesion    discuss 0.0595870206 0.18181818 0.0446902655 0.074483776
#> 39  consensus    discuss 0.1880233844 0.09090909 0.1410175383 0.235029231
#> 40 coregulate    discuss 0.2736040609 0.09090909 0.2052030457 0.342005076
#> 41    discuss    discuss 0.1948873703 0.09090909 0.1461655277 0.243609213
#> 42    emotion    discuss 0.1018681706 0.09090909 0.0764011280 0.127335213
#> 43    monitor    discuss 0.3754361479 0.09090909 0.2815771110 0.469295185
#> 44       plan    discuss 0.0678902063 0.09090909 0.0509176547 0.084862758
#> 45  synthesis    discuss 0.0628834356 0.27272727 0.0471625767 0.078604294
#> 46      adapt    emotion 0.1198428291 0.09090909 0.0898821218 0.149803536
#> 47   cohesion    emotion 0.1156342183 0.09090909 0.0867256637 0.144542773
#> 48  consensus    emotion 0.0726813083 0.09090909 0.0545109812 0.090851635
#> 49 coregulate    emotion 0.1720812183 0.09090909 0.1290609137 0.215101523
#> 50    discuss    emotion 0.1057960010 0.09090909 0.0793470008 0.132245001
#> 51    emotion    emotion 0.0768417342 0.09090909 0.0576313007 0.096052168
#> 52    monitor    emotion 0.0907187718 0.09090909 0.0680390789 0.113398465
#> 53       plan    emotion 0.1468247523 0.09090909 0.1101185642 0.183530940
#> 54  synthesis    emotion 0.0705521472 0.18181818 0.0529141104 0.088190184
#> 55      adapt    monitor 0.0333988212 0.27272727 0.0250491159 0.041748527
#> 56   cohesion    monitor 0.0330383481 0.09090909 0.0247787611 0.041297935
#> 57  consensus    monitor 0.0466108390 0.09090909 0.0349581292 0.058263549
#> 58 coregulate    monitor 0.0862944162 0.09090909 0.0647208122 0.107868020
#> 59    discuss    monitor 0.0222728423 0.09090909 0.0167046317 0.027841053
#> 60    emotion    monitor 0.0363059570 0.09090909 0.0272294677 0.045382446
#> 61    monitor    monitor 0.0181437544 0.18181818 0.0136078158 0.022679693
#> 62       plan    monitor 0.0755237941 0.09090909 0.0566428455 0.094404743
#> 63  synthesis    monitor 0.0122699387 0.63636364 0.0092024540 0.015337423
#> 64      adapt       plan 0.0157170923 0.54545455 0.0117878193 0.019646365
#> 65   cohesion       plan 0.1410029499 0.09090909 0.1057522124 0.176253687
#> 66  consensus       plan 0.3957971243 0.09090909 0.2968478433 0.494746405
#> 67 coregulate       plan 0.2390862944 0.09090909 0.1793147208 0.298857868
#> 68    discuss       plan 0.0116426221 0.18181818 0.0087319666 0.014553278
#> 69    emotion       plan 0.0997532605 0.09090909 0.0748149454 0.124691576
#> 70    monitor       plan 0.2156315422 0.09090909 0.1617236567 0.269539428
#> 71       plan       plan 0.3742082183 0.09090909 0.2806561637 0.467760273
#> 72  synthesis       plan 0.0751533742 0.18181818 0.0563650307 0.093941718
#> 74   cohesion  synthesis 0.0035398230 0.54545455 0.0026548673 0.004424779
#> 75  consensus  synthesis 0.0075841365 0.18181818 0.0056881024 0.009480171
#> 76 coregulate  synthesis 0.0187817259 0.36363636 0.0140862944 0.023477157
#> 77    discuss  synthesis 0.1409769679 0.09090909 0.1057327259 0.176221210
#> 78    emotion  synthesis 0.0028198802 0.54545455 0.0021149101 0.003524850
#> 79    monitor  synthesis 0.0160502442 0.18181818 0.0120376832 0.020062805
#> 80       plan  synthesis 0.0017865844 0.36363636 0.0013399383 0.002233230
#>        ci_lower    ci_upper
#> 2  0.0007146923 0.005853452
#> 3  0.0031162999 0.005670046
#> 4  0.0132977590 0.023854536
#> 5  0.0638149019 0.077541151
#> 6  0.0013932185 0.003958716
#> 7  0.0084833480 0.016781683
#> 8  0.0006938210 0.001610183
#> 9  0.1997386662 0.265442566
#> 10 0.2438849341 0.302781017
#> 11 0.0204571493 0.034753199
#> 12 0.0121010910 0.017028585
#> 13 0.0336605579 0.047170932
#> 14 0.0407473912 0.051709383
#> 15 0.3197919209 0.347638871
#> 16 0.0546041045 0.068622062
#> 17 0.0214130553 0.027621960
#> 18 0.0243012422 0.041056741
#> 19 0.4362729741 0.511017683
#> 20 0.4815855147 0.511561367
#> 21 0.0795857757 0.085315095
#> 22 0.1278009206 0.142560246
#> 23 0.3100289980 0.331382767
#> 24 0.3056782519 0.334150476
#> 25 0.1406519454 0.165914290
#> 26 0.2897859163 0.302470422
#> 27 0.4513647874 0.475278524
#> 28 0.0121493300 0.028801170
#> 29 0.1081870658 0.135100592
#> 30 0.1843548395 0.195524913
#> 31 0.0195131497 0.028706760
#> 32 0.0770015788 0.089252192
#> 33 0.0307200308 0.037245795
#> 34 0.0481798000 0.064730096
#> 35 0.0158511458 0.019165171
#> 36 0.0313375538 0.055543135
#> 37 0.0474711583 0.085000194
#> 38 0.0515186393 0.075129917
#> 39 0.1822526683 0.194385937
#> 40 0.2528697655 0.290699150
#> 41 0.1820757887 0.206331967
#> 42 0.0909250529 0.104716602
#> 43 0.3515781781 0.388930476
#> 44 0.0609293156 0.070684171
#> 45 0.0394863054 0.080687712
#> 46 0.0969844733 0.127203672
#> 47 0.1035633798 0.122529637
#> 48 0.0667320936 0.078623799
#> 49 0.1643910620 0.187999322
#> 50 0.1016735093 0.110177555
#> 51 0.0725146125 0.081013369
#> 52 0.0794946880 0.101194839
#> 53 0.1415594269 0.156462951
#> 54 0.0632843893 0.093488294
#> 55 0.0239102782 0.044347108
#> 56 0.0256797285 0.037207034
#> 57 0.0416597861 0.047196375
#> 58 0.0787334698 0.089710913
#> 59 0.0196590606 0.025546163
#> 60 0.0314658644 0.044426298
#> 61 0.0146094279 0.025527662
#> 62 0.0713841143 0.081492917
#> 63 0.0064481930 0.023259576
#> 64 0.0138291810 0.027566625
#> 65 0.1274385142 0.162001188
#> 66 0.3860720820 0.401296741
#> 67 0.2293979651 0.250658721
#> 68 0.0102359407 0.014716862
#> 69 0.0900343110 0.104770720
#> 70 0.2016383750 0.233177807
#> 71 0.3607978815 0.372833260
#> 72 0.0642758596 0.096421129
#> 74 0.0017301136 0.004762985
#> 75 0.0063464408 0.009617559
#> 76 0.0112842922 0.024291955
#> 77 0.1372504389 0.150918653
#> 78 0.0017208090 0.003462984
#> 79 0.0126187487 0.019941206
#> 80 0.0011731180 0.002271774