The test statistic(s) may be computed either on a dataset or on a
fitted model, as determined by the argument fit
. The single
argument expected by statfn
should be either a `capthist' object
(fit = FALSE
) or an `secr' object (fit = TRUE
).
The default statistic when fit = FALSE
is the proportion of
individuals observed on only one occasion, which is equivalent to
statfn = function(CH) c(f1 = sum(apply(abs(CH) > 0,1,sum) == 1) /
nrow(CH))
. Repeat detections on one occasion at the same or different
detectors are not counted. The default statistic is therefore not
appropriate for some data, specifically from `count' or `polygon'
detectors with few occasions or only one.
The default statistic when fit = TRUE
is the deviance divided by
the residual degrees of freedom (i.e., statfn = function(object)
c(devdf = deviance(object) / df.residual(object))
).
The reported probability (p) is the rank of the observed value in the
vector combining the observed value and simulated values, divided by
(nsim + 1). Ranks are computed with rank
using the default
ties.method = "average"
.
Simulations take account of the usage attribute of detectors in the
original capthist object, given that usage was defined and ignoreusage was not
set.
Setting ncores = NULL
uses the existing value from the environment variable
RCPP_PARALLEL_NUM_THREADS (see setNumThreads
).
statfn
may return a vector of statistics for each observed or
simulated dataset or model: then the value of each statistic will be
calculated for every simulated dataset, and summarised. If fit =
TRUE
the vector of statistics may include both those computed on the
raw data (object$capthist) and the fitted model.