DunnSmythResiduals: Dunn-Smyth Residuals for Detection and Occupancy for Fitted...

ds_detection_residuals.fitR Documentation

Dunn-Smyth Residuals for Detection and Occupancy for Fitted Models

Description

Dunn-Smyth Residuals for Detection and Occupancy for Fitted Models

Usage

ds_detection_residuals.fit(fit, type = "median", seed = NULL)

ds_occupancy_residuals.fit(
  fit,
  type = "median",
  seed = NULL,
  conditionalLV = TRUE
)

Arguments

fit

A fitted occupancy-detection model.

type

The type of point estimate to use for parameter estimates. See get_occ_b and similar.

seed

A seed to fix randomness of Dunn-Smyth residual jitter.

Value

A matrix, each row is a ModelSite and each column is a species. Detection residuals are only computed for species and sites that have at least one detection. Other values are NA.

A matrix, each row is a ModelSite and each column is a species.

Functions

  • ds_detection_residuals.fit: Given a fitted occupancy detection model (variable names must match). Computes Dunn-Smyth residuals for detection, marginalising the latent variables.

  • ds_occupancy_residuals.fit: Given a fitted occupancy detection model (variable names must match). Computes Dunn-Smyth residuals for occupancy, marginalising the latent variables.

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.

Examples

fit <- readRDS("./tmpdata/7_2_10_clim_year.rds")
detection_resids <- ds_detection_residuals.fit(fit, type = "median")
occupancy_resids <- ds_occupancy_residuals.fit(fit, type = "median", conditionalLV = FALSE)
fitold <- readRDS("../Experiments/7_4_modelrefinement/fittedmodels/7_4_13_allhyp_vif_logwoody500m_msnm_year_Time_Wind.rds")
fit <- translatefit(fitold)
ds_detection_residuals.fit(fit)
ds_occupancy_residuals.fit(fit)

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