plot_boot_density: Make density plots of bootstrapped parameters and add...

View source: R/plot_boot_density.R

plot_boot_densityR Documentation

Make density plots of bootstrapped parameters and add quantiles as vertical lines.

Description

Make density plots of bootstrapped parameters and add quantiles as vertical lines.

Usage

plot_boot_density(
  data,
  x_name,
  density_args = list(from = NULL, to = NULL),
  plot_args = list(xlab = NULL, ylab = "density", main = "", type = "l"),
  quantile_draw = FALSE,
  quantile_args = list(probs = c(0.05, 0.5, 0.95)),
  quantile_abline_args = list(lty = c(3, 2, 3), lwd = c(2, 2, 2), lend = "butt"),
  col_shade = "gray50",
  add_text_nsim = FALSE
)

Arguments

data

a numeric matrix or data frame that can be coerced to a numeric matrix where rows are runs and columns represent parameters or variables.

x_name

column name of a variable x to plot

density_args

arguments passed to stats::density density (excluding x)

plot_args

arguments passed to base::plot plot (excluding x and y)

quantile_draw

logical. Should quantiles of x be added to the plot as vertical lines? (e.g. confidence limits and median)

quantile_args

arguments passed to stats::quantile quantile for computing quantiles of x to add to plot as vertical lines

quantile_abline_args

arguments to pass to graphics::abline abline when plotting quantiles as vertical lines (excluding v)

col_shade

color for shading density region

add_text_nsim

logical. Should the number of simulation runs (nsim) in data be added as text to the plots?

Author(s)

Nikolai Klibansky

Examples

## Not run: 
nsim <- 100
data <- data.frame("M"=runif(nsim,0.19, 2.1),"lwb"=rnorm(nsim,mean=3))
par(mfrow=c(2,2))
plot_boot_density(data,"M")
plot_boot_density(data,"M",add_text_nsim = TRUE)
plot_boot_density(data,"lwb")
plot_boot_density(data,"lwb",add_text_nsim = TRUE,quantile_draw=TRUE,col_shade=rgb(0,0,1,0.5))

## End(Not run)

nikolaifish/bamExtras documentation built on July 21, 2023, 8:26 a.m.