Bayesian Meta-Analytic Mixture Modelling

Fits Bayesian random-effects meta-analytic mixture models in which the true study effects are drawn from a mixture of normal components with component-specific means and between-study heterogeneity. The mixture model can be combined with step-function selection models (Vevea and Hedges, 1995, ) to adjust for publication bias, either with one selection model for all studies or with separate selection models for groups of studies. Models are estimated by Hamiltonian Monte Carlo using 'rstan' and returned as 'stanfit' objects, so posterior summaries, posterior predictive checks and marginal likelihoods for model comparison (via 'bridgesampling') are readily available. Also includes a data simulator and the nudging meta-analysis data of Mertens et al. (2022) .


metamixr

R-CMD-check

metamixr fits Bayesian meta-analytic mixture models: the true effects of the primary studies are assumed to come from a mixture of M normal components, each with its own mean and between-study heterogeneity. The mixture can be combined with a step-function selection model to adjust for publication bias. Models are estimated with Stan and returned as stanfit objects, so models can be inspected via rstan and marginal likelihoods for model comparison can be calculated using bridgesampling. See Maier (2026) for more information.

Installation

The package contains Stan models that are compiled when the package is installed, which takes several minutes and requires a C++ toolchain (Rtools on Windows, Xcode command line tools on macOS).

# install.packages("remotes")
remotes::install_github("MaxMaier42/metamix")

Example

library(metamixr)

# 100 studies from two components (null and medium effect) with one-sided
# publication bias: non-significant studies are published with probability .2,
# marginally significant ones with probability .5
set.seed(1)
dat <- sim_mix(K = 100, M = 2, mu = c(0, 0.5), tau = c(0.1, 0.1),
               steps = c(0.95, 0.975), weights = c(0.2, 0.5, 1), one_sided = TRUE)

# two-component mixture with a selection model
fit <- sel_mix(dat$y, dat$sds, M = 2, steps = c(0.95, 0.975), chains = 4, cores = 4)
print(fit, pars = c("mu", "tau", "theta", "omega"))
  • re_mix(): random-effects mixture model without publication bias adjustment.
  • sel_mix(): random-effects mixture model with a step-function selection model.
  • sim_mix(): simulate data from the mixtures.

Reference

Maier, M. (2026). Addressing heterogeneity with Bayesian meta-analytic mixture modelling. PsyArXiv. https://doi.org/10.31234/osf.io/nkyqm_v2

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("metamixr")

0.1.0 by Maximilian Maier, 8 hours ago


https://github.com/MaxMaier42/metamix, https://maxmaier42.github.io/metamix/


Report a bug at https://github.com/MaxMaier42/metamix/issues


Browse source code at https://github.com/cran/metamixr


Authors: Maximilian Maier [aut, cre] (ORCID: , Trustees of Columbia University [cph]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports methods, Rcpp, RcppParallel, rstan, rstantools, stats

Suggests testthat, bridgesampling, knitr, rmarkdown

Linking to BH, Rcpp, RcppEigen, RcppParallel, rstan, StanHeaders

System requirements: GNU make


See at CRAN