Compute unit-wise or series-wise log-likelihood matrix for a flocker_fit object

log_lik_flocker(
  flocker_fit,
  new_data = NULL,
  allow_new_levels = FALSE,
  sample_new_levels = "uncertainty",
  draw_ids = NULL
)

Arguments

flocker_fit

A flocker_fit object

new_data

optional new data at which to compute log likelihood

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? See '?brms::prepare_predictions' for options.

draw_ids

the draw ids to compute log-likelihoods for. Defaults to using the full posterior.

Value

A posterior log-likelihood matrix, where iterations are rows and units, series, or species are columns.

Details

In single-season models, rows are units (e.g. points or species-points; suitable for leave-one-unit-out CV). In multiseason models, rows are series (i.e. points or species-points, suitable for leave-one-series-out CV). In augmented models, rows are species (suitable for leave-one-species-out CV).

Examples

if (FALSE) { # \dontrun{
log_lik_flocker(example_flocker_model_single)
} # }