Skip to contents

Computes the intervention minus baseline improvement rate and its binomial risk-difference variance.

Usage

ird_computation(
  data,
  studyID,
  subjectID,
  outcome_name,
  phase_name,
  phase_order = NULL,
  improvement = c("increase", "decrease"),
  na_option = "listwise"
)

Arguments

data

Data frame containing repeated observations.

studyID, subjectID, outcome_name, phase_name

Character strings naming the study, case, outcome, and phase columns.

phase_order

Character vector giving the baseline and intervention labels, in that order. If NULL, factor-level or alphabetical order is used.

improvement

Whether an increase or decrease in the outcome is beneficial.

na_option

Currently only "listwise" is supported.

Value

A data frame with the improvement rate difference in yi and the independence-based binomial variance in vi.

Details

Outcomes must be coded 0/1. With improvement = "increase", one is treated as improvement; with improvement = "decrease", zero is treated as improvement. The variance assumes independent binary observations.

Examples

dat <- data.frame(study = "S1", case = "A", phase = rep(c("A", "B"), each = 4),
                  outcome = c(0, 0, 1, 0, 1, 1, 1, 1))
ird_computation(dat, "study", "case", "outcome", "phase")
#>      study_id case_id effect_id                      metric   yi       vi
#> S1.A       S1       A       IRD improvement_rate_difference 0.75 0.046875
#>      n_baseline n_intervention
#> S1.A          4              4