Generates a caterpillar-style plot (forest plot) for visualizing and comparing posterior parameter estimates from one or two Bayesian models. This function is designed for use within the `jarbes` package and supports models fitted via MCMC. It allows custom labels, credible intervals, and styling for visual model comparison, particularly in meta-analytic and hierarchical modeling contexts.
caterplot_compare(
model1,
model2 = NULL,
pars,
plotmath.labels = NULL,
model1.name = "Model 1",
model2.name = "Model 2",
model.legend.title = "Model",
ref.lines = c(0),
colors = c("blue", "red"),
point.size = 3,
point.shapes = c(16, 17),
prob = 0.5,
prob.outer = 0.9,
point.est = "median",
x.lab = "Estimate",
y.lab = NULL,
inner.line.thickness = 2,
outer.line.thickness = 0.8,
...
)
An object containing MCMC draws. Various formats (e.g., arrays, matrices, data frames, `posterior::draws` objects) are accepted.
Optional object containing MCMC draws. Accepted formats are the same as for `model1`.
Character vector of parameter names to include in the plot.
Optional character vector for y-axis labels. If provided in R's plotmath syntax (e.g., for Greek letters or mathematical symbols), these labels will be displayed on the plot.
Text for the label of the first model.
Text for the label of the second model.
Text for the title of the model legend.
Numeric value indicating vertical reference lines.
Character vector specifying the colors for models.
Numeric value for the size of points in the plot.
Numeric or character vector specifying the shapes for points, one for each model.
Numeric value for the probability mass to include in the inner interval.
Numeric value for the probability mass to include in the outer interval.
Text specifying the type of point estimate to show. Either `"median"` (the default), `"mean"`, or `"none"`.
Text with the label of the x-axis.
Text with the label of the y-axis.
Numeric value for the thickness of the inner interval line.
Numeric value for the thickness of the outer interval line.
...