Extract residuals for a given submodel from a ubmsFit
object.
Residuals are calculated separately for each submodel
using the posterior predictive distribution of the latent state z,
following Wright et al. (2019).
# S4 method for class 'ubmsFit'
residuals(object, submodel, draws = NULL, ...)
A matrix of residual values with dimension draws
by
observations. Note that calculation of residuals
for the detection submodel is conditional on \(z > 0\), so residuals
for an observation in a posterior draw where \(z = 0\) are assigned
value NA
(Wright et al. 2019).
Wright, W. J., Irvine, K. M., & Higgs, M. D. (2019). Identifying occupancy model inadequacies: can residuals separately assess detection and presence? Ecology, 100(6), e02703.