Get posterior distribution of the Z matrix
get_Z(
flocker_fit,
draw_ids = NULL,
history_condition = TRUE,
sample = FALSE,
new_data = NULL,
allow_new_levels = FALSE,
sample_new_levels = "uncertainty"
)A flocker_fit object
Vector of indices of the posterior draws to be used. If `NULL` (the default) all draws are used in their native order.
Should the posterior distribution for Z directly condition on the observed detection history (`TRUE`) or not (`FALSE`)? For example, at sites with at least one detection, the true occupancy state conditioned on the history is one with absolute certainty. Without directly conditioning on the history, the occupancy state is controlled by the posterior distribution for the occupancy probability psi.
Should the return be posterior probabilities of occupancy (FALSE), or bernoulli samples from those probabilities (TRUE)
Optional new data at which to predict the Z matrix. Can be the output of `make_flocker_data` or the `unit_covs` input to `make_flocker_data` provided that `history_condition` is `FALSE` and the occupancy model is a one-level single-season model. Two-level, augmented, and multiseason models require a `flocker_data` object.
allow new levels for random effect terms in `new_data`? Will error if set to `FALSE` and new levels are provided in `new_data`.
If `new_data` is provided and contains random effect levels not present in the original data, how should predictions be handled? Passed directly to `brms::prepare_predictions`, which see.
For one-level and multiseason models, the posterior Z matrix in the shape of the first visit in `obs` as passed to make_flocker_data, with posterior iterations stacked along the final dimension. For `twolevel_single` and `augmented` models, a list with elements `unit` and `level2`. The `unit` element has that same unit-level shape, and the `level2` element is a matrix with one row per level-two group and posterior iterations in columns. Group dimensions are named using the level-two grouping factor, or species names for augmented models.
if (FALSE) { # \dontrun{
get_Z(example_flocker_model_single)
} # }