apa_subgroups: Subgroup analysis table for a meta-analysis

View source: R/meta_subgroups.R

apa_subgroupsR Documentation

Subgroup analysis table for a meta-analysis

Description

Makes an APA-style table of a subgroup analysis of a meta-analysis fit with metafor::rma(): the pooled estimate of each subgroup, followed by the overall pooled estimate, with the test of subgroup differences in the note.

Usage

apa_subgroups(fit, subgroup, tau2 = c("separate", "common"), transform = TRUE)

Arguments

fit

a meta-analysis without moderators fit with metafor::rma()

subgroup

the subgroup variable: the name of a column in the data of fit (quoted or unquoted), or a vector with one value for each effect size. Effect sizes whose subgroup is missing are left out of the subgroups (but not of the overall estimate).

tau2

"separate" (default) for a \tau^2 for each subgroup, or "common" for one \tau^2 shared by all subgroups

transform

if TRUE (default), estimates computed on a transformed scale are shown on their original scale, as in apa_parameters()

Details

With tau2 = "separate" (default), each subgroup is pooled with its own random-effects model (with the estimator of \tau^2 of fit), and the subgroup estimates are compared with Q_{\text{between}}, the heterogeneity statistic of an equal-effects meta-analysis of the subgroup estimates. With tau2 = "common", the subgroups share one \tau^2: the estimates come from a mixed-effects meta-regression with the subgroup as a categorical moderator, and the subgroups are compared with the omnibus test of the moderator (Q_{\text{M}}). The separate approach suits subgroups that may differ in heterogeneity; the common approach gives more stable estimates of \tau^2 when subgroups have few studies (Borenstein et al., 2009, chap. 19).

Estimates are shown on the same scale as in apa_parameters() (e.g., risk ratios are exponentiated, and Fisher's z values are converted back to correlations).

Value

apa7_tbl (tibble)

References

Borenstein, M., Hedges, L. V., Higgins, J. P. T., & Rothstein, H. R. (2009). Introduction to meta-analysis. Wiley. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1002/9780470743386")}

Examples


if (requireNamespace("metafor", quietly = TRUE) &&
    requireNamespace("metadat", quietly = TRUE)) {
  d_bcg <- metafor::escalc(
    measure = "RR",
    ai = tpos, bi = tneg, ci = cpos, di = cneg,
    data = metadat::dat.bcg
  )
  fit_meta <- metafor::rma(yi, vi, data = d_bcg)
  apa_subgroups(fit_meta, alloc)
}


apa7 documentation built on Dec. 1, 2026, 5:06 p.m.