| regplot.brma | R Documentation |
regplot.brma creates a regression plot (also known as
bubble plot) for a fitted brma object with moderators. The plot displays
observed effect sizes against a moderator variable, with point sizes
proportional to study precision.
## S3 method for class 'brma'
regplot(
x,
mod = NULL,
pred = TRUE,
ci = TRUE,
pi = FALSE,
si = FALSE,
level = 95,
at = NULL,
digits = 2,
transf = NULL,
atransf = NULL,
targs = NULL,
refline = NULL,
psize = NULL,
plim = c(0.5, 3),
by = NULL,
legend = TRUE,
xlab = NULL,
ylab = NULL,
xlim = NULL,
ylim = NULL,
sampling_bias = TRUE,
sei = NULL,
max_samples = 10000,
plot_type = "base",
as_data = FALSE,
...
)
x |
a fitted brma object with moderators |
mod |
index or name of the moderator variable to plot on the x-axis. If not specified and only one moderator is present, that moderator is used. If multiple moderators are present, this argument is required. |
pred |
logical; whether to show the prediction line. Defaults to |
ci |
logical; whether to show credible interval bands. Defaults to |
pi |
logical; whether to show prediction interval bands. Defaults to |
si |
logical; whether to show sampling interval bands. Defaults to |
level |
numeric; credible/prediction interval level in percent.
Defaults to |
at |
numeric vector; for continuous moderators, values at which to evaluate the prediction. If not specified, uses a sequence across the observed range. |
digits |
integer; number of decimal places for labels. Defaults to |
transf |
function; transformation to apply to the y-axis (effect sizes).
Defaults to |
atransf |
reserved for axis-label transformations. Currently not
implemented and must be |
targs |
reserved for additional transformation arguments. Currently not
implemented and must be |
refline |
numeric; position of horizontal reference line.
Defaults to |
psize |
numeric vector or |
plim |
numeric vector of length 2; range for point sizes.
Defaults to |
by |
character; name of a moderator variable to use for separate
lines/colors. Defaults to |
legend |
logical; whether to show legend when |
xlab |
character; x-axis label. Defaults to the moderator name. |
ylab |
character; y-axis label. Defaults to "Observed Effect Size". |
xlim |
numeric vector of length 2; x-axis limits. Defaults to data range. |
ylim |
numeric vector of length 2; y-axis limits. Defaults to data range. |
sampling_bias |
whether publication bias should be incorporated into
plotted predictions and sampling intervals. Defaults to |
sei |
single positive numeric value used as the reference standard error for sampling-bias and sampling-interval calculations. Defaults to the median observed standard error. |
max_samples |
maximum number of posterior samples used for prediction
summaries and interval bands. Defaults to |
plot_type |
character; whether to use base R graphics ( |
as_data |
logical; if |
... |
additional graphical arguments:
|
The regression plot (bubble plot) is a standard visualization for meta-regression results. It displays:
Observed effect sizes (y-axis) against moderator values (x-axis)
Point sizes proportional to study precision (inverse variance)
Prediction line showing the estimated regression relationship
Confidence bands showing uncertainty in the mean prediction
Optional prediction bands showing expected range of true effects
Optional sampling interval bands showing expected range of observed outcomes
For continuous moderators, predictions are computed across the observed range of the moderator. For categorical moderators (factors), predictions are computed at each factor level with optional jittering of points.
The by argument allows displaying separate regression lines for
different levels of a second moderator, useful for visualizing interactions.
regplot.brma returns NULL invisibly if
plot_type = "base" or a ggplot object if plot_type = "ggplot".
If as_data = TRUE, returns a list with plot data components.
funnel.brma(), predict.brma()
## Not run:
if (requireNamespace("metadat", quietly = TRUE) &&
requireNamespace("metafor", quietly = TRUE)) {
data(dat.bcg, package = "metadat")
dat <- metafor::escalc(
measure = "RR",
ai = tpos,
bi = tneg,
ci = cpos,
di = cneg,
data = dat.bcg
)
fit <- brma(
yi = yi,
vi = vi,
mods = ~ ablat + year,
data = dat,
measure = "RR"
)
regplot(fit, mod = "ablat")
regplot(fit, mod = "year", pi = TRUE, si = TRUE)
regplot(fit, mod = "ablat", plot_type = "ggplot")
fit_cat <- brma(yi = yi, vi = vi, mods = ~ alloc, data = dat, measure = "RR")
regplot(fit_cat)
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.