Skip to contents

Summaries, point estimates, predictions, and model comparison for objects returned by fp_occu().

Usage

# S3 method for class 'fp_occu'
print(x, digits = 3, ...)

# S3 method for class 'fp_occu'
summary(object, prob = 0.95, ...)

# S3 method for class 'summary.fp_occu'
print(x, digits = 3, ...)

# S3 method for class 'fp_occu'
coef(object, type = c("all", "occ", "det", "fp"), ...)

# S3 method for class 'fp_occu'
predict(
  object,
  newdata,
  process = c("occ", "fp"),
  prob = 0.95,
  summary = TRUE,
  ...
)

# S3 method for class 'fp_occu'
loo(x, ...)

# S3 method for class 'fp_occu'
as_draws_df(x, ...)

Arguments

x, object

An fp_occu object.

digits

Number of digits to print.

...

Unused, or passed on (see each method).

prob

Width of the equal-tailed credible interval.

type

Which coefficients to return: "all" (default), "occ", "det", or "fp".

newdata

Data frame with the covariates of the requested process. If missing, the sites used in the fit.

process

"occ" for the occupancy probability or "fp" for the false-positive rate, both at the site level.

summary

Logical. Return a summary per row (TRUE) or the matrix of posterior draws (rows are draws, columns are rows of newdata)?

Value

summary() returns an object of class summary.fp_occu whose element table is a tibble with the posterior mean, standard deviation, credible interval, R-hat, and effective sample sizes of every parameter.

coef() returns a named vector of posterior means.

predict() returns a data frame with the posterior mean and credible interval of the probability for each row of newdata, or a matrix of draws.

loo() returns a psis_loo object from 'loo'. The pointwise log-likelihood is computed per site, with the latent state marginalized, so the comparison is leave-one-site-out.

as_draws_df() returns the posterior draws with the readable parameter names.

Examples

if (FALSE) { # \dontrun{
sim <- simulate_fp(nsite = 200, nocc = 10, seed = 1)
m <- fp_occu(sim$data, occ = ~ x, fp = ~ 1, random_recorder = FALSE)
m                                   # posterior summary and diagnostics
summary(m, prob = 0.9)$table
coef(m, "occ")
predict(m, newdata = data.frame(x = c(-1, 0, 1)), process = "occ")
loo(m)
draws <- as_draws_df(m)
} # }