Skip to contents

Plots species-level temporal detection rates combining survey predictors averaged over sites (if included via make_data()) and survey random effects (kappa).

Usage

plot_surveys(
  fit,
  species = NULL,
  surveys = NULL,
  seasons = NULL,
  intercepts = TRUE,
  back_transform = TRUE,
  include_predictors = TRUE,
  ndraws = NULL,
  seed = NULL,
  palette = "YlGn",
  ...
)

Arguments

fit

A fitted model object from occARU().

species

character. Vector of species to plot. If NULL (default), all species are plotted. Must be one of attr(occARU_data, "species").

surveys

character. Vector of survey dates to plot. If NULL (default), all surveys are plotted. Must be one of attr(occARU_data, "surveys").

seasons

character. Vector of seasons to plot. If NULL (default), all seasons are plotted. Must be one of attr(occARU_data, "seasons").

intercepts

logical. If TRUE (default), species-level baseline log detection rates are added to the survey effects. If FALSE, only the temporal deviations are plotted on the log scale.

back_transform

logical. Only used when intercepts = TRUE. If TRUE (default), log detection rates are back-transformed to the natural scale via exp(). If FALSE, values are left on the log scale.

include_predictors

logical. If TRUE (default), includes predictors in the survey effects, if included. If FALSE, only plots the random effects.

ndraws

Positive integer. Number of draws to use for plotting, passed to tidybayes::spread_rvars(). Default: NULL (uses all draws).

seed

Positive numeric. Seed to use when subsampling draws when ndraws is not NULL. Default: random integer.

palette

character. Colour palette to be passed to ggplot2::scale_fill_brewer(). Default: "YlGn".

...

Additional arguments passed to ggdist::stat_lineribbon() such as .width and point_interval.

Value

A ggplot object with occARU-specific attributes attached:

plot_data

The tibble used to produce the plot.