Compute pointwise 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. If supplied, it must be a flocker_data object produced by `make_flocker_data()`.

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 likelihood units are columns. For two-level models, columns are named with the level-two group names.

Details

In one-level single-season models, columns are closure units (e.g. points or species-points; suitable for leave-one-unit-out CV). In multiseason models, columns are series (i.e. points or species-points; suitable for leave-one-series-out CV). In `twolevel_single` models, columns are level-two groups. In augmented models, columns are species (suitable for leave-one-species-out CV).

Examples

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