Spatially Explicit Capture-Recapture

Functions to estimate the density and size of a spatially distributed animal population sampled with an array of passive detectors, such as traps, or by searching polygons or transects. Models incorporating distance-dependent detection are fitted by maximizing the likelihood. Tools are included for data manipulation and model selection.


Changes in version 3.2.0 (2019-01-25)

New features or changed behaviour of old functions o derivednj() extended for weighted variance (R2, R3), with subtle argument changes o derivednj() and dependent functions return 2-line dataframe (rows 'esa', 'D') as for derived() o derivedSession() extended for weighted variance o derivedCluster() extended for weighted variance o derived() for secr and secrlist objects acquires argument 'bycluster' o split method for mask objects (split.mask) o trap.builder() new edgemethod and exclmethod options "anyinside", "centreinside" etc. o derived.secr() improved handling of sessions with zero detections o derivedSystematic() implements Fewster 2011 variance for systematic cluster designs o make.systematic() acquires argument "chequerboard", saves originbox, argument 'originoffset' replaces 'bufferorigin' o spacing.traps() returns numeric(0) instead of NULL for 1-trap arrays o write.traps() removed single quotes around objectname o allows mixture models when detector 1 unused on occasion 1 o make.mask() more explicit warning when nrow = 0 o plot.traps() gridlines = TRUE respected for add = TRUE (default gridlines = !add) o pdot.contour() and related functions acquire argument 'poly.habitat' o summary method for capthist objects (summary.capthist) optionally reports movements

Bugs fixed o make.systematic() grid didn't span extremes of some region polygons o sighting-only did not allow unidentified marked sightings o reduce.traps() failed for reduced number of occasions when both usage and markocc specified

Changes in version 3.1.8 (2018-11-19)

New features or changed behaviour of old functions o make.systematic() saves origin and centres as attributes o make.systematic() new argument bufferorigin controls random origin o summary method for secr objects, with print and AIC methods for summary (may change) o clone.popn() rownames consistent with clone.capthist() (1.1, 1.2...)

Bugs fixed o make.mask() not using keep.poly and check.poly arguments for multi-session masks o detector usage not correctly included in some models with detector type "multi" o clone methods not robust - freq now rounded to avoid quirky behaviour of rep()

Other o some models (e.g., g0~bk with detector type "multi") fit more quickly than before

Changes in version 3.1.7 (2018-10-03)

New features or changed behaviour of old functions o esa.plot() computes CVpdot for varying buffer width o esa.plot 'as.density' argument replaced with 'type' and new argument 'conditional' o sim.popn() edgemethod new options 'stop' and 'reflect'

Bugs fixed o OVpossumCH dataset Ageclass covariate placed 1-year-olds in >=2 year class o join() detector attribute not expanded correctly for some inputs o reduce.capthist() bug introduced in 3.1.6 o subset.popn() failed for multi-session populations o region.N() gave misleading R.N for models with individual variation in detection, including h2 o trap.builder() failed when projection specified for 'region' o addTelemetry() failed with mark-resight data o write.capthist() lost non-numeric detector names (since 2017-11-30)

Other o secr-manual.pdf is no longer distributed with package - see or

Changes in version 3.1.6 (2018-05-14)

New features or changed behaviour of old functions o sim.popn() details (turnover) argument "wrap" deprecated; use "edgemethod" o plot method for capthist object copes with missing rownames o CVpdot() new function for CV of p. across mask o improved handling of attributes (intervals and sessionlabels) in subset and reduce methods for capthist objects o join() allows site matching by name, which is faster o timevaryingcov() extended to capthist objects for openCR - see ?join

Bugs fixed o internal fn predictD returned matrix instead of vector, causing problems in region.N o sim.capthist() failed for signal detectors (df0 error reported by Ben S)

Changes in version 3.1.5 (2018-02-25)

