DunnSmythResidualsRaw: Dunn-Smyth Residuals for Detection and Occupancy for Given...

cdfvals_2_dsres_discreteR Documentation

Dunn-Smyth Residuals for Detection and Occupancy for Given Precalculated Predictions of Probabilities

Description

Dunn-Smyth Residuals for Detection and Occupancy for Given Precalculated Predictions of Probabilities

Usage

cdfvals_2_dsres_discrete(cdf, cdfminus, seed = NULL)

numdet_pdf(x, pDetected)

numdet_cdf(x, pDetected)

ds_detection_residuals.raw(preds, obs, seed = NULL)

ds_occupancy_residuals.raw(preds, obs, seed = NULL)

Arguments

cdf

The CDF of a discrete random variable evaluated at observations of iid copies of this random variable. Must be a list or vector.

cdfminus

For observations of iid copies of a discrete random variable, the CDF of the random variable evaluated at the value just below the observed values. Must be a list or vector of same length as cdf.

x

Is the value at which to evaluate the pdf

pDetected

Is a list of the detection probabilities for each visit to the ModelSite for a single species

preds

is a dataframe with columns Species, ModelSite, pOccupancy, and pDetected_cond. pOccupancy is the probability of ModelSite being occupied. pDetected_cond is the probability of detecting the species, given the species occupies the ModelSite.

obs

is a dataframe with columns Species, ModelSite, and Detected

fit

Is a runjags object created by fitting using package runjags.

Value

A dataframe with a columns for Species, ModelSite, and detection residual. The residual is only computed for species detected at least once at a site.

A dataframe with a columns for Species, ModelSite, and occupancy residual.

Functions

  • cdfvals_2_dsres_discrete: For supplied (discrete) CDF evaluations, compute Dunn-Syth residuals.

  • numdet_pdf: For a given ModelSite and species, computes the (discrete) probability density function (pdf) for the number of detections of the species at the ModelSite. Based heavily on Rpresence code for hetpdf() initially (but not the rest this file) WARNING: do not know what the license for Rpresense source code is!! Can't use code directly at least.

  • numdet_cdf: For a given ModelSite and species, computes the (discrete) cumulative distribution function (cdf) for the number of detections of the species at the ModelSite. Based heavily on Rpresence code for numdet_cdf initially (but not the rest this file) WARNING: do not know what the license for Rpresense source code is!! Can't use code directly at least.

  • ds_detection_residuals.raw: Given predictions for detection probability conditioned on the site being occupied, and corresponding and detection observations, compute Dunn-Smyth residuals for detection

  • ds_occupancy_residuals.raw: Given occupancy predictions and detection observations, compute Dunn-Smyth residuals for occupancy

References

D. I. Warton, J. Stoklosa, G. Guillera-Arroita, D. I. MacKenzie, and A. H. Welsh, "Graphical diagnostics for occupancy models with imperfect detection," Methods in Ecology and Evolution, vol. 8, no. 4, pp. 408-419, 2017, doi: 10.1111/2041-210X.12761.


sustainablefarms/msod documentation built on March 6, 2023, 7:17 a.m.