Learn R Programming

jarbes (version 2.4.2)

plot.bmeta: Generic plot function for bmeta object in jarbes.

Description

This function is built with `ggplot2`. Parameters such as `binwidth`, `adjust`, `density.colors`, `density.lwd`, `density.lty`, and `density.alpha` correspond directly to arguments in the `ggplot2` geoms.

Usage

# S3 method for bmeta
plot(
  x,
  n.samples = NULL,
  x.lim = NULL,
  y.lim = NULL,
  x.lab = expression(mu[theta]),
  y.lab = "Posterior Distribution",
  title.plot = "Normal RE",
  show.legend = TRUE,
  legend.labels = c("Posterior of the difference in means",
    "Posterior Predictive Distribution"),
  legend.title = "Distribution",
  show.histogram = TRUE,
  show.rug = TRUE,
  show.vlines = TRUE,
  binwidth = 0.08,
  adjust = 1,
  density.colors = c("blue", "red"),
  density.lwd = c(1, 1),
  density.lty = c("solid", "dashed"),
  density.alpha = c(0.2, 0.2),
  hist.color = "black",
  hist.fill = "grey95",
  rug.color = "green",
  rug.alpha = 0.5,
  ...
)

Arguments

x

The object generated by the bmeta function.

n.samples

The number of posterior samples to plot.

x.lim

Numeric vector of length 2 specifying the x-axis limits.

y.lim

Numeric vector of length 2 specifying the y-axis limits.

x.lab

Text with the label of the x-axis.

y.lab

Text with the label of the y-axis.

title.plot

Text for setting a title in the plot.

show.legend

A logical value indicating whether to show the legend.

legend.labels

A character vector of length 2 to customize the legend labels.

legend.title

A character value to customize the legend title.

show.histogram

A logical value indicating whether to show the histogram.

show.rug

A logical value indicating whether to show the rug plot.

show.vlines

A logical value indicating whether to show the vertical lines for the means.

binwidth

A numeric value specifying the bin width for the histogram.

adjust

A numeric value to adjust the bandwidth of the density curves. Defaults to 1.

density.colors

A character vector of length 2 for the density curve colors.

density.lwd

A numeric vector of length 2 for the density curve line widths.

density.lty

A numeric vector of length 2 for the density curve line types.

density.alpha

A numeric vector of length 2 for the density curve transparencies.

hist.color

A character value for the histogram border color.

hist.fill

A character value for the histogram fill color.

rug.color

A character value for the rug plot color.

rug.alpha

A numeric value between 0 and 1 for the rug plot transparency.

...

...