| Title: | Confidence-Distribution-Based Inference for Random-Effects Meta-Analysis |
|---|---|
| Description: | Computational tools for confidence-distribution-propagation-based inference in random-effects meta-analysis. Implements confidence-distribution propagation for frequentist inference in random-effects meta-analysis. The package samples the between-study variance from a confidence distribution based on the exact distribution of Cochran's Q, samples the average effect conditionally on each draw, and generates the true effect in a future study. It provides prediction intervals and confidence intervals for the average effect, between-study variance, between-study standard deviation, and I2. The methods are described in Noma and Schwarzer (2026). |
| Authors: | Hisashi Noma [aut, cre] (ORCID: <https://orcid.org/0000-0002-2520-9949>), Guido Schwarzer [aut] (ORCID: <https://orcid.org/0000-0001-6214-9087>) |
| Maintainer: | Hisashi Noma <[email protected]> |
| License: | GPL-3 |
| Version: | 1.1-1 |
| Built: | 2026-09-16 23:12:03 UTC |
| Source: | https://github.com/guido-s/cdmeta |
A pairwise subset extracted from a network meta-analysis of antithrombotic treatments for prevention of stroke in patients with non-valvular atrial fibrillation. The dataset includes direct comparisons of vitamin K antagonists versus placebo or control, with study-specific log odds ratios and standard errors for the stroke outcome.
data(af_vka)data(af_vka)
A data frame with 6 rows and 11 variables:
Study identifier.
Trial name.
Label for the treatment group.
Label for the control group.
Number of stroke events in the treatment group.
Number of participants in the treatment group.
Number of stroke events in the control group.
Number of participants in the control group.
Study-specific log odds ratio comparing vitamin K antagonists with placebo or control.
Standard error of yi.
Sampling variance of yi, equal to sei^2.
Dogliotti, A., Paolasso, E., and Giugliano, R. P. (2014). Current and new oral antithrombotics in non-valvular atrial fibrillation: a network meta-analysis of 79808 patients. Heart, 100(5), 396–405. doi:10.1136/heartjnl-2013-304347
Performs unified confidence-distribution-based inference for random-effects
meta-analysis. The function provides inference for the overall mean effect
, heterogeneity variance , heterogeneity standard
deviation , heterogeneity proportion , and the effect in
a future study .
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, ... )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, ... )
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 |
alpha |
The significance level for interval estimation. Default is 0.05;
the |
B |
The number of Monte Carlo samples. When |
seed |
An optional numeric value that determines the random seed for
reproducibility. Default is |
parallel |
Either |
tau2_samples |
An optional numeric vector of externally supplied
|
i2_method |
A character string specifying the reference within-study
variance used for calculating |
mu_dist |
A character string specifying the distribution used for
conditional sampling of the overall mean effect |
df |
The degrees of freedom used when |
qtype |
The quantile type used in |
transf |
An optional transformation function applied to effect-scale
summaries. For example, |
transf_name |
An optional character string giving the name of the
transformation function. For example, |
... |
Additional arguments passed to |
The function first obtains Monte Carlo samples of the between-study variance
. These samples are obtained either from
pimeta::pima(..., method = "boot") or from a user-supplied vector
tau2_samples.
Given sampled values of , the function performs conditional
sampling of the overall mean effect. If mu_dist = "normal", then
If mu_dist = "t", then a distribution with df degrees
of freedom is used instead. The predictive distribution for a future study
effect is then generated as
For , the sampled 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 , , and
are not transformed.
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.
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 )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 )
Draws a forest plot from an object of class "cdmeta". The plot shows
study-specific effect estimates and confidence intervals, the
confidence-distribution-based summary estimate for the overall mean effect,
and optionally the prediction interval for the effect in a future study.
## S3 method for class 'cdmeta' forest( x, slab = NULL, order = c("none", "increasing", "decreasing", "precision", "weight"), level = NULL, summary_stat = c("mean", "median"), refline = 0, xlab = "Effect size", main = NULL, atransf = NULL, at = NULL, alim = NULL, xlim = NULL, digits = 2, ci_digits = digits, weight_digits = 1, show_weights = TRUE, show_pi = TRUE, show_het = TRUE, header = TRUE, annotate = TRUE, cex = 0.85, psize = NULL, pch = 22, box_col = "black", box_bg = "white", ci_col = "black", summary_col = "black", summary_bg = "gray20", pi_col = "gray40", refline_col = "gray70", grid = TRUE, grid_col = "gray90", qtype = 8, symmetric_shapes = TRUE, mark_summary_estimate = FALSE, mark_prediction_estimate = FALSE, estimate_mark_col = "black", estimate_mark_lwd = 1, mar = c(4.5, 1, 3, 1), ... ) forest(x, ...)## S3 method for class 'cdmeta' forest( x, slab = NULL, order = c("none", "increasing", "decreasing", "precision", "weight"), level = NULL, summary_stat = c("mean", "median"), refline = 0, xlab = "Effect size", main = NULL, atransf = NULL, at = NULL, alim = NULL, xlim = NULL, digits = 2, ci_digits = digits, weight_digits = 1, show_weights = TRUE, show_pi = TRUE, show_het = TRUE, header = TRUE, annotate = TRUE, cex = 0.85, psize = NULL, pch = 22, box_col = "black", box_bg = "white", ci_col = "black", summary_col = "black", summary_bg = "gray20", pi_col = "gray40", refline_col = "gray70", grid = TRUE, grid_col = "gray90", qtype = 8, symmetric_shapes = TRUE, mark_summary_estimate = FALSE, mark_prediction_estimate = FALSE, estimate_mark_col = "black", estimate_mark_lwd = 1, mar = c(4.5, 1, 3, 1), ... ) forest(x, ...)
x |
An object of class |
slab |
An optional character vector of study labels. If |
order |
A character string specifying the order of studies in the plot.
Available options are |
level |
Confidence level used for study-specific and summary intervals.
If |
summary_stat |
Whether Monte Carlo means ( |
refline |
Numeric location of the reference line. |
xlab |
Label for the x-axis. |
main |
Optional main title. |
atransf |
Optional function used to transform axis labels and printed estimates while plotting coordinates remain on the original analysis scale. |
at |
Optional numeric vector specifying tick-mark locations on the original analysis scale. |
alim |
Optional numeric vector of length 2 specifying plotting limits for the effect-size axis on the original analysis scale. |
xlim |
Optional numeric vector of length 2 specifying full plotting limits including the text columns. |
digits |
Number of digits used for axis labels. |
ci_digits |
Number of digits used for effect estimates and intervals. |
weight_digits |
Number of digits used for study weights. |
show_weights |
Logical indicating whether study weights are shown. |
show_pi |
Logical indicating whether the prediction interval is shown. |
show_het |
Logical indicating whether heterogeneity statistics are shown. |
header |
Logical indicating whether column headers are shown. |
annotate |
Logical indicating whether estimates and intervals are printed on the right side of the plot. |
cex |
Character expansion factor. |
psize |
Optional point sizes for study-specific estimates. If
|
pch |
Plotting symbol for study-specific estimates. |
box_col |
Border color of study-specific points. |
box_bg |
Fill color of study-specific points. |
ci_col |
Color of study-specific confidence intervals. |
summary_col |
Border color of the summary diamond. |
summary_bg |
Fill color of the summary diamond. |
pi_col |
Color of the prediction interval. |
refline_col |
Color of the reference line. |
grid |
Logical indicating whether vertical grid lines are drawn. |
grid_col |
Color of the grid lines. |
qtype |
Quantile type used in |
symmetric_shapes |
Logical indicating whether the summary diamond and prediction-interval marker are drawn symmetrically around interval midpoints. |
mark_summary_estimate |
Logical indicating whether the actual summary point estimate is marked inside the summary diamond. |
mark_prediction_estimate |
Logical indicating whether the actual predictive point estimate is marked on the prediction-interval row. |
estimate_mark_col |
Color of the actual-estimate marks. |
estimate_mark_lwd |
Line width of the actual-estimate marks. |
mar |
Plot margins passed to |
... |
Additional arguments passed to |
Study-specific confidence intervals are calculated using the normal approximation
where . The summary interval for and the
prediction interval are calculated from the Monte Carlo samples in the
cdmeta object when available.
If the object was created with transf = exp, forest() uses
this transformation automatically when atransf = NULL. Tick marks
supplied through at remain on the original analysis scale.
Invisibly returns a data frame containing the plotted study-specific estimates, standard errors, confidence intervals, and weights. Attributes contain the overall, prediction, and heterogeneity summaries on the original analysis scale.
data(hf_iron) fit_hf <- cdmeta( y = hf_iron$yi, se = hf_iron$sei, B = 10000, seed = 11111, transf = exp, transf_name = "exp" ) 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 )data(hf_iron) fit_hf <- cdmeta( y = hf_iron$yi, se = hf_iron$sei, B = 10000, seed = 11111, transf = exp, transf_name = "exp" ) 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 )
A dataset from a systematic review and meta-analysis of randomized trials evaluating intravenous iron therapy for patients with heart failure and iron deficiency. The outcome is represented by study-specific log risk ratios and their standard errors.
data(hf_iron)data(hf_iron)
A data frame with 6 rows and 5 variables:
Study identifier.
Trial name.
Study-specific log risk ratio.
Standard error of yi.
Sampling variance of yi, equal to sei^2.
Anker, S. D., et al. (2025). Systematic review and meta-analysis of intravenous iron therapy for patients with heart failure and iron deficiency. Nature Medicine, 31, 2640–2646. doi:10.1038/s41591-025-03671-1
Displays the Monte Carlo predictive distribution of the true effect in a future study and, optionally, its prediction interval.
## S3 method for class 'cdmeta' plot( x, show_interval = TRUE, breaks = 40, main = NULL, xlab = NULL, hist_col = "grey85", border_col = "white", density_lwd = 2, pi_col = "firebrick", pi_lwd = 3, rug = FALSE, transf = NULL, transf_name = NULL, qtype = 8, ... )## S3 method for class 'cdmeta' plot( x, show_interval = TRUE, breaks = 40, main = NULL, xlab = NULL, hist_col = "grey85", border_col = "white", density_lwd = 2, pi_col = "firebrick", pi_lwd = 3, rug = FALSE, transf = NULL, transf_name = NULL, qtype = 8, ... )
x |
An object of class |
show_interval |
A logical value indicating whether a separate prediction- interval panel is shown below the predictive distribution. |
breaks |
Number of histogram breaks or another value accepted by
|
main |
Optional main title. |
xlab |
Optional x-axis label. |
hist_col |
Fill color of histogram bars. |
border_col |
Border color of histogram bars. |
density_lwd |
Line width of the kernel density curve. |
pi_col |
Color used for prediction-interval and predictive-estimate marks. |
pi_lwd |
Line width used for the prediction interval. |
rug |
A logical value indicating whether a rug of Monte Carlo draws is added. |
transf |
Optional transformation function for the predictive draws. |
transf_name |
Optional character string naming |
qtype |
The quantile type used in |
... |
Additional arguments passed to |
The input object x, invisibly.
data(hf_iron) fit_hf <- cdmeta(hf_iron$yi, hf_iron$sei, B = 10000, seed = 11111) plot(fit_hf)data(hf_iron) fit_hf <- cdmeta(hf_iron$yi, hf_iron$sei, B = 10000, seed = 11111) plot(fit_hf)
Prints point estimates, confidence intervals, and the prediction interval
from an object of class "cdmeta".
## S3 method for class 'cdmeta' print(x, digits = 4, transf = NULL, transf_name = NULL, qtype = 8, ...)## S3 method for class 'cdmeta' print(x, digits = 4, transf = NULL, transf_name = NULL, qtype = 8, ...)
x |
An object of class |
digits |
The number of digits to print. |
transf |
An optional transformation function applied to effect-scale summaries for printing. |
transf_name |
An optional character string naming |
qtype |
The quantile type used in |
... |
Additional arguments; currently not used. |
The input object x, invisibly.