Skip to contents

Compute HSMD effect-size columns

Usage

hsmd_effect_sizes(
  data,
  mT,
  sdT,
  nT,
  mC,
  sdC,
  nC,
  probs = c(0.25, 0.5, 0.75),
  cv_by = NULL,
  cv_benchmarks = NULL
)

Arguments

data

A data frame containing treatment and control summary statistics.

mT, sdT, nT

Unquoted column names for treatment-group mean, standard deviation, and sample size. Observed values must be finite numeric values; sample sizes must be integers greater than 1 and SDs non-negative. Missing SDs are permitted when benchmarks can be estimated or supplied.

mC, sdC, nC

Unquoted column names for control-group mean, standard deviation, and sample size.

probs

Numeric vector of coefficient-of-variation quantiles to use for harmonization. Defaults to c(0.25, 0.50, 0.75). Values must be distinct and strictly between zero and one. Decimal percentage labels use p, so 0.251 generates columns such as d25p1.

cv_by

Optional unquoted column used to compute coefficient-of-variation benchmarks within subgroups, such as outcomes or domains. Group IDs cannot be missing. One or several quantiles may be requested.

cv_benchmarks

Optional named list with elements treatment and control, each a positive finite numeric vector aligned with probs. With cv_by, provide matrices/data frames whose row names identify groups and whose columns follow probs in the supplied order.

Value

A list with prepared data, effect_sizes, probs, prob_names, and coefficient-of-variation benchmarks.

Examples

hsmd_cols <- hsmd_effect_sizes(
  hsmd_example_1,
  mT = mT,
  sdT = sdT,
  nT = nT,
  mC = mC,
  sdC = sdC,
  nC = nC
)
names(hsmd_cols$effect_sizes)
#>  [1] "d"    "vd"   "g"    "vg"   "d25"  "vd25" "g25"  "vg25" "d50"  "vd50"
#> [11] "g50"  "vg50" "d75"  "vd75" "g75"  "vg75"