Estimate animal population density with data from an array of passive
detectors (traps) by fitting a spatial detection model by maximizing the
likelihood. Data must have been assembled as an object of class
capthist
. Integration is by summation over the grid of points in
mask
.
secr.fit (capthist, model = list(D~1, g0~1, sigma~1), mask = NULL, buffer = NULL,
CL = FALSE, detectfn = NULL, binomN = NULL, start = NULL, link = list(),
fixed = list(), timecov = NULL, sessioncov = NULL, hcov = NULL,
groups = NULL, dframe = NULL, details = list(), method =
"Newton-Raphson", verify = TRUE, biasLimit = 0.01, trace = NULL,
ncores = 1, ...)
capthist
object including capture data and detector (trap) layout mask
object or (for a multi-session analysis) a list of mask
objects, one for each sessionmask
not specified
(default 100 m)secr
object from which they may be derived formula
notation covariates
attribute of capthist
. verify
secr.fit
returns an object of class secr. This has
componentssecr.design.MS
)secr.design.MS
)model
nlm
or
optim
) secr.fit
fits a SECR model by maximizing the likelihood. The
likelihood depends on the detector type ("multi", "proximity", "count",
"polygon" etc.) of the traps
attribute of capthist
(Borchers and Efford 2008, Efford, Borchers and Byrom 2009, Efford,
Dawson and Borchers 2009, Efford 2011). The `multi' form of the
likelihood is also used, with a warning, when detector type = "single"
(see Efford et al. 2009 for justification).
The default model
is null (model = list(D~1, g0~1,
sigma~1)
for detectfn = 'HN'
and CL = FALSE
), meaning
constant density and detection probability). The set of variables
available for use in linear predictors includes some that are
constructed automatically (t, T, b, B, bk, Bk, k, K), group (g), and
others that appear in the covariates
of the input data. See also
usage
for varying effort, timevaryingcov
to
construct other time-varying detector covariates, and secr models
and ../doc/secr-overview.pdf for more on
defining models.
buffer
and mask
are alternative ways to define the region
of integration (see mask). If mask
is not specified then a
mask of type "trapbuffer" will be constructed automatically using the
specified buffer width in metres.
hcov
is used to define a hybrid mixture model, used especially to
model sex differences (see hcov
). (Allows some animals to
be of unknown class).
The length of timecov
should equal the number of sampling
occasions (ncol(capthist)
). Arguments timecov
,
sessioncov
and groups
are used only when needed for terms
in one of the model specifications. Default link
is list(D="log",
g0="logit", sigma="log")
.
If start
is missing then autoini
is used for D, g0
and sigma, and other beta parameters are set initially to arbitrary
values, mostly zero. start
may be a previously fitted model. In
this case, a vector of starting beta values is constructed from the old
(usually nested) model and additional betas are set to zero. Mapping of
parameters follows the default in score.test
, but user
intervention is not allowed. From 2.10.0 the new and old models need not
share all the same `real' parameters, but any new real parameters, such
as `pmix' for finite mixture models, receive a starting value of 0 on
the link scale (remembering e.g., invlogit(0) = 0.5 for parameter `pmix').
binomN
(previously a component of details
) determines the
distribution that is fitted for the number of detections of an individual
at a particular detector, on a particular occasion, when the detectors
are of type `count', `polygon' or `transect':
NegBinomial
The default with these detectors is to fit a Poisson distribution. The
`size' parameter of the negative binomial is not estimated: it must be
supplied. binomN
should be an integer unless negative.
details
is used for various specialized settings listed below. These are
described separately - see details
.
autoini | session to use for starting values (default 1) |
centred | centre x-y coordinates |
chat | overdispersion of sighting counts Tu, Tm |
chatonly | compute overdispersion for Tu and Tm, then exit |
distribution | binomial vs Poisson N |
fixedbeta | specify fixed beta parameter(s) |
hessian | variance method |
ignoreusage | override usage in traps object of capthist |
intwidth2 | controls optimise when only one parameter |
knownmarks | known or unknown number of marked animals in sighting-only model |
LLonly | compute one likelihood for values in start |
miscparm | starting values for extra parameters fitted via userdist function |
nsim | number of simulations to compute overdispersion |
param | optional parameterisation code |
savecall | optionally suppress saving of call |
telemetrytype | treat telemetry data as independent, dependent or concurrent |
normalize | rescale detection to individual range use |
usecov | spatial covariate of use for normalization |
userdist | user-provided distance function or matrix |
A mark-resight model is fitted if the markocc
attribute of the capthist
`traps' object includes sighting occasions. See the vignette
http://www.otago.ac.nz/density/pdfs/secr-markresight.pdf
for a full account.
If method = "Newton-Raphson"
then nlm
is
used to maximize the log likelihood (minimize the negative log
likelihood); otherwise optim
is used with the
chosen method ("BFGS", "Nelder-Mead", etc.). If maximization fails a
warning is given appropriate to the method.
From secr 2.5.1, method = "none"
may be used to skip likelihood
maximization and compute only the hessian for the current dataset at the
values in start, and the corresponding variance-covariance matrix of
beta parameters. The computation uses fdHess from nlme.
If verify
= TRUE then verify
is called to check
capthist and mask; analysis is aborted if "errors" are found. Some
conditions that trigger an "error" are benign (e.g., no detections in
some sessions of a multi-session study of a sparse population); use
verify = FALSE
to avoid the check. See also Note.
If buffer
is used rather than mask
, and biasLimit
is valid, then the estimated density is checked for bias due to the
choice of buffer. A warning is generated when buffer
appears
to be too small (predicted RB(D-hat) > biasLimit
, default 1%
relative bias). The prediction uses bias.D
. No check
is performed when mask
is specified, when biasLimit
is 0,
negative or NA, or when the detector type is "polygon", "transect",
"polygonX" or "transectX".
If ncores > 1
the parallel package will be used to create
processes on multiple cores (see Parallel for more). Specifying
extra cores may improve the speed of multi-session analyses (it may also
slow them down, as data must be copied back and forth). There is
presently no benefit for single-session analyses.
Function par.secr.fit
is an alternative and more effective
way to take advantage of multiple cores when fitting several models.
Borchers, D. L. and Efford, M. G. (2008) Spatially explicit maximum likelihood methods for capture--recapture studies. Biometrics 64, 377--385.
Efford, M. G. (2004) Density estimation in live-trapping studies. Oikos 106, 598--610.
Efford, M. G. (2011) Estimation of population density by spatially explicit capture--recapture with area searches. Ecology 92, 2202--2207.
Efford, M. G., Borchers D. L. and Byrom, A. E. (2009) Density estimation by spatially explicit capture--recapture: likelihood-based methods. In: D. L. Thompson, E. G. Cooch and M. J. Conroy (eds) Modeling Demographic Processes in Marked Populations. Springer. Pp. 255--269.
Efford, M. G., Dawson, D. K. and Borchers, D. L. (2009) Population density estimated from locations of individuals on a passive detector array. Ecology 90, 2676--2682.
Detection functions,
AIC.secr
,
capthist
,
details
,
derived
,
hcov
,
mask
,
par.secr.fit
,
predict.secr
,
print.secr
,
region.N
,
Speed tips
Troubleshooting
userdist
usage
,
vcov.secr
,
verify
,
## Not run: ------------------------------------
#
# ## construct test data (array of 48 `multi-catch' traps)
#
# detectors <- make.grid (nx = 6, ny = 8, detector = "multi")
# detections <- sim.capthist (detectors, popn = list(D = 10,
# buffer = 100), detectpar = list(g0 = 0.2, sigma = 25))
#
# ## fit & print null (constant parameter) model
# secr0 <- secr.fit (detections)
# secr0 ## uses print method for secr
#
# ## compare fit of null model with learned-response model for g0
#
# secrb <- secr.fit (detections, model = g0~b)
# AIC (secr0, secrb)
#
# ## typical result
#
# ## model detectfn npar logLik AIC AICc dAICc AICwt
# ## secr0 D~1 g0~1 sigma~1 halfnormal 3 -347.1210 700.242 700.928 0.000 0.7733
# ## secrb D~1 g0~b sigma~1 halfnormal 4 -347.1026 702.205 703.382 2.454 0.2267
## ---------------------------------------------
Run the code above in your browser using DataLab