Skip to contents

Computes traditional standardized mean differences (SMDs) and harmonized standardized mean differences (HSMDs) by replacing observed group standard deviations with common coefficient-of-variation benchmarks. Pooled summaries are estimated with mars(), allowing the harmonized effect sizes to be analyzed with univariate, multivariate, or multilevel model structures.

Usage

hsmd(
  data,
  mT,
  sdT,
  nT,
  mC,
  sdC,
  nC,
  study = NULL,
  probs = c(0.25, 0.5, 0.75),
  measure = c("d", "g"),
  structure = "univariate",
  formula = NULL,
  effectID = NULL,
  sample_size = NULL,
  varcov_type = NULL,
  variance = NULL,
  cv_by = NULL,
  cv_benchmarks = NULL,
  estimation_method = "REML",
  ...
)

# S3 method for class 'hsmd'
print(x, digits = max(3, getOption("digits") - 3), ...)

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.

mC, sdC, nC

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

study

Optional unquoted column name identifying studies. If omitted, a sequential study identifier is created.

probs

Numeric vector of coefficient-of-variation quantiles to use for harmonization. Defaults to c(0.25, 0.50, 0.75).

measure

Effect-size estimate used in the fitted mars() models, either "d" for Cohen's d or "g" for Hedges' g. Both estimates are returned.

structure

Model structure passed to mars(). Use "univariate", "multivariate"/"UN"/"DIAG1"/"DIAG2", or "multilevel".

formula

Optional model formula for univariate or multilevel models. The left-hand side is replaced internally with each SMD/HSMD effect-size column, so callers may supply either a one-sided formula (for example ~ 1 + (1 | district/study)) or a two-sided formula.

effectID

Optional column identifying dependent effect sizes for multivariate models.

sample_size

Optional sample-size column passed to mars() for multivariate SMD workflows.

varcov_type

Within-study variance-covariance type passed to mars(). Defaults to "univariate", "outcome", or "multilevel" depending on structure.

variance

Optional variance column used when the selected varcov_type requires an explicit variance argument.

cv_by

Optional unquoted column used to compute coefficient-of-variation benchmarks within subgroups, such as outcomes or domains.

cv_benchmarks

Optional named list with elements treatment and control, each a numeric vector of benchmark CVs aligned with probs.

estimation_method

Estimation method passed to mars(), either "REML" or "MLE".

...

Additional arguments passed to downstream print methods.

x

An object of class "hsmd".

digits

Number of digits used when printing numeric results.

Value

A list with class "hsmd" containing:

summary

Data frame of pooled SMD and HSMD model summaries.

effect_sizes

Data frame of study-level effect sizes and variances.

data

Original input data with added coefficient-of-variation and harmonized SD columns.

models

Named list of fitted mars model objects.

quantiles

Named numeric vector of the requested harmonization quantiles.

Examples

ex1 <- hsmd(
  data = hsmd_example_1,
  mT = mT, sdT = sdT, nT = nT,
  mC = mC, sdC = sdC, nC = nC,
  study = Study
)
ex1$summary
#>    method   component        est         se      ci.lb       ci.ub       tau2
#> 1     SMD (Intercept) -0.3060830 0.10640132 -0.5146258 -0.09754029 0.11743966
#> 2 HSMD_25 (Intercept) -0.4778418 0.22512747 -0.9190835 -0.03660002 0.72841275
#> 3 HSMD_50 (Intercept) -0.1789429 0.10868797 -0.3919674  0.03408160 0.12560800
#> 4 HSMD_75 (Intercept) -0.1105698 0.08000593 -0.2673785  0.04623900 0.04819645
#>         avwW       I2
#> 1 0.04191511 60.01581
#> 2 0.04546883 89.56395
#> 3 0.04186181 61.64808
#> 4 0.04132897 38.45138

ex2 <- hsmd(
  data = hsmd_example_2,
  mT = mT, sdT = sdT, nT = nT,
  mC = mC, sdC = sdC, nC = nC,
  study = Study
)
head(ex2$effect_sizes)
#>            d         vd          g         vg        d25       vd25        g25
#> 1 0.01961060 0.05128452 0.01941643 0.05027401 0.05640465 0.05130245 0.05584619
#> 2 0.25148710 0.01472472 0.25089351 0.01465529 0.22236365 0.01470316 0.22183880
#> 3 0.58686206 0.03247340 0.58346979 0.03209907 0.44725231 0.03192654 0.44466704
#> 4 0.75744489 0.13001630 0.73897062 0.12375138 0.98211539 0.13593793 0.95816136
#> 5 0.63954509 0.07257364 0.63094134 0.07063412 1.11658753 0.07979562 1.10156617
#> 6 0.07976613 0.03004166 0.07931205 0.02970061 0.11808903 0.03006995 0.11741680
#>         vg25        d50       vd50        g50       vg50        d75       vd75
#> 1 0.05029158 0.03853757 0.05129157 0.03815601 0.05028092 0.02160971 0.05128504
#> 2 0.01463383 0.15556823 0.01466371 0.15520103 0.01459457 0.09376783 0.01463964
#> 3 0.03155851 0.31282141 0.03153950 0.31101319 0.03117594 0.18838641 0.03130326
#> 4 0.12938768 0.69670406 0.12867802 0.67971128 0.12247759 0.44131633 0.12427444
#> 5 0.07766309 0.79372367 0.07447863 0.78304578 0.07248820 0.50675967 0.07126146
#> 6 0.02972858 0.08116724 0.03004250 0.08070519 0.02970144 0.04629415 0.03002592
#>          g75       vg75
#> 1 0.02139575 0.05027453
#> 2 0.09354650 0.01457061
#> 3 0.18729747 0.03094242
#> 4 0.43055252 0.11828620
#> 5 0.49994227 0.06935701
#> 6 0.04603062 0.02968504