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 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.

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

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

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

  • summary: A data.frame summarizing the edges, their weights, p-values, statistical significance 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 calculates p-values for each edge and identifies significant edges based on the specified significance level. A matrix of significant edges (those with 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)
#> Significant Edges
#> 
#>          from         to     weight p_value   ci_lower   ci_upper
#> 5       adapt    discuss 0.07137434       0 0.06381490 0.07754115
#> 9       adapt  synthesis 0.23466258       0 0.19973867 0.26544257
#> 10   cohesion      adapt 0.27308448       0 0.24388493 0.30278102
#> 12   cohesion  consensus 0.01485227       0 0.01210109 0.01702859
#> 14   cohesion    discuss 0.04758289       0 0.04074739 0.05170938
#> 15   cohesion    emotion 0.32534367       0 0.31979192 0.34763887
#> 17   cohesion       plan 0.02517460       0 0.02141306 0.02762196
#> 19  consensus      adapt 0.47740668       0 0.43627297 0.51101768
#> 20  consensus   cohesion 0.49793510       0 0.48158551 0.51156137
#> 21  consensus  consensus 0.08200348       0 0.07958578 0.08531510
#> 22  consensus coregulate 0.13451777       0 0.12780092 0.14256025
#> 23  consensus    discuss 0.32118451       0 0.31002900 0.33138277
#> 24  consensus    emotion 0.32040888       0 0.30567825 0.33415048
#> 25  consensus    monitor 0.15910677       0 0.14065195 0.16591429
#> 26  consensus       plan 0.29040117       0 0.28978592 0.30247042
#> 27  consensus  synthesis 0.46625767       0 0.45136479 0.47527852
#> 29 coregulate   cohesion 0.11917404       0 0.10818707 0.13510059
#> 30 coregulate  consensus 0.18770738       0 0.18435484 0.19552491
#> 31 coregulate coregulate 0.02335025       0 0.01951315 0.02870676
#> 32 coregulate    discuss 0.08428246       0 0.07700158 0.08925219
#> 33 coregulate    emotion 0.03419105       0 0.03072003 0.03724580
#> 34 coregulate    monitor 0.05792045       0 0.04817980 0.06473010
#> 35 coregulate       plan 0.01721618       0 0.01585115 0.01916517
#> 39    discuss  consensus 0.18802338       0 0.18225267 0.19438594
#> 40    discuss coregulate 0.27360406       0 0.25286977 0.29069915
#> 41    discuss    discuss 0.19488737       0 0.18207579 0.20633197
#> 42    discuss    emotion 0.10186817       0 0.09092505 0.10471660
#> 43    discuss    monitor 0.37543615       0 0.35157818 0.38893048
#> 44    discuss       plan 0.06789021       0 0.06092932 0.07068417
#> 46    emotion      adapt 0.11984283       0 0.09698447 0.12720367
#> 47    emotion   cohesion 0.11563422       0 0.10356338 0.12252964
#> 48    emotion  consensus 0.07268131       0 0.06673209 0.07862380
#> 49    emotion coregulate 0.17208122       0 0.16439106 0.18799932
#> 50    emotion    discuss 0.10579600       0 0.10167351 0.11017755
#> 51    emotion    emotion 0.07684173       0 0.07251461 0.08101337
#> 52    emotion    monitor 0.09071877       0 0.07949469 0.10119484
#> 53    emotion       plan 0.14682475       0 0.14155943 0.15646295
#> 56    monitor   cohesion 0.03303835       0 0.02567973 0.03720703
#> 57    monitor  consensus 0.04661084       0 0.04165979 0.04719638
#> 58    monitor coregulate 0.08629442       0 0.07873347 0.08971091
#> 59    monitor    discuss 0.02227284       0 0.01965906 0.02554616
#> 60    monitor    emotion 0.03630596       0 0.03146586 0.04442630
#> 62    monitor       plan 0.07552379       0 0.07138411 0.08149292
#> 65       plan   cohesion 0.14100295       0 0.12743851 0.16200119
#> 66       plan  consensus 0.39579712       0 0.38607208 0.40129674
#> 67       plan coregulate 0.23908629       0 0.22939797 0.25065872
#> 69       plan    emotion 0.09975326       0 0.09003431 0.10477072
#> 70       plan    monitor 0.21563154       0 0.20163838 0.23317781
#> 71       plan       plan 0.37420822       0 0.36079788 0.37283326
#> 77  synthesis    discuss 0.14097697       0 0.13725044 0.15091865
#> 
#> Non-significant Edges
#> 
#>          from         to       weight p_value     ci_lower    ci_upper
#> 2       adapt   cohesion 0.0029498525     0.7 0.0007146923 0.005853452
#> 3       adapt  consensus 0.0047400853     0.1 0.0031162999 0.005670046
#> 4       adapt coregulate 0.0162436548     0.2 0.0132977590 0.023854536
#> 6       adapt    emotion 0.0024673951     0.5 0.0013932185 0.003958716
#> 7       adapt    monitor 0.0111653873     0.1 0.0084833480 0.016781683
#> 8       adapt       plan 0.0009745006     0.5 0.0006938210 0.001610183
#> 11   cohesion   cohesion 0.0271386431     0.1 0.0204571493 0.034753199
#> 13   cohesion coregulate 0.0360406091     0.1 0.0336605579 0.047170932
#> 16   cohesion    monitor 0.0558269365     0.1 0.0546041045 0.068622062
#> 18   cohesion  synthesis 0.0337423313     0.1 0.0243012422 0.041056741
#> 28 coregulate      adapt 0.0216110020     0.5 0.0121493300 0.028801170
#> 36 coregulate  synthesis 0.0444785276     0.3 0.0313375538 0.055543135
#> 37    discuss      adapt 0.0589390963     0.2 0.0474711583 0.085000194
#> 38    discuss   cohesion 0.0595870206     0.1 0.0515186393 0.075129917
#> 45    discuss  synthesis 0.0628834356     0.2 0.0394863054 0.080687712
#> 54    emotion  synthesis 0.0705521472     0.1 0.0632843893 0.093488294
#> 55    monitor      adapt 0.0333988212     0.2 0.0239102782 0.044347108
#> 61    monitor    monitor 0.0181437544     0.1 0.0146094279 0.025527662
#> 63    monitor  synthesis 0.0122699387     0.6 0.0064481930 0.023259576
#> 64       plan      adapt 0.0157170923     0.5 0.0138291810 0.027566625
#> 68       plan    discuss 0.0116426221     0.1 0.0102359407 0.014716862
#> 72       plan  synthesis 0.0751533742     0.1 0.0642758596 0.096421129
#> 74  synthesis   cohesion 0.0035398230     0.5 0.0017301136 0.004762985
#> 75  synthesis  consensus 0.0075841365     0.1 0.0063464408 0.009617559
#> 76  synthesis coregulate 0.0187817259     0.3 0.0112842922 0.024291955
#> 78  synthesis    emotion 0.0028198802     0.5 0.0017208090 0.003462984
#> 79  synthesis    monitor 0.0160502442     0.1 0.0126187487 0.019941206
#> 80  synthesis       plan 0.0017865844     0.3 0.0011731180 0.002271774

