Skip to contents

The difference and the ratio between the networks a transition_regression() predicts at two values of one covariate, for every transition, with percentile intervals from a cluster bootstrap. The difference is the absolute effect on the transition probability, the ratio the relative one: unlike the odds ratio of a coefficient, which compares a next state with a reference next state, it belongs to the transition itself. Each resample draws the model's actor units with replacement, refits the model and recomputes the difference.

Usage

transition_effects(
  x,
  term = NULL,
  values = NULL,
  iter = 200,
  level = 0.95,
  min_probability = 0.05,
  adjust = c("interval", "storey", "none"),
  sort = TRUE,
  cores = 1L
)

# S3 method for class 'net_transition_effects'
print(x, digits = 2L, ...)

# S3 method for class 'net_transition_effects'
summary(object, alpha = 0.05, ...)

# S3 method for class 'summary.net_transition_effects'
print(x, digits = 2L, ...)

# S3 method for class 'net_transition_effects'
plot(
  x,
  type = c("network", "bars"),
  width = c("change", "probability"),
  minimum = 0.05,
  show_top = Inf,
  label_top = 8,
  top_n = 20,
  title = NULL,
  ...
)

Arguments

x

A net_transition_regression. For the print() and plot() methods: a table from transition_effects(), or its summary() for print().

term

Character. The covariate whose effect is reported; the other covariates keep their observed values.

values

NULL (default) or two values: the reference, then the comparison. Numbers for a numeric covariate, levels for a factor. By default a numeric covariate is compared at its 75th against its 25th percentile over the transitions the model is fitted on (the interquartile contrast; labelled p75 and p25), and a two-level factor at its second against its first level; a factor with more levels needs values. The model is fitted once, so any two values can be read without refitting. Names given to the values label the table and the plots.

iter

Integer of at least two. Number of bootstrap resamples. Default 200.

level

Numeric. Coverage of the percentile interval. Default 0.95.

min_probability

Numeric. Only transitions whose pooled probability (the TNA weight, covariates ignored) is at least this value are tested. The filter does not look at the contrast (independent filtering, Bourgon, Gentleman & Huber 2010). Default 0.05.

adjust

What the table reports beside the interval: "interval" (default) the interval only; "none" adds p, the two-sided bootstrap p-value; "storey" adds p and p_adjusted, Storey's adaptive false discovery rate over the tested transitions, whose values are never larger than Benjamini-Hochberg's. When the upper tail is empty, the adjustment uses Benjamini-Hochberg.

sort

Logical. TRUE (default) sorts by the size of the difference; FALSE by transition.

cores

Integer. Cores for the bootstrap. Default 1. With more than one, each core draws from its own L'Ecuyer-CMRG stream, seeded from the session's random state, so set.seed() before the call reproduces the result for the same cores; the session's generator is restored afterwards. Parallel draws use forked processes, which Windows does not have.

digits

For the print() method: decimals shown. Default 2.

...

For the plot() method with type = "network": passed to cograph::splot(). Otherwise ignored.

object

For the summary() method: an object of class net_transition_effects.

alpha

For the summary() method: the level at which adjusted p-values are counted. Default 0.05.

type

For the plot() method: "network" (default) draws the change network with cograph::splot(), "bars" the differences with their intervals as a ggplot.

width

For type = "network": "change" (default) draws only the transitions whose interval excludes zero, with width by the size of the change; "probability" draws every transition, width by probability, the ones whose interval includes zero grey and dotted.

minimum

For type = "network": transitions below this probability at both values are not drawn. Default 0.05.

show_top, label_top

For type = "network": the number of largest changes drawn (default all) and labelled (default 8).

top_n

For type = "bars": the number of largest differences drawn. Default 20.

title

For type = "network": the title; by default the covariate and its two values.

Value

An object of class net_transition_effects, a data frame with one row per tested transition: from, to, term, reference, comparison, pooled (the TNA weight), prob_reference, prob_comparison (predicted probabilities), difference (comparison minus reference), lower, upper (percentile interval), excludes_zero, ratio (comparison divided by reference: how many times as likely the transition is at the comparison value), ratio_lower, ratio_upper (its percentile interval from the same resamples; a resample whose reference probability is 0 has no ratio), p and p_adjusted (with adjust "none" or "storey") and resamples (draws in which the contrast could be computed). print() names the covariate and its two values once, above the table, gives the number of transitions tested and how many intervals exclude zero (also for head() of the table), and rounds to digits decimals (default 2), each effect beside its interval, p-values to two significant digits. summary() returns the rows whose interval of the difference excludes zero, with the same columns, as a data frame of class summary.net_transition_effects; its print gives the number of transitions tested, how many intervals exclude zero, rise and fall, and, with adjusted p-values, how many are below alpha. plot() returns invisibly the drawn edges (network: from, to, prob_reference, prob_comparison, difference, direction) or a ggplot (bars).

Details

In the change network, blue solid edges rise from the reference to the comparison value and red dashed edges fall; each label gives the two probabilities with an arrow that follows the edge. The transitions of one row are dependent, since their probabilities sum to one, so p_adjusted is a network-wide benchmark rather than an exact error rate.

References

