
Between-case standardized mean difference for replicated AB designs
bc_smd_computation.RdCalculates a case-adjusted standardized mean difference for replicated AB single-case data and an approximate sampling variance. The estimator is a small-sample corrected intervention coefficient from a linear model with case fixed effects, divided by its residual standard deviation.
Usage
bc_smd_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 one row per study. yi is the Hedges-style
small-sample corrected case-adjusted standardized mean difference and vi
is its delta-method sampling-variance approximation.
Details
This initial implementation supports replicated AB data only: every study must contain at least two cases and every case must contribute baseline and intervention observations. It assumes independent residuals conditional on case and phase. It is not a replacement for a design-specific mixed-model BC-SMD for complex multiple-baseline, reversal, or serially correlated data.
Examples
dat <- data.frame(
study = rep("S1", 12), case = rep(c("A", "B"), each = 6),
phase = rep(rep(c("baseline", "intervention"), each = 3), 2),
outcome = c(1, 2, 2, 4, 5, 5, 2, 2, 3, 5, 5, 6)
)
bc_smd_computation(dat, "study", "case", "outcome", "phase")
#> study_id case_id effect_id metric yi vi n_baseline n_intervention
#> S1 S1 <NA> BC_SMD BC-SMD 5.03895 1.689252 6 6
#> residual_df
#> S1 9