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 class 'ubmsFit'
fitted(object, submodel, draws = NULL, ...)

Arguments

object

A fitted model of class ubmsFit

submodel

Submodel to get fitted values for, options are "state" or "det"

draws

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

Value

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).

References

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.