Skip to contents

Plots coefficients of continuous, categorical, or ordinal predictors on occupancy or detection submodels.

Usage

plot_coefficients(
  fit,
  submodel = c("detection", "occupancy"),
  component = c("site", "survey"),
  type = c("continuous", "categorical", "ordinal"),
  level = c("species", "mean"),
  facet_by = c("predictor", "species"),
  species = NULL,
  restricted = TRUE,
  ordinal_categories = FALSE,
  ...
)

Arguments

fit

A fitted model object from fit_model().

submodel

character. Predictors of submodel to plot. One of "detection" (default) or "occupancy".

component

character. Whether to plot "site" (default) or "survey" predictors. If "survey", submodel must be "detection".

type

character. Type of predictors to plot. One of "continuous" (default), "categorical", or "ordinal".

level

character. For multi-species models, whether to plot species-specific ("species", default) or mean coefficients ("mean").

facet_by

character. Whether to use ggplot2::facet_wrap() or ggh4x::facet_grid2() to facet by "predictor" (default) or "species". Only used if level is "species".

species

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

restricted

logical. If TRUE (default), plots coefficients with orthogonal projection of the detection random site or survey effects, e.g., \(\boldsymbol{\iota}(\boldsymbol{I} - \boldsymbol{P_{X_2}})\), where \(\boldsymbol{I} - \boldsymbol{P_{X_2}}\) is the orthogonal complement of the column space of the site or survey design matrix. If FALSE, recovers coefficients without orthogonal projection, \(\boldsymbol{\beta} - \boldsymbol{\iota} \boldsymbol{X_2}^+\), where \(\boldsymbol{X_2}^+\) is the pseudo-inverse of the design matrix. Only used for site predictors if submodel is "detection", or if survey random effects were also projected with project_kappa = TRUE in fit_model().

ordinal_categories

logical. If FALSE (default), plots coefficients associated with maximum category (full effect). If TRUE, plots realised coefficient associated with each ordered category, where the first is used as the reference.

...

Additional arguments passed to ggdist::stat_pointinterval().

Value

A ggplot object with occARU-specific attributes attached:

plot_data

The tibble used to produce the plot.