Learn R Programming

jarbes (version 2.4.2)

plotdata_reg.bcbnp: Plot Meta-Regression Results from a BCBNP Model

Description

This function visualizes the results of a bias-corrected Bayesian nonparametric meta-regression. It plots the raw data with error bars, colors points based on the posterior probability of bias (I > 0.5), and adds the posterior mean regression line, the credible interval for the true effects, and the prediction interval for new observations, including its median line.

Usage

plotdata_reg.bcbnp(
  object,
  covariate,
  title.plot = NULL,
  ci.color = "green",
  pi.color = "purple",
  mean.line.color = "magenta",
  pi.mean.line.color = "gray",
  point.color.unbiased = "blue",
  point.color.biased = "red",
  show_ci = TRUE,
  show_pi = TRUE,
  errorbar_width = 0.25,
  x.lab = covariate,
  y.lab = "Treatment Effect (TE)",
  legend.name = "Posterior Bias",
  size.legend.name = "1/seTE",
  label.unbiased = "Unbiased",
  label.biased = "Biased"
)

Value

A ggplot object.

Arguments

object

The output object from the bcbnp function.

covariate

A character string specifying the single covariate from the data to be plotted (e.g., `"baseline_va"`).

title.plot

The title for the plot.

ci.color

The color of the credible interval lines. Defaults to "green".

pi.color

The color of the prediction interval lines. Defaults to "purple".

mean.line.color

The color of the mean regression line. Defaults to "magenta".

pi.mean.line.color

The color of the prediction interval median line. Defaults to "gray".

point.color.unbiased

The color of unbiased points. Defaults to "blue".

point.color.biased

The color of biased points. Defaults to "red".

show_ci

A logical value indicating whether to show the credible interval. Defaults to `TRUE`.

show_pi

A logical value indicating whether to show the prediction interval. Defaults to `TRUE`.

errorbar_width

The width of the error bars. Defaults to `0.25`.

x.lab

A character string for the x-axis label. Defaults to the covariate name.

y.lab

A character string for the y-axis label. Defaults to "Treatment Effect (TE)".

legend.name

A character string for the color legend title. Defaults to "Posterior Bias".

size.legend.name

A character string for the size legend title. Defaults to "1/seTE".

label.unbiased

A character string for the label of the unbiased group. Defaults to "Unbiased".

label.biased

A character string for the label of the biased group. Defaults to "Biased".