Bourgon, R., Gentleman, R., & Huber, W. (2010). Independent filtering increases detection power for high-throughput experiments. PNAS, 107(21), 9546-9551. doi:10.1073/pnas.0914005107

Storey, J. D. (2002). A direct approach to false discovery rates. Journal of the Royal Statistical Society B, 64(3), 479-498. doi:10.1111/1467-9868.00346

Examples

net <- build_ftna(group_regulation_long, action = "Action", actor = "Actor",
                  time = "Time")
fit <- transition_regression(net, covariates = c("Achiever", "progress"),
                             actor = "Group")
set.seed(1)
eff <- transition_effects(fit, term = "Achiever", values = c("Low", "High"),
                          iter = 20)
summary(eff)
#> Transition effects of Achiever: High against Low
#>   46 transitions tested; 26 intervals exclude zero (10 rise, 16 fall)
#>   [95% interval]
#> 
#>        from         to  Low High           difference              ratio
#>     discuss  consensus 0.21 0.42    0.21 [0.20, 0.24]  1.98 [1.92, 2.19]
#>   synthesis  consensus 0.38 0.58    0.19 [0.13, 0.28]  1.50 [1.31, 1.81]
#>   synthesis      adapt 0.30 0.14 -0.16 [-0.24, -0.11]  0.47 [0.31, 0.60]
#>   synthesis       plan 0.02 0.14    0.12 [0.07, 0.16] 5.91 [2.98, 13.28]
#>     discuss      adapt 0.12 0.02 -0.10 [-0.11, -0.09]  0.20 [0.16, 0.22]
#>   consensus    discuss 0.14 0.23    0.10 [0.08, 0.12]  1.70 [1.54, 1.91]
#>        plan       plan 0.42 0.33 -0.09 [-0.11, -0.07]  0.79 [0.74, 0.83]
#>    cohesion  consensus 0.45 0.54    0.09 [0.03, 0.13]  1.19 [1.07, 1.31]
#>    cohesion coregulate 0.17 0.08 -0.09 [-0.11, -0.06]  0.49 [0.40, 0.59]
#>  coregulate    discuss 0.31 0.23 -0.07 [-0.09, -0.03]  0.77 [0.71, 0.91]
#>     discuss  synthesis 0.18 0.11 -0.07 [-0.09, -0.05]  0.60 [0.53, 0.71]
#>   consensus       plan 0.43 0.36 -0.07 [-0.09, -0.05]  0.84 [0.80, 0.89]
#>        plan    emotion 0.12 0.18    0.07 [0.05, 0.09]  1.58 [1.41, 1.80]
#>   synthesis    discuss 0.09 0.03 -0.06 [-0.09, -0.02]  0.33 [0.20, 0.67]
#>  coregulate    emotion 0.15 0.20    0.06 [0.02, 0.09]  1.39 [1.14, 1.73]
#>     discuss    discuss 0.22 0.17 -0.05 [-0.08, -0.03]  0.76 [0.66, 0.85]
#>  coregulate       plan 0.22 0.27    0.05 [0.02, 0.10]  1.23 [1.11, 1.52]
#>  coregulate  consensus 0.16 0.11 -0.05 [-0.08, -0.02]  0.69 [0.54, 0.85]
#>     emotion    discuss 0.08 0.12    0.04 [0.03, 0.06]  1.57 [1.29, 1.86]
#>    cohesion    discuss 0.08 0.04 -0.04 [-0.06, -0.03]  0.49 [0.38, 0.61]
#>   consensus coregulate 0.21 0.17 -0.04 [-0.06, -0.02]  0.83 [0.74, 0.88]
#>     emotion    emotion 0.09 0.06 -0.03 [-0.05, -0.01]  0.67 [0.52, 0.85]
#>     discuss coregulate 0.10 0.07 -0.02 [-0.04, -0.01]  0.75 [0.63, 0.88]
#>     emotion       plan 0.11 0.09 -0.02 [-0.03, -0.00]  0.81 [0.70, 0.99]
#>   consensus    emotion 0.06 0.08    0.02 [0.01, 0.03]  1.30 [1.18, 1.61]
#>        plan    discuss 0.07 0.06 -0.01 [-0.02, -0.00]  0.81 [0.72, 0.93]
#> 
head(eff)
#> Transition effects of Achiever: High against Low
#>   46 transitions tested, 26 with an interval that excludes zero; 6 shown
#>   [95% interval]; * the interval of the difference excludes zero
#> 
#>       from        to  Low High             difference              ratio
#>    discuss consensus 0.21 0.42    0.21 [0.20, 0.24] *  1.98 [1.92, 2.19]
#>  synthesis consensus 0.38 0.58    0.19 [0.13, 0.28] *  1.50 [1.31, 1.81]
#>  synthesis     adapt 0.30 0.14 -0.16 [-0.24, -0.11] *  0.47 [0.31, 0.60]
#>  synthesis      plan 0.02 0.14    0.12 [0.07, 0.16] * 5.91 [2.98, 13.28]
#>    discuss     adapt 0.12 0.02 -0.10 [-0.11, -0.09] *  0.20 [0.16, 0.22]
#>  consensus   discuss 0.14 0.23    0.10 [0.08, 0.12] *  1.70 [1.54, 1.91]
#>