New features or changed behaviour of old functions o rotate method for capthist objects o secrlist() returns input secrlist object unchanged o plotMaskEdge() accepts multi-session input o secr.make.newdata() rewritten; acquires logical argument 'all.levels' o predict method for secr objects passes dots argument to secr.make.newdata() o join() intervals optionally passed as attribute 'intervals' o coef method for secrlist objects o unRMarkInput() assumes all freq = 1 if freq field missing o new detectfn 19 (HVP hazard variable power) o RMarkInput ignores 'covariates' argument when no covariates o reduce and subset methods for capthist objects allow nonspatial input and output when verify = FALSE o reduce and subset methods for capthist objects honour 'intervals' attribute o summary method for nonspatial capthist objects drops detectors from table of counts o plot method for popn objects acquires new arguments for overlaying multiple sessions o sim.popn() argument sigma.m < 0 causes random relocation o sim.popn() open population recruitment model "multinomial" o LLsurface now a generic function with method for 'secr' objects o new capthist attribute 'sessionlabels' useful for joined capthist

Bugs fixed o gave misleading estimates with binomial count data when size derived from usage (reported by Mathias Tobler) o predict.secr misreported pmix for other than simple h2 models (pmix = 0.5 for some levels) o detectfnplot() in error when detectfn = 'HAN' o sim.capthist() and sim.resight() failed in 3.1.3 when detector type varied by occasion o make.poly() failed with some polygon list inputs

Other o optional 'interval' attribute of capthist objects renamed 'intervals' (see ?join) o export internal function insertdim() o minor tweaks for compatibility with open population code o NEWS for versions before 3.0.0 archived o some old documentation removed to online vignette secr-models.pdf

Changes in version 3.1.3 (2017-12-02)

New features or changed behaviour of old functions o acquires argument 'contrasts' (used internally)

Bugs fixed o sim.capthist() ignored recapfactor provided in detectpar

Other o region.N now a generic method with functions for secr and secrlist objects o corrected some obsolete documentation references to maptools package

Changes in version 3.1.1 (2017-11-30)

New features or changed behaviour of old functions o new detector type 'capped' in make.grid(), sim.capthist(), reduce(), verify(), etc. o methods for capthist and traps objects o secrlist() and MS.capthist() generate names from input objects o circular.r() and circular.p() acquire argument 'upper' for explicit upper limit of integration o LR.test generalised to any fitted models with a logLik method o plot method for secr objects: confidence limits now computed on log scale for hazard detectfn HHN, HEX etc. to match predict.secr o rbind method for traps adds suffix to names only when needed to avoid any duplication o verify method for capthist objects checks for all-zero histories and missing rownames o summary method for capthist objects: 'terse' option activated for single-session objects o subset method for capthist objects: subset may be defined as function (useful for covariate-based selection) o join() acquires arguments interval, to set between-session intervals directly, and sessions, for session names o details argument 'contrasts' for specialised coding of factor predictors (example in secr-multisession.pdf) o details argument 'newdetector' to override detector type o 'newdetector' reported by print.secr

Bugs fixed o predict method for secr objects failed to report SE for parameters with some fixed coefficients (fixedbeta) o verify.capthist failed to report detections at unused detectors

Other o requires package stringr for some functions o class attribute of multisession objects changed to place "list" last -- c("list", "capthist") becomes c("capthist", "list") o LLsurface.secr automatically substitutes lambda0 for g0 given detectfn 14:18 o experimental "nontarget" capthist attribute o make.mask() explicit error when capthist passed o derived is now a generic method with functions for secr and secrlist objects o derived.nj() renamed derivednj(), derived.mash() renamed derivedMash() etc. o && changed to & throughout - should have no effect except fixes verify bug, but be wary

Changes in version 3.1.0 (2017-09-20)

New features or changed behaviour of old functions o acquires arguments save.intermediate and LB to allow load balancing (thanks to Mathias Tobler) o default value of 'seed' changed from 123 to NULL o rbind.popn() now an S3 method; no longer accepts list input o rbind.capthist() now an S3 method o randomHabitat() acquires argument 'seed', saved as an attribute (thanks to Erin Peterson) o detectfnplot() acquires argument 'hazard' for plotting hazard

Other o adjustment to 'ts' predictor for mark-resight models o documentation of random number seeds in ?secrRNG o start vector returned by now named

