cdmeta: Confidence-distribution-based inference for random-effects...

View source: R/cdmeta.R

cdmetaR Documentation

Confidence-distribution-based inference for random-effects meta-analysis

Description

Performs unified confidence-distribution-based inference for random-effects meta-analysis. The function provides inference for the overall mean effect \mu, heterogeneity variance \tau^2, heterogeneity standard deviation \tau, heterogeneity proportion I^2, and the effect in a future study \theta_{\mathrm{new}}.

Usage

cdmeta(
  y,
  se,
  alpha = 0.05,
  B = 25000,
  seed = NULL,
  parallel = FALSE,
  tau2_samples = NULL,
  i2_method = c("typical_se2", "mean_se2", "harmonic_mean_se2"),
  mu_dist = c("normal", "t"),
  df = NULL,
  qtype = 8,
  transf = NULL,
  transf_name = NULL,
  ...
)

Arguments

y

A numeric vector of study-specific effect estimates (e.g., MD, SMD, log OR, log RR, or log HR).

se

A numeric vector of within-study standard errors of y.

alpha

The significance level for interval estimation. Default is 0.05; the alpha/2th and 1-alpha/2th quantiles are used as the lower and upper limits of the interval estimates.

B

The number of Monte Carlo samples. When tau2_samples is not supplied, this value is also passed to pimeta::pima() as the number of bootstrap samples. Default is 25000.

seed

An optional numeric value that determines the random seed for reproducibility. Default is NULL.

parallel

Either FALSE for single-threaded computation or a positive integer specifying the number of threads passed to pimeta::pima(). Default is FALSE.

tau2_samples

An optional numeric vector of externally supplied \tau^2 samples. If supplied, pimeta::pima() is not called.

i2_method

A character string specifying the reference within-study variance used for calculating I^2. Available options are "typical_se2", "mean_se2", and "harmonic_mean_se2". Default is "typical_se2".

mu_dist

A character string specifying the distribution used for conditional sampling of the overall mean effect \mu. Available options are "normal" and "t". Default is "normal".

df

The degrees of freedom used when mu_dist = "t". If NULL, the default is K - 1, where K is the number of studies.

qtype

The quantile type used in stats::quantile(). Default is 8.

transf

An optional transformation function applied to effect-scale summaries. For example, transf = exp can be used when y is on the log odds ratio, log risk ratio, or log hazard ratio scale. The transformation is applied to mu, theta_new, and mu_plugin, but not to heterogeneity measures.

transf_name

An optional character string giving the name of the transformation function. For example, transf_name = "exp". If NULL, the name is inferred when possible.

...

Additional arguments passed to pimeta::pima().

Details

The function first obtains Monte Carlo samples of the between-study variance \tau^2. These samples are obtained either from pimeta::pima(..., method = "boot") or from a user-supplied vector tau2_samples.

Given sampled values of \tau^2, the function performs conditional sampling of the overall mean effect. If mu_dist = "normal", then

\mu \mid \tau^2, y \sim N\{\hat{\mu}(\tau^2), V_{\mu}(\tau^2)\}.

If mu_dist = "t", then a t distribution with df degrees of freedom is used instead. The predictive distribution for a future study effect is then generated as

\theta_{\mathrm{new}} \mid \mu, \tau^2 \sim N(\mu, \tau^2).

For I^2, the sampled \tau^2 values are transformed using a reference within-study variance specified by i2_method.

If transf is supplied, all calculations are still performed on the original analysis scale of y. The transformation is applied after Monte Carlo sampling. Heterogeneity measures \tau^2, \tau, and I^2 are not transformed.

Value

An object of class "cdmeta". The main components include the matched call, study and Monte Carlo counts, point estimates, interval estimates, Monte Carlo draws, input data, the pimeta result (when used), and transformation information.

References

Noma, H., and Schwarzer, G. (2026). Frequentist prediction intervals for random-effects meta-analysis via confidence-distribution propagation. arXiv, 2608.26527. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.48550/arXiv.2608.26527")}

See Also

forest.cdmeta, plot.cdmeta

Examples

data(hf_iron)

fit_hf <- cdmeta(
  y = hf_iron$yi,
  se = hf_iron$sei,
  B = 10000,
  seed = 11111,
  transf = exp,
  transf_name = "exp"
)

fit_hf

forest(
  fit_hf,
  slab = hf_iron$study,
  at = log(c(0.25, 0.5, 1, 2, 4)),
  xlab = "Risk ratio",
  mark_summary_estimate = TRUE,
  mark_prediction_estimate = TRUE
)


cdmeta documentation built on Sept. 15, 2026, 5:09 p.m.