model <- group_tna(engagement_mmm)
# Small number of iterations for CRAN
bootstrap(model, iter = 10)
#> Cluster 1:
#> 
#> Significant Edges
#> 
#>      from      to    weight p_value  ci_lower  ci_upper
#> 1  Active  Active 0.7061503       0 0.6728992 0.7482574
#> 4 Average  Active 0.2938497       0 0.2517426 0.3271008
#> 5 Average Average 0.4598214       0 0.3543395 0.5130755
#> 
#> Non-significant Edges
#> 
#>         from         to     weight p_value   ci_lower   ci_upper
#> 2     Active    Average 0.51339286     0.1 0.46339108 0.63430012
#> 3     Active Disengaged 0.33333333     0.6 0.19031250 0.52279412
#> 6    Average Disengaged 0.38095238     0.3 0.24502262 0.49464286
#> 8 Disengaged    Average 0.02678571     0.5 0.00553225 0.04441871
#> 9 Disengaged Disengaged 0.28571429     0.5 0.15893665 0.38941176
#> 
#> Cluster 2:
#> 
#> Significant Edges
#> 
#>      from         to    weight p_value  ci_lower  ci_upper
#> 1  Active     Active 0.4924242       0 0.4502979 0.5440377
#> 2  Active    Average 0.3249516       0 0.2927007 0.3650853
#> 3  Active Disengaged 0.3333333       0 0.2665896 0.3814380
#> 4 Average     Active 0.4419192       0 0.3948602 0.4781949
#> 5 Average    Average 0.5860735       0 0.5502598 0.6235970
#> 6 Average Disengaged 0.5733333       0 0.5500463 0.6826315
#> 
#> Non-significant Edges
#> 
#>         from         to     weight p_value   ci_lower   ci_upper
#> 7 Disengaged     Active 0.06565657     0.1 0.05208170 0.08072051
#> 8 Disengaged    Average 0.08897485     0.1 0.06874414 0.11147549
#> 9 Disengaged Disengaged 0.09333333     0.8 0.05077897 0.13723442
#> 
#> Cluster 3:
#> 
#> Significant Edges
#> 
#>         from         to    weight p_value  ci_lower  ci_upper
#> 1     Active     Active 0.3006757       0 0.2473390 0.3270739
#> 2     Active    Average 0.1594077       0 0.1367731 0.1676231
#> 4    Average     Active 0.6081081       0 0.5690367 0.6285203
#> 5    Average    Average 0.5731707       0 0.5570259 0.5986153
#> 6    Average Disengaged 0.4707602       0 0.4465663 0.5000202
#> 8 Disengaged    Average 0.2674216       0 0.2498145 0.2859661
#> 9 Disengaged Disengaged 0.4634503       0 0.4327551 0.4824233
#> 
#> Non-significant Edges
#> 
#>         from         to     weight p_value   ci_lower   ci_upper
#> 3     Active Disengaged 0.06578947     0.1 0.05189673 0.08148381
#> 7 Disengaged     Active 0.09121622     0.3 0.08740210 0.13389860