Learn R Programming

camtrapR (version 2.3.0)

plot_coef,commOccu-method: Plot effect sizes of covariates in community occupancy model

Description

Plot effect sizes for all species in a community (multi-species) occupancy model. Currently only supports continuous covariates, not categorical covariates.

Usage

# S4 method for commOccu
plot_coef(
  object,
  mcmc.list,
  submodel = "state",
  ordered = TRUE,
  combine = FALSE,
  outdir,
  level = c(outer = 0.95, inner = 0.75),
  colorby = "significance",
  scales = "free_y",
  community_lines = FALSE,
  ...
)

Value

A list of ggplot objects (one list item per covariate).

Arguments

object

commOccu object

mcmc.list

mcmc.list. Output of fit called on a commOccu object

submodel

character. Submodel to get plots for. Can be "det" or "state"

ordered

logical. Order species in plot by median effect (TRUE) or by species name (FALSE)

combine

logical. Combine multiple plots into one plot (via facets)?

outdir

character. Directory to save plots to (optional)

level

numeric. Probability mass to include in the uncertainty interval (two values named "outer" and "inner", in that order). Second value (= inner interval) will be plotted thicker.

colorby

character. Whether to color estimates by "significance" (of the effect estimates), or "Bayesian p-value" (of the species). Currently allows only "significance".

scales

character. Passed to facet_grid. Can be "free" to scale x axes of effect estimates independently, or "free_y" to scale all x axes identically.

community_lines

logical. Add faint vertical lines to the plot indicating median community effect (solid line) and its confidence interval (first value from level).

...

additional arguments for ggsave - only relevant if outdir is defined.

Details

Users who wish to create their own visualizations can use the data stored in the ggplot output. It is accessed via e.g. output$covariate_name$data