Learn R Programming

jarbes (version 2.5.0)

plot.dpmeta: Generic plot function for dpmeta object.

Description

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

Usage

# S3 method for dpmeta
plot(
  x,
  plot.type = "predictive_vs_mean",
  center = "median",
  n.samples = NULL,
  x.lim = NULL,
  y.lim = NULL,
  x.lab = expression(theta^{
     new
 }),
  y.lab = "Posterior Predictive Distribution",
  title.plot = "Dirichlet Process ",
  show.histogram = TRUE,
  show.rug = TRUE,
  show.legend = FALSE,
  binwidth = 0.08,
  adjust = 1,
  predictive.color = "blue",
  mean.color = "red",
  median.color = "black",
  density.lty = "solid",
  density.lwd = 1,
  density.alpha = 0.2,
  hist.color = "black",
  hist.fill = "grey95",
  rug.color = "green",
  rug.alpha = 0.5,
  ...
)

Arguments

x

The object generated by the dpmeta function.

plot.type

A character string specifying the type of plot: "predictive_vs_mean" (default), "predictive", "tau_posterior".

center

A character string specifying which central tendency of the DP to plot: "median" (default), "mean", "both".

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. Defaults to \(\theta^{new}\).

y.lab

Text with the label of the y-axis. Defaults to "Posterior Predictive Distribution".

title.plot

Text for setting a title in the plot. Defaults to "Dirichlet Process ".

show.histogram

A logical value indicating whether to show the histogram.

show.rug

A logical value indicating whether to show the rug plot.

show.legend

A logical value indicating whether to show the legend when multiple density curves are displayed.

binwidth

A numeric value specifying the bin width for the histogram. Defaults to 0.08.

adjust

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

predictive.color

A character value specifying the color of the posterior predictive density curve.

mean.color

A character value specifying the color of the posterior mean density curve.

median.color

A character value specifying the color of the posterior median density curve.

density.lty

A character value for the density curve line type. Defaults to "solid".

density.lwd

A numeric value for the density curve line width. Defaults to 1.

density.alpha

A numeric value between 0 and 1 for the density curve transparency. Defaults to 0.2.

hist.color

A character value for the histogram border color. Defaults to "black".

hist.fill

A character value for the histogram fill color. Defaults to "grey95".

rug.color

A character value for the rug plot color. Defaults to "green".

rug.alpha

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

...

...