# autoini: Initial Parameter Values for SECR In secr: Spatially Explicit Capture-Recapture

## Description

Find plausible initial parameter values for `secr.fit`. A simple SECR model is fitted by a fast ad hoc method.

## Usage

 ```1 2``` ```autoini(capthist, mask, detectfn = 0, thin = 0.2, tol = 0.001, binomN = 1, adjustg0 = TRUE, ignoreusage = FALSE) ```

## Arguments

 `capthist` `capthist` object `mask` `mask` object compatible with the detector layout in `capthist` `detectfn` integer code or character string for shape of detection function 0 = halfnormal `thin` proportion of points to retain in mask `tol` numeric absolute tolerance for numerical root finding `binomN` integer code for distribution of counts (see `secr.fit`) `adjustg0` logical for whether to adjust g0 for usage (effort) and binomN `ignoreusage` logical for whether to discard usage information from `traps(capthist)`

## Details

Plausible starting values are needed to avoid numerical problems when fitting SECR models. Actual models to be fitted will usually have more than the three basic parameters output by `autoini`; other initial values can usually be set to zero for `secr.fit`. If the algorithm encounters problems obtaining a value for g0, the default value of 0.1 is returned.

Only the halfnormal detection function is currently available in `autoini` (cf other options in e.g. detectfn and `sim.capthist`).

`autoini` implements a modified version of the algorithm proposed by Efford et al. (2004). In outline, the algorithm is

1. Find value of sigma that predicts the 2-D dispersion of individual locations (see `RPSV`)

2. Find value of g0 that, with sigma, predicts the observed mean number of captures per individual (by algorithm of Efford et al. (2009, Appendix 2))

3. Compute the effective sampling area from g0, sigma, using thinned mask (see `esa`)

4. Compute D = n/esa(g0, sigma), where n is the number of individuals detected

Here ‘find’ means solve numerically for zero difference between the observed and predicted values, using `uniroot`.

If `RPSV` cannot be computed the algorithm tries to use observed mean recapture distance d-bar. Computation of d-bar fails if there no recaptures, and all returned values are NA.

If the mask has more than 100 points then a proportion 1–`thin` of points are discarded at random to speed execution.

The argument `tol` is passed to `uniroot`. It may be a vector of two values, the first for g0 and the second for sigma.

If `traps(capthist)` has a usage attribute (defining effort on each occasion at each detector) then the value of g0 is divided by the mean of the non-zero elements of usage. This adjustment is not precise.

If `adjustg0` is TRUE then an adjustment is made to g0 depending on the value of `binomN`. For Poisson counts (`binomN = 0`) the adjustment is linear on effort (adjusted.g0 = g0 / usage). Otherwise, the adjustment is on the hazard scale (adjusted.g0 = 1 – (1 – g0) ^ (1 / (usage x binomN))). An arithmetic average is taken over all non-zero usage values (i.e. over used detectors and times). If usage is not specified it is taken to be 1.0.

## Value

A list of parameter values :

 ` D ` Density (animals per hectare) ` g0 ` Magnitude (intercept) of detection function ` sigma ` Spatial scale of detection function (m)

## Note

`autoini` always uses the Euclidean distance between detectors and mask points.

You may get this message from secr.fit: “'autoini' failed to find g0; setting initial g0 = 0.1”. If the fitted model looks OK (reasonable estimates, non-missing SE) there is no reason to worry about the starting values. If you get this message and model fitting fails then supply your own values in the start argument of secr.fit.

## References

Efford, M. G., Dawson, D. K. and Robbins C. S. (2004) DENSITY: software for analysing capture–recapture data from passive detector arrays. Animal Biodiversity and Conservation 27, 217–228.

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.

`capthist`, `mask`, `secr.fit`, `dbar`

## Examples

 ```1 2 3 4``` ```demotraps <- make.grid() demomask <- make.mask(demotraps) demoCH <- sim.capthist (demotraps, popn = list(D = 5, buffer = 100), seed = 321) autoini (demoCH, demomask) ```

### Example output

```This is secr 3.0.1. For overview type ?secr
\$D
[1] 8.237338

\$g0
[1] 0.2415066

\$sigma
[1] 21.2132
```

secr documentation built on Dec. 3, 2017, 5:03 p.m.