mb_stat: Compare observed detection numbers to expected

View source: R/EdetMackenzieBailey.R

mb_statR Documentation

Compare observed detection numbers to expected

Description

Expected detections compared to observed detections can be used to test model fit (see MacKenzie and Bailey (2004) and Lemeshow, Sturdivant, Hosmer et al (2013)). Note that the latter suggest that the p-value for the test is not very useful for comparing different models. This function follows MacKenzie and Bailey (2004) by using cohorts given by sites with the same number of survey visits. We further define cohorts by each species.

Usage

mb_stat(fit, nperdraw = 2, seed = 122, simulations = NULL)

Details

For each draw simulates LV twice and simulates detections for each of these once. The expected number of detections is based on the assumpation that the full posterior is correct (and thus averages across posterior draws). The distribution of test statistic according to the full posterior is obtained by simulation of the observations.

Examples

fit <- readRDS("../sflddata/private/data/testdata/cutfit_7_4_11_2LV.rds")
fit <- translatefit(fit)
X2 <- mb_stat(fit)

sustainablefarms/msod documentation built on March 6, 2023, 7:17 a.m.