Extract fitted values for a given submodel from a ubmsFit
object.
Fitted values are calculated separately for each submodel
using the posterior predictive distribution of the latent state z,
following Wright et al. (2019).
# S4 method for ubmsFit
fitted(object, submodel, draws = NULL, ...)
A fitted model of class ubmsFit
Submodel to get fitted values for, options are "state"
or "det"
An integer indicating the number of draws to return. The default and maximum number of draws is the size of the posterior sample.
Currently ignored
A matrix of fitted values with dimension draws
by
observations. Note that calculation of fitted values
for the detection submodel is conditional on \(z > 0\), so fitted values
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.