The discrepancy-statistic check (the spOccupancy ppcOcc construction):
latent occupancy is drawn from its full conditional, a detection replicate
from the fitted model, and the two are compared through a discrepancy
statistic to give a Bayesian p-value. This is a test, not a plot, so it is
its own generic rather than a method on tulpa::pp_check(), which draws the
graphical check.
Usage
ppc(object, ...)
# S3 method for class 'tobs_fit'
ppc(object, fit.stat = c("freeman-tukey", "chi-squared"), n.samples = 500, ...)Examples
# \donttest{
sim <- simulate_occu(N = 60, J = 3, seed = 1)
fit <- tobs(~ occ_cov1, data = sim$data, family = occu(),
detection = ~ det_cov1, y = sim$y, method = "laplace",
control = list(verbose = FALSE))
ppc(fit, n.samples = 100)$bayesian.p
# }