Plot dose_response curve objects produced by compile_rjMCMC.

# S3 method for dose_response
plot(
  dr.object,
  overlay = FALSE,
  do.facet = TRUE,
  facet.title = TRUE,
  colour.by = NULL,
  colour = NULL,
  colour.median = NULL,
  fill.alpha = 0.3,
  order.by = "response",
  show.pmed = TRUE,
  rotate.y = FALSE,
  all.credint = FALSE,
  scientific.name = FALSE,
  common.name = FALSE,
  overwrite.abbrev = TRUE,
  outline.outer = FALSE,
  do.save = FALSE,
  file.format = "pdf",
  ...
)

Arguments

dr.object

Input object of class dose_response, as returned by compile_rjMCMC.

overlay

Logical. If TRUE, all curves will be overlaid on the same plot.

do.facet

Logical. If TRUE, plots will be faceted by species (or species group).

colour.by

Curves can be coloured by species group (colour.by = "group") or by individual species (colour.by = "species"), or can use a single colour scheme (the default, colour.by = NULL).

colour

Used to overwrite the colour.by argument, if desired.

colour.median

Colour to use for the posterior median. Overwrites the colour.by argument.

fill.alpha

Opacity applied to the credible intervals. Ranges from 0 (transparent) to 1 (fully opaque).

order.by

How should plots be arranged? Use order.by = "species" to arrange plots by species (groups) names in alphabetical order, or order.by = "response", to arrange plots by response thresholds (from most to least sensitive species (groups), as determined by the estimated posterior medians for μ). Only relevant when overlay = FALSE.

show.pmed

Logical. If TRUE, the values of posterior medians are added to facet labels. Only relevant when overlay = FALSE.

rotate.y

Logical. If TRUE, y-axis labels are rotated clockwise by 90 degrees.

all.credint

Logical. If TRUE, plot all credible intervals. If FALSE, only plot the outermost interval.

scientific.name

Logical. If TRUE, use species' scientific names in plot titles.

common.name

Logical. If TRUE, use species' common names in plot titles.

overwrite.abbrev

Logical. If TRUE, overwrites abbreviated names for species grouped a priori using create_groups.

outline.outer

Logical. If TRUE, outline the outermost credible interval bounds.

do.save

Logical. Whether to save plots on disk.

file.format

Character. File format for output plots on disk. Can be one of png, jpeg, tiff or pdf. Only used when do.save = TRUE.

...

Additional arguments as passed to gg.save.

See also

Author

Phil J. Bouchet

Examples

if (FALSE) { library(espresso) # Import the example data, excluding species with sample sizes < 5 # and considering the sonar covariate mydat <- read_data(file = NULL, min.N = 5, covariates = "sonar") summary(mydat) # Configure the sampler mydat.config <- configure_rjMCMC(dat = mydat, model.select = TRUE, covariate.select = FALSE, function.select = FALSE, n.rep = 100) summary(mydat.config) # Run the reversible jump MCMC rj <- run_rjMCMC(dat = mydat.config, n.chains = 2, n.burn = 100, n.iter = 100, do.update = FALSE) # Burn and thin rj.trace <- trace_rjMCMC(rj.dat = rj) # Get dose-response functions doseR <- compile_rjMCMC(rj.trace) # Plot dose-response curves plot(dr.object = doseR, colour.by = "group") }