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 = 100, CL = FALSE, detectfn = NULL,
start = NULL, link = list(), fixed = list(),
timecov = NULL, sessioncov = NULL, groups = NULL, dframe = NULL,
details = list(), method = 'Newton-Raphson', verify = TRUE, trace = NULL, ...)capthist object including capture data and detector (trap) layoutmask objectmask not specifiedsecr object from which they may be derivedformula notationcovariates attribute of capthist.verifysecr.fit returns an object of class secr. This has componentssecr.design.MS)secr.design.MS)modelnlm or optim)secr.fit fits a SECR model by maximizing the likelihood. The
likelihood depends on the detector type ('multi' or 'proximity') of the
'traps' attribute of capthist (Borchers and Efford 2008,
Efford, Borchers and Byrom 2009, Efford, Dawson and Borchers 2009). The
'multi' form of the likelihood is also used, with a warning, when
detector type = 'single' (see Efford et al. 2009). Default model
is null (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), group (g), and others that appear
in the covariates of the input data. See secr models for
more on defining models.
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 nested
model. In this case, a vector of starting beta values is constructed
from the nested model and additional betas are set to zero. Mapping of
parameters follows the default in score.test, but user
intervention is not allowed.
details is used for various specialized settings --
details$distribution specifies the distribution of the number of
individuals detected; this may be conditional on the number in the
masked area ('binomial') or unconditional ('poisson').
distribution affects the sampling variance of the estimated
density. The default is 'poisson'.
details$hessian is a character string controlling the computation
of the Hessian matrix from which variances and covariances are obtained.
Options are 'none' (no variances), 'auto' (the default) or 'fdhess' (use
the function fdHess in details$LLonly = TRUE causes the function to returns a single
evaluation of the log likelihood at the 'start' values.
details$scalesigma = TRUE causes sigma to be scaled by
$\mathrm{D}^{-0.5}$.
details$scaleg0 = TRUE causes g0 to be scaled by
$\mathrm{sigma}^{-2}$. The corresponding 'real' parameters
are marked with an asterisk in output (e.g. g0*).
If method = 'Newton-Raphson' then nlm is
used to maximize the log likelihood; otherwise
optim is used with the chosen method
('BFGS','Nelder-Mead', etc.). A feature of nlm is that it takes a
large step early on in the maximization that may cause floating point
underflow or overflow in one or more real parameters. This can be
controlled by passing the 'stepmax' argument of nlm in the ...argument of secr.fit (see first example).
If verify = TRUE then verify is called to check
capthist and mask; analysis is aborted if errors are found.capthist, mask, detection functions,
print.secr, vcov.secr, AIC.secr,
derived, predict.secr, verify## 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
## stepmax is passed to nlm (not usually needed)
secr0 <- secr.fit (detections, stepmax = 50)
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.2267Run the code above in your browser using DataLab