Skip to contents

Tau U effect size and variance computation.

Usage

tau_u_computation(
  data,
  studyID,
  subjectID,
  outcome_name,
  phase_name,
  phase_order = NULL,
  na_option = "listwise"
)

Arguments

data

Raw data to compute the effect sizes and variances from

studyID

A character string representing the studyID

subjectID

A character string representing the subjectID

outcome_name

A character string representing the outcome name

phase_name

A character string representing the phase name

phase_order

Optional character vector of length 2 giving the baseline phase first and the comparison phase second. If NULL, factor levels are used when phase_name is a factor; otherwise the two unique phase labels are sorted alphabetically.

na_option

Currently only listwise is supported

Value

Returns a data frame that contains the studyID, subjectID, and the Tau U effect sizes and 3 different variance approximations: v1 is an empirical variance approximation based on the observed pairwise comparisons, v2 is a Mann-Whitney-style theoretical variance approximation that ignores baseline trend variability, and v3 is a phase-contrast variance approximation that adds a baseline-trend component.

Details

Tau-U is computed by contrasting the first phase in phase_order with the second. Supplying phase_order is recommended whenever the intended baseline and intervention labels are known. Each study-subject combination must contain observations from both phases. The revised denominator uses m * n, while the original denominator adds the baseline trend term m * (m - 1) / 2.

Let m be the number of baseline observations, n the number of comparison observations, Q_P the vector of pairwise phase-contrast signs comparing comparison observations to baseline observations, and Q_A the strictly upper-triangular baseline self-comparison signs used for the baseline trend adjustment.

The empirical variance approximation v1 is $$ \widehat{\mathrm{Var}}(\tau_U) = \frac{\widehat{\mathrm{Var}}(Q_P) \, (m n) + \widehat{\mathrm{Var}}(Q_A) \, m (m - 1) / 2}{d^2}, $$ where d = m n for the revised version and d = m n + m (m - 1) / 2 for the original version.

The Mann-Whitney-style theoretical variance approximation v2 is $$ \mathrm{Var}(\tau_U) = \frac{m n (m + n + 1) / 12}{d^2}, $$ using the same denominator d.

The phase-contrast variance approximation v3 adds the baseline-trend component: $$ \mathrm{Var}_{\mathrm{pc}}(\tau_U) = \frac{m n (m + n + 1) / 12 + m (m - 1) (2 m + 5) / 72}{d^2}, $$ again with d = m n for the revised version and d = m n + m (m - 1) / 2 for the original version.

Examples

scd <- data.frame(
  study = "S1",
  subject = "P1",
  phase = rep(c("A", "B"), each = 4),
  outcome = c(2, 3, 3, 4, 5, 6, 6, 7)
)
tau_u_computation(
  scd,
  studyID = "study",
  subjectID = "subject",
  outcome_name = "outcome",
  phase_name = "phase",
  phase_order = c("A", "B")
)
#>        study subject  Tau_U         v1       v2         v3
#> S1||P1    S1      P1 0.6875 0.00390625 0.046875 0.05533854