get_Z {flocker}R Documentation

Get posterior distribution of the Z matrix

Description

Get posterior distribution of the Z matrix

Usage

get_Z(
  flocker_fit,
  draw_ids = NULL,
  history_condition = TRUE,
  sample = FALSE,
  new_data = NULL,
  allow_new_levels = FALSE,
  sample_new_levels = "uncertainty"
)

Arguments

flocker_fit

A flocker_fit object

draw_ids

Vector of indices of the posterior draws to be used. If 'NULL' (the default) all draws are used in their native order.

history_condition

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.

sample

Should the return be posterior probabilities of occupancy (FALSE), or bernoulli samples from those probabilities (TRUE)

new_data

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 single-season, non-augmented model.

allow_new_levels

allow new levels for random effect terms in 'new_data'? Will error if set to 'FALSE' and new levels are provided in 'new_data'.

sample_new_levels

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.

Value

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

Examples


get_Z(example_flocker_model_single)


[Package flocker version 1.0-0 Index]