Learn R Programming

birp (version 0.0.5)

plot.birp: Plot posterior distributions of gamma parameters

Description

Plots the posterior densities of the gamma parameters estimated by a birp object.

Usage

# S3 method for birp
plot(
  x,
  shadingIncrease = NA,
  shadingDecrease = "#f2c7c7",
  col = "black",
  lwd = 1,
  lty = 1:x$num_gamma,
  xlim = NA,
  ylim = NA,
  add = FALSE,
  xlab = expression(gamma),
  ylab = "Posterior density",
  legend = x$gamma_names,
  lineAtZero = TRUE,
  ...
)

Value

No return value, called for side effects.

Arguments

x

A birp object.

shadingIncrease

Character or color specification; Shading color for the range where the gamma parameter is greater than 0 (gamma > 0). If NA, shading is omitted. Default is NA.

shadingDecrease

Character or color specification; Shading color for the range where the gamma parameter is less than 0 (gamma < 0). If NA, shading is omitted. Default is "#f2c7c7".

col

Character vector or color values; Line color(s) for the density plots. If a single value is provided, it is recycled for all gamma parameters. Default is "black".

lwd

Numeric vector; Line width(s) for the density plots. If a single value is provided, it is recycled. Default is 1.

lty

Numeric or character vector; Line type(s) for the density plots. If a single value is provided, it is recycled. Default is 1:x$num_gamma.

xlim

Numeric vector of length 2; Optional x-axis limits. If NA, limits are determined automatically from the density data. Default is NA.

ylim

Numeric vector of length 2; Optional y-axis limits. If NA, limits are determined automatically from the density data. Default is NA.

add

Logical; If TRUE, adds the densities to an existing plot. Otherwise, creates a new plot. Default is FALSE.

xlab

Character; Label for the x-axis. Default is expression(gamma).

ylab

Character; Label for the y-axis. Default is "Posterior density".

legend

Character vector of legend labels, or NA to suppress the legend. Default is x$gamma_names.

lineAtZero

Logical; If TRUE, adds a vertical line at x = 0 to indicate no effect. Default is TRUE.

...

Additional graphical parameters passed to lines (when plotting the densities) and plot (when creating a new plot).

See Also

birp

Examples

Run this code
data <- simulate_birp()
est <- birp(data)
plot(est)

Run the code above in your browser using DataLab