
Last chance! 50% off unlimited learning
Sale ends in
expected.n(object, session = NULL, group = NULL, bycluster
= FALSE, splitmask = FALSE)
secr
object output from secr.fit
object$mask
. $p.(X)$ is the probability an
individual at $X$ will be detected at least once either on the
whole detector layout (bycluster = FALSE
) or on the detectors
in a single cluster (see pdot for more on $p.$). $D(X)$
is the expected density at $X$, given the model. $D(X)$ is
constant (i.e. density surface flat) if object$CL == TRUE
or
object$model$D == ~1
, and for some other possible models.
If the bycluster
option is selected and detectors are not, in
fact, assigned to clusters then each detector will be treated as a
cluster, with a warning.
By default, a full habitat mask is used for each cluster. This is the
more robust option. Alternatively, the mask may be split into subregions
defined by the cells closest to each cluster.
The calculation takes account of any fitted continuous model for spatial
variation in density (note Warning).region.N
expected.n(secrdemo.0)
expected.n(secrdemo.0, bycluster = TRUE)
expected.n(ovenbird.model.D)
## Clustered design
mini <- make.grid(nx = 3, ny = 3, spacing = 50, detector =
"proximity")
tempgrids <- trap.builder (cluster = mini , method = "all",
frame = expand.grid(x = seq(1000, 9000, 2000),
y = seq(1000, 9000, 2000)), plt = TRUE)
capt <- sim.capthist(tempgrids, popn = list(D = 2))
tempmask <- make.mask(tempgrids, buffer = 100,
type = "clusterbuffer")
fit <- secr.fit(capt, mask = tempmask, trace = FALSE)
En <- expected.n(fit, bycluster = TRUE)
## GoF or overdispersion statistic
p <- length(fit$fit$par)
y <- cluster.counts(capt)
## scaled by n-p
sum((y - En)^2 / En) / (length(En)-p)
sum((y - En)^2 / En) / sum(y/En)
Run the code above in your browser using DataLab