Skip to contents

MARS provides effect-size constructors for two-phase single-case data. Each constructor returns an effect estimate (yi) and its corresponding sampling variance (vi), ready for a subsequent meta-analysis. The effect size should complement, rather than replace, visual analysis of the original time series.

library(mars)

Common data layout

The rank-based, response-ratio, nonoverlap, and improvement-rate functions use one row per observation, with study, case, phase, and outcome columns. The first label in phase_order is baseline and the second is intervention.

continuous_data <- data.frame(
  study = rep(c("S1", "S2"), each = 8),
  case = rep(c("A", "B"), each = 8),
  phase = rep(c("baseline", "intervention"), each = 4, times = 2),
  outcome = c(2, 3, 2, 3, 5, 6, 6, 7, 4, 4, 5, 4, 6, 7, 8, 8)
)

Tau-U

tau_u_computation() is the rank-based option. It can include baseline-trend adjustment and reports empirical and theoretical variance approximations.

tau <- tau_u_computation(
  continuous_data, studyID = "study", subjectID = "case",
  outcome_name = "outcome", phase_name = "phase",
  phase_order = c("baseline", "intervention"),
  baseline_trend_adjust = TRUE
)
tau[, c("study", "case", "Tau_U", "v3")]
#>       study case  Tau_U         v3
#> S1||A    S1    A 0.8750 0.05533854
#> S2||B    S2    B 0.9375 0.05533854

Between-case standardized mean difference

bc_smd_computation() is for replicated AB data with at least two cases per study. It returns one case-adjusted, Hedges-style standardized effect per study. The current implementation assumes independent residuals and should not be used as a replacement for a design-specific mixed-model estimator in complex multiple-baseline or reversal designs.

bc_data <- 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(bc_data, "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

Log response ratio

For positive counts, rates, proportions, or continuous outcomes, the log response ratio summarizes proportional change. Each phase needs at least two observations for its delta-method variance. A continuity adjustment is available for zero-valued count or rate outcomes when substantively justified.

log_response_ratio_computation(
  continuous_data, "study", "case", "outcome", "phase",
  phase_order = c("baseline", "intervention")
)
#>      study_id case_id effect_id             metric        yi          vi
#> S1.A       S1       A       LRR log_response_ratio 0.8754687 0.017962963
#> S2.B       S2       B       LRR log_response_ratio 0.5340825 0.007820097
#>      n_baseline n_intervention continuity
#> S1.A          4              4          0
#> S2.B          4              4          0

Nonoverlap of all pairs

NAP is the proportion of baseline-intervention pairs for which intervention is better, counting ties as one-half. Its variance is a tie-corrected U-statistic approximation. The optional autocorrelation correction is a sensitivity adjustment, not an estimate of the full time-series covariance.

nap_computation(
  continuous_data, "study", "case", "outcome", "phase",
  phase_order = c("baseline", "intervention"),
  variance_correction = "autocorrelation"
)
#>      study_id case_id effect_id metric yi        vi n_baseline n_intervention
#> S1.A       S1       A       NAP    NAP  1 0.2583427          4              4
#> S2.B       S2       B       NAP    NAP  1 0.2306809          4              4
#>      autocorrelation variance_correction variance_multiplier
#> S1.A       0.8683531     autocorrelation            5.715433
#> S2.B       0.8324237     autocorrelation            5.232661

Improvement rate difference

IRD is appropriate only for binary outcomes coded zero or one. With improvement = "increase", one denotes improvement; use "decrease" when zero denotes improvement.

binary_data <- data.frame(
  study = "S1", case = "A", phase = rep(c("baseline", "intervention"), each = 4),
  outcome = c(0, 0, 1, 0, 1, 1, 1, 1)
)
ird_computation(binary_data, "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

Level and slope change

level_slope_computation() fits a segmented AB model and returns two dependent effects: immediate level change and slope change. It requires ordered time and a single baseline-to-intervention transition. The AR(1) option is feasible GLS; its standard errors treat the estimated autocorrelation as fixed.

time_data <- data.frame(
  study = "S1", case = "A", time = 1:8,
  phase = rep(c("baseline", "intervention"), each = 4),
  outcome = c(1, 2, 2, 3, 5, 6, 7, 8)
)
level_slope_computation(
  time_data, "study", "case", "outcome", "phase", "time",
  correlation = "ar1"
)
#>                   study_id case_id    effect_id       metric        yi
#> S1.A.level_change       S1       A level_change level_change 1.6970161
#> S1.A.slope_change       S1       A slope_change slope_change 0.4387535
#>                            vi cov_level_slope residual_df autocorrelation
#> S1.A.level_change 0.017412868     0.001199332           4       -0.772393
#> S1.A.slope_change 0.002398663     0.001199332           4       -0.772393
#>                   correlation
#> S1.A.level_change         ar1
#> S1.A.slope_change         ar1

Choosing and synthesizing an effect size

Use BC-SMD when a standardized effect across replicated continuous-outcome cases is the scientific target. Use the log response ratio for proportional change in positive behavioral outcomes. Use NAP or Tau-U for rank/nonoverlap descriptions, with caution about serial dependence. Use IRD for binary improvement. Use level and slope changes when the intervention question is about the trajectory rather than average phase separation.

For meta-analysis, retain the returned study/case identifiers, yi, vi, and diagnostic columns. Do not combine level and slope effects as independent rows: level_slope_computation() returns cov_level_slope so their dependence can be represented in a multivariate synthesis.