Bugs fixed o faulty start vector when model included both h2 and noneuc

Changes in version 3.0.2 (2017-06-07)

New features or changed behaviour of old functions o make.grid() and acquire argument 'markocc' o read.traps() accepts Excel xls or xlsx input (requires readxl)

Bugs fixed o plot.secr misleading axis label 'Detection lambda' o sim.resight() could fail with markingmask and predefined popn

Other o imports file_ext from tools package o attributes of output from sim.popn now include Nbuffer and D o speed increase for "count" detectors o miinor adjustments to sim.popn for compatibility R 3.4.0

Changes in version 3.0.1 (2017-05-03)

New features or changed behaviour of old functions o 'unresolved' sightings now stored in Tn attribute of capthist o sim.resight() acquires argument 'unresolved' o plot.secrlist() accepts colour vector o new function as.mask() to coerce traps objects for plotting o moves() acquires argument 'names' to control sort order (new default)

Bugs fixed o sightingPlot() legend ignored fill argument

Documentation o addTelemetry omitted 'single' and 'multi' from permitted detectionCH types

Other o discretize() updated for 3.0 o native routine registration completed

Changes in version 3.0.0 (2017-04-11)

New features or changed behaviour of old functions o 3-D data structure used for trapping data o updateCH() for easy conversion of old data o multiple detector types may be used in one session (point detectors only: single, multi, proximity or count) o marking and sighting occasions may be interspersed o rbind.traps acquires argument 'checkdetector' o user-provided distance matrix may be session-specific o esa 'noccasions' may be less than ncol(usage) o function occasionKey() to embellish petal plots o explicit handling of 'uncertain' sightings Tn o plotMCP() now works with data from point detectors o details$debug in now integer with multiple levels o sightingPlot() new function o plot.capthist() new option "centres" o argument 'details' may be given as character value o telemetrytype attribute of traps objects replaces details$telemetrytype o new addTelemetry() function and revised handling of telemetry data o addTelemetry() allows multi-session data o etc. auto predictor 'tt' nontelemetry vs telemetry occasions o addCovariates() acquires argument 'replace' o c new method for combining secrlist objects o make.capthist() discards repeat detections at exclusive detectors, with a warning o models for polygon or transect detectors requre hazard detection functions o esa.plot() accepts secrlist as input (curves overlaid) o acquires argument 'prefix' o predict.secr() acquires argument 'realnames' to select a subset of 'real' parameters

Bugs fixed o make.grid() did not assign polyID attribute for polygon detectors o snip() and discretize() for transects dropped occasions with no detections o sim.capthist() failed when 'userdist' supplied (non-Euclidean distances)

Other o ovenbird dataset provided with detector type "proximity" o esa() more robust to variation when noccasions specified o new details option 'splitmarked' for resightings (default FALSE) o usagePlot() argument occasion renamed occasions o more compact 'call' component of output o discontinued warning when detectfn requires changed parameters (g0 -> lambda0) o plot method for traps enables box around plot (bty = 'o') o plotMaskEdge faster o details savecall = FALSE suppresses call (default in o new function shareFactorLevels() to force factor covariates to use the same levels o rgdal::readOGR used instead of deprecated maptools::readShapeSpatial o minor speed improvments for models without learned response o ip.secr() faster default predictorfn

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


4.2.2 by Murray Efford, 3 months ago

Browse source code at

Authors: Murray Efford

Documentation:   PDF Manual  

Task views: Analysis of Ecological and Environmental Data

GPL (>= 2) license

Imports abind, graphics, grDevices, MASS, utils, parallel, nlme, sp, mgcv, raster, stats, tools, stringr, Rcpp, RcppParallel, RcppNumerical

Depends on methods

Suggests maptools, spsurvey, rgdal, knitr, gdistance, rgeos, readxl, rmarkdown

Linking to Rcpp, RcppParallel, RcppEigen, RcppNumerical

System requirements: GNU make

Imported by BBRecapture, camtrapR.

Depended on by openCR, secrdesign, secrlinear.

Suggested by wiqid.

See at CRAN