Changes in version 5.4.3 (2026-05-26)

New features or changed behaviour of old functions
    o  boundarytoSF() acquires ... args
    o  fillNA() new utility function to replace missing covariate values
    o  binCovariate() acquires arguments 'breaks' (factor output) and 'replace'

Other
    o  protect against integer overflow in C++ makegk

Changes in version 5.4.2 (2026-02-24)

New features or changed behaviour of old functions
    o  none

Bugs fixed
    o  Dlambda broken in 5.3.0, 5.4.1

Other
    o  region.N() warning for binomial fitted model

Changes in version 5.4.1 (2026-01-10)

New features or changed behaviour of old functions
    o  make.grid() acquires logical argument 'centre' (centre on 'originxy')

Bugs fixed
    o  addCovariates failed with some polygon input (points on boundary?)
    o  esa.secr failed with non-point detectors when 'real' specified
    o  append.capthist() failed with some values of 'usage' attribute

Other
    o  does not use RcppNumerical, RcppEigen directly
    o  polygon functions imported from new package secrfunc
    o  alias some function names to protect reverse dependencies ipsecr, openCR

Changes in version 5.3.0 (2025-09-27)

New features or changed behaviour of old functions
    o  models for spatial variation in sigma (sigmaxy) and lambda0 (lambda0xy)
    o  multi-session relative density models condition on sum(session-n), 
       using multinomial session-n.
    o  derivedDfit() new function complements derivedDcoef()
    o  t2r2() index of serial correlation
    o  simOU() and simOU.capthist() moved from secrdesign
    o  simOU() allows matrix or dataframe input (e.g. popn) 
    o  secr.refit() computes variances for relative density model 
       (set args CL = FALSE, method = "none") when no individual covariates
           
Bugs fixed
    o  print method failed for Dsurface generated from 'nonueuc' parameter
    o  collate() failed for models fitted with fixed beta parameters
    o  an individual covariate 'g' formed automatically as the interaction of 
       named covariates (the 'groups' argument of secr.fit) produced 
       inconsistent results owing to the mis-assignment of factor levels. 
       See GitHub Issue for more
    o  AIC method for fitted secr objects failed when the first object was one 
       component of a list ("Error in names(allargs) <- modelnames" etc.)
    o  Dlambda parameterization sometimes added spurious beta
    o  write.captures() and write.traps() ignored covariates = FALSE
    
Other
    o  secr.fit() model argument defaults to list() 
    o  sim.secr() start argument now defaults to 'true'
    o  update secr-package.Rd
    o  many internal functions renamed with prefix 'secr_' 
    o  bufferBiasCheck() exported
    o  derivedDcoef() extended to multi-session relative density and now a 
       generic with methods for secr, secrlist
    o  sim.popn() mechanism for generating individual covariates extended to 
       multi-session populations

Changes in version 5.2.4 (2025-06-03)

New features or changed behaviour of old functions
    o  sim.popn() can now simulate fixed population size (Ndist = 'fixed') 
       with model 'rLGCP' and 'rThomas' using the conditional algorithms in 
       spatstat 3.3-3. 
    o  chat.nj() computes a variance inflation factor for a density model 
       fitted to replicate spatial samples

Bugs fixed
    o  sim.capthist() with multi-session popn input failed when the first 
       popn had zero rows
    o  derivedDsurface() had trouble with mask covariates
    o  sim.popn() sometimes failed if D was a character value

Other
    o  test using suggested package 'spsurvey' now conditional
    o  sim.popn() allows a function used to specify density (argument D) to 
       be given by name (i.e. as a character value).
    o  adjustVarD() chat does not default to chat.nk
    o  derivedCluster(), derivedSession() esa, se.esa imputed when nj = 0
    o  remove problematic url for NZ J Ecology paper

Changes in version 5.2.1 (2025-03-18)

New features or changed behaviour of old functions
    o  secr.fit() saveprogress details option
    o  secr.refit() new function

Bugs fixed
    o  sim.detect() mishandled miscparm (as used by userdist fn etc.)
    o  secr.fit() auto-generated multisession mask had class 'list'; 
       class should have been c('mask','list') to pass verify() downstream

Changes in version 5.2.0 (2025-01-24)

New features or changed behaviour of old functions
    o  allows models for relative density with CL = TRUE
    o  derivedDcoef() and derivedDsurface() for conditional D models
    
Bugs fixed
    o  addCovariates() generated spurious sf warning "attribute variables are 
       assumed to be spatially constant throughout all geometries "
    o  region.N() computation of R.N ignored varying density
    o  derived() miscounted number of individuals when animal with exactly one 
       capture was lost on another occasion, hence error in D-hat
    o  sim.capthist() generated captures at some 'unused' multi-catch traps
    
Other
    o  tweaked OVpossum Rd example to avoid 'sp' package
    o  split.xxxx() functions check for NA values in split factor
    o  externalqx undocumented details argument
    o  AICcompatible check moved from AIC.secr to AIC.secrlist
    o  many minor edits to allow relativeD
    o  added tests for relativeD
    
Changes in version 5.1.0 (2024-11-04)

New features or changed behaviour of old functions
    o  MCgof() acquires 'debug' argument
    o  makeNewData.secr acquires 'bytrap' argument
    o  fxTotal extended to mixture models
    o  split.capthist() acquires 'bysession' argument
    o  simulate.secr() acquires 'poponly' argument
    o  sim.popn() infers 'core' from bbox of 'poly' argument if missing

Bugs fixed
    o  MCgof() stalled in model with trap covariates (detectpar problem)
    o  MCgof() error when zero unobserved AC
    o  direct calling of fxi.secr() disabled prematurely in 5.0.0 
    o  simulate.secr() when D~1 generated AC in rectangular window instead of respecting mask 
    o  esaPlot() in 5.0.0 failed with multi-session model

Other
    o  predict.secr() speed up when se.fit = FALSE
    o  detectpar() speedup (calls predict.secr with se.fit = FALSE)
    o  suggest.buffer() rounds to 3 sig.fig. and more robust
    o  expose 'externalpdot' details option
    o  plot.capthist() warning when petal plot rad argument large
    o  plot.secrtest() allows user-specified xlab
    o  MCgof() dots argument passed to testfn

Changes in version 5.0.0 (2024-10-02)

New features or changed behaviour of old functions
    o  MCgof() goodness-of-fit after Choo et al. (2024) DOI: 10.1111/2041-210X.14386
    o  blackbearCH new dataset of J. Laufenberg, F. van Manen and J. Clark
    o  default criterion for AIC and modelAverage changed from AICc to AIC
    o  score.table reports dAIC rather than dAICc
    o  detectpar() optionally returns values for each detector
    o  pdot() accepts detector- and occasion-specific detection parameters
    o  usage() method for traps objects acquires argument 'noccasions' to create from scratch

Other
    o  internal addzeroCH() ignores covariate dataframe with zero columns
    o  improved robustness of fxi.secr by setting occasional NaN to zero
    o  imports from mvtnorm
    o  list.secr.fit() now works with details$LLonly = TRUE
    o  trappingtransect, trappingtransectX revert to built-in integration
    o  some minor functions restricted to point detectors (i.e. not area search)
       CVa, CVpdot, reparameterize.esa, make.mask(type=pdot)
    o  derivedSystematic() defunct
    o  purged unused code
    o  derived() uses nlme::fdHess for gradients
    o  esa(), fxTotal(), MCgof() become S3 generic
    o  unused HPX detectfn removed 
    o  fxi.secr() becomes S3 generic fxi() with method for secr objects
    o  other fxi.xxx functions renamed fxiXxx (old ones deprecated for now)
    o  pdot.contour and buffer.contour renamed pdotContour and bufferContour (old names deprecated for now)
    o  esa.plot() renamed to esaPlot() to avoid clash with generic
    
Changes in version 4.6.10 (2024-08-21)

New features or changed behaviour of old functions
    o  sim.detect() optionally computes expected counts or retains null histories

Other
    o  list.secr.fit() recovers when some fits fail
    o  added dots argument to secr.test(), passed to statfn
    o  added dots argument to sim.secr(), passed to extractfn
    o  secr.test() fit = TRUE trim keeps mask
    o  internal changes to sim.detect() may change output order
    o  include pmix in output of detectpar() from mixture models
    o  as.array method for capthist objects

Bugs fixed
    o   code for deviance of binomial model failed (broken for years)

Changes in version 4.6.9 (2024-06-29)

New features or changed behaviour of old functions
    o  none

Other
    o  added package anchor in Rd files when linking to sf and RcppParallel functions, to satisfy CRAN
    
Changes in version 4.6.8 (2024-06-28)

New features or changed behaviour of old functions
    o  none
    
Bugs fixed
    o   bug in likelihood for 'relativeD'

Changes in version 4.6.7 (2024-06-05)

New features or changed behaviour of old functions
    o  sim.popn() the covariates argument may specify a function to 
       construct covariates 
    o  sim.capthist() detectpar = list(individual = TRUE) uses individual 
       parameter values from popn covariates
    o  rlnormCV() is wrapper for rlnorm with inputs on the natural scale
    o  make.spcosa() new function for spatial coverage designs (Walvoort et al. 2010)
    o  append.capthist() new function to combine independent capthist

Bugs fixed
    o   rotate.traps added spurious polyID
    o   sim.capthist() with single,multi detectors did not respect 'renumber = FALSE'
    o   sim.popn() rLGCP saveLambda failed in one case

Other
    o   onLoad defaults to options()matprod = "internal"

Changes in version 4.6.6 (2024-03-01)

New features or changed behaviour of old functions
    o   list.secr.fit() replaces par.secr.fit()
    o   unRMarkInput() accepts '.' for missing

Deprecated
    o   functions par.secr.fit(), par.derived() and par.region.N() for parallel 
        processing of multiple models will be removed later in 2024

Bugs fixed
    o   detection models failed with polygon and transect detectors
    o   sim.popn() row numbering glitch (open population)

Changes in version 4.6.5 (2024-02-18)

New features or changed behaviour of old functions
    o   sim.popn() saves 'parents' and 'Lambda' attributes from rThomas
    o   relative density option 'relativeD'
    o   AICcompatible() checks for 'relativeD'
    o   secrlist acquires argument 'names'
    o   binCovariate() new function

Bugs fixed
    o   score.test() failed with condition length>1
    o   makeStart() failed with details$fixedbeta
    o   obscure reparameterizations param = 2,6 failed
    o   fxi.secr() did not allow polygon data
    o   static userdist not working

Other
    o   secr.fit() warns if factor levels inconsistent for covariates of 
        multi-session mask
    o   undocumented feature: details = list(externalpdot = 'pd') where 'pd'
        is the name of a mask covariate to substitute for internally computed 
        p.(x|theta)
    o   traps<- replacement function works for multi-session capthist

Changes in version 4.6.4 (2023-10-18)

New features or changed behaviour of old functions
    o   none

Other
    o   tweak kfn.Rd to reduce CRAN check time

Changes in version 4.6.3 (2023-10-17)

New features or changed behaviour of old functions
    o   sim.popn() simulates log-gaussian Cox process (model2D = "rLGCP") using 
        packages spatstat and RandomFields
    o   sim.popn() simulates Thomas process (model2D = "rThomas") using spatstat
    o   as.popn() converts spatstat ppp objects
    o   randomDensity() new wrapper for randomHabitat() for use with sim.popn()
    o   reduce.capthist() now retains popn attribute
    o   trend reparameterization of density (secr.fit details 'Dlambda')
    o   kfn() new function for overlap index

Bugs fixed
    o   make.capthist() could lose individual covariates of animals later 
        lost on capture (negative occasion number)

Other
    o   suggests spatstat, spatstat.geom, spatstat.random (LGCP), 
        and igraph (randomHabitat)
    o   randomHabitat() loads igraph automatically if needed
    o   imports raster::flip
    o   Fletcher.chat() returns NA instead of error when input NA
    o   sim.popn() argument 'number.from' applied to multi-session data
    o   sim.popn() details$clone=="constant" applies scale (model2D="cluster")" 
    o   secr.fit() distribution="binomial" warns when initial value of N less than number detected
    o   model.average() now defunct (replaced by modelAverage)
    o   LLsurface message edit
    o   secr.fit() attempt to use learned response with mark-resight data now blocked
    o   fixed \itemize in Rd files

Changes in version 4.6.1 (2023-07-10)

New features or changed behaviour of old functions
    o   collate() redefined as generic, behaviour mostly unchanged

Bugs fixed
    o   collate() failed if betanames specified for multi-session model (multi-row newdata)
    o   LR.test() failed when class of fitted models had length>1

Other
    o   read.traps() allows comma-separated usage values when binary.usage = FALSE
    o   sim.popn() handles IHP N=0 without crashing
    o   shift.mask() updates boundingbox
    o   chat.nk may use clusters in parallel for simulation
    o   internal boundarytoSF extended to sf geometry objects
    o   Fletcher.chat() protected against near-zero expected values

Bugs fixed
    o   secr.fit() crashed R for polygon data with hcov specified

Changes in version 4.6.0 (2023-05-22)

New features or changed behaviour of old functions
    o   exports Fletcher.chat(), nk()
    o   Enk() simulation option
    o   chat.nk() optionally simulates c-hat
    o   AIC and modelAverage methods acquire variance inflation argument 'chat'
        for optional computation of quasi-AIC etc.
    o   adjustVarD() acquires optional argument 'chat'

Bugs fixed
    o   make.capthist() lost covariates when creating non-spatial capthist

Other
    o   trim() method for secrlist objects
    o   chat.nk() 'stats' components renamed; sbar added
    o   Enk() (and hence chat.nk) works for multi-catch traps
    o   sim.popn() model2D 'cluster' has clone-in-place option
    o   fast computation of spacing (PR of Philipp Jund, now ctb)
    o   faster C++ for transect fitting (PR of Philipp Jund)

Changes in version 4.5.9 (2023-03-09)

New features or changed behaviour of old functions
    o   none

Bugs fixed
    o   secr.fit() fitted wrong model for Poisson count detectors when 
        fastproximity = FALSE, giving bad estimates esp. of detectfn parameters
    o   make.capthist() failed with points snapped to transects
    o   sim.popn() model2D 'cluster' mistakenly allowed Ndist = 'fixed'
    o   region.N() could fail with user-provided distance function or when 
        detectors varied among sessions

Other
    o   MS.capthist() help clarified
    o   ip.secr() and pfn() defunct
    o   secr.fit() recognises time-covariate model when timecov is a
        multi-session list, avoiding default to fastproximity

Changes in version 4.5.8 (2022-11-29)

New features or changed behaviour of old functions
    o   plot method for traps acquires argument 'frame'
    o   trapsPerAnimal() new capthist summary function
    o   Enk() new function expected individuals per detector
    o   chat.nk() and adjustVarD() new functions for spatial overdispersion
    o   summary method for capthist optionally includes frequency 
        distribution of traps per animal (count of tpa >= 2 if terse)
    o   sim.popn() with model2D = 'IHP' the density argument may be a function

Bugs fixed
    o   hcov failed with one level missing in some sessions
        (following change in 4.5.1)
    o   sim.secr() crashed R when used with learned-response models (b, B etc.)
    o   secr.fit() failed occasionally with distribution = 'binomial'
    o   randomHabitat(..., plt = TRUE) assumed raster::plot loaded
    o   spotHeight() not working

Other
    o   make.lacework limit of 5000 detectors
    o   plot.traps() box always black (bty='o')

Changes in version 4.5.7 (2022-10-08)

New features or changed behaviour of old functions
    o   nontarget() replacement function
    o   addCovariates() may be applied to popn object

Bugs fixed
    o   Tu<- replacement failed with multi-session capthist
    o   region.N erroneous values with new mask

Changes in version 4.5.6 (2022-08-13)

New features or changed behaviour of old functions
    o   sim.popn() model2D = 'IHP' allows session-specific density
    o   clone() new option type = 'truncatedpoisson'

Bugs fixed
    o   plot.mask legend sometimes failed ("object 'cex' not found")

Other
    o   for CRAN, update latex specials in help pages 
    o   nontarget documentation

Changes in version 4.5.5 (2022-05-31)

New features or changed behaviour of old functions
    o   verify.capthist() checks nontarget matrix if present
    o   plot.capthist() new type 'nontarget'
    o   gridCells() constructs cells around points (e.g., traps)

Bugs fixed
    o   make.systematic() failed because quantities from sf are class 'units'
    o   addCovariates could fail when source polygons overlap
    o   predictDsurface failed with user-provided density function and single-session 
    o   trap.builder() failed with edgemethod 'centreinside'

Other
    o   on GitHub at https://github.com/MurrayEfford/secr

Changes in version 4.5.4 (2022-04-22)

New features or changed behaviour of old functions
    o   reinstate GRTS option in trap.builder()
    o   makeStart() encapsulates code for initial values
    o   ip.secr() is deprecated (see new package at https://github.com/MurrayEfford/ipsecr)

Bugs fixed
    o   distancetotrap() and hence esa.plot() failed with polygon inputs
    o   addSightings() did not pass extra arguments to read.table() for multisession input
    o   secr.fit() failed with sighting data when usage 0 for any detector (since 4.4.6 Oct 2021)
    o   likelihood-only evaluation failed with mark-resight models if chat not initialised
    o   read.traps() failed for polygon or transect data with non-contiguous data points
    
Other
    o   suggests spsurvey >= 5.3.0 
    o   bad densities in likelihood give warning, not error
    o   autoini tweaked to treat 'capped' detector type as 'proximity'
    o   collate tweaked to allow mixture of secr, ipsecr models

Changes in version 4.5.3 (2022-02-14)

New features or changed behaviour of old functions
    o   more spatial data types for 'poly' and 'region' function arguments
    o   rast generic method for mask, Dsurface objects creates terra SpatRaster object
    o   read.traps() accepts ESRI shapefile of point, polygon or line features (experimental)
    o   fxi.contour() argument 'SPDF' replaced by 'output', with options 'sf', 'SPDF'

Bugs fixed
    o   moves() failed with empty capthist input when names = FALSE
    o   details$ignoreusage=TRUE not respected by esa(), derived(), region.N()
    o   secr.fit() details$ignoreusage=TRUE failed when using 'fastproximity'

Other
    o   classes (sf, sfc, sfg) and methods (st_) from package 'sf' largely replace 'sp' (now in Suggests)
    o   trap.builder() SRS sf::st_sample replaces sp::spsample
    o   imports functions from 'sf' and 'terra'
    o   no longer suggests maptools, rgeos, rgdal 
    o   internal function boundarytoSF documented
    o   new vignette secr-spatialdata.pdf
    o   revised OVforest shapefile in extdata
    o   one trap.builder() example moved to \dontrun to save time

Changes in version 4.5.1 (2022-01-18)

New features or changed behaviour of old functions
    o   none

Bugs fixed
    o   secr.fit() hybrid mixture model (hcov with known-class data) 
        did not use class-dependent detection model, resulting in 
        erroneous estimate of pmix (secr >= 4.0)
    o   memory error getxy() C++ (transect simulation; no effect on users)

Changes in version 4.5.0 (2022-01-06)

New features or changed behaviour of old functions
    o   make.capthist() 'snapXY' also works for points along transects
    o   modelAverage() new generic supercedes model.average()
    o   snip() acquires 'tol' argument, now used by discretize()
    o   new link 'i1000' (identity x 1000) for modelling very low density
    o   sim.popn() 'UNI' movement model (radius move.a)
    o   sim.popn() models differential settlement of dispersers (model2D = 'IHP' 
        and core has covariate 'settle' 0-1)
    o   f() term in formula for non-linear density models (experimental)
    
Bugs fixed
    o   verify() error 'Duplicated or missing row names (animal ID)'
        triggered when no live releases
    o   sim.popn() multi-session movement allowed some animals outside the 
        boundary on the first step (edgemethod 'truncate')
    o   secr.fit() failed with data from multiple transects
    o   snip() and discretize() failed when transectID contained '.'
    o   nearesttrap, discretize etc. failed if no detections in some sessions
    o   alive() and reduce.capthist() erroneous when only one animal
    o   secr.fit() fastproximity failed when no detections in some sessions
    o   secr.fit() signal detector problem with Boost distribution function 
        (since 4.4.7 Oct 2021)
    o   secr.fit() mark resight simulations failed (since 4.4.5 July 2021)

Other
    o   suggests 'terra' package (potentially supercedes 'raster')
    o   tests added for transect and signal data
    o   model.average() deprecated
    o   update C++ code for BH 1.78

Changes in version 4.4.8 (2021-11-09)

New features or changed behaviour of old functions
    o   none

Bugs fixed
    o   'count' detectors failed with Poisson model (reported by Ian Durbach) 
        owing to problem with switch to Boost statistical distributions in C++

Changes in version 4.4.7 (2021-10-18)

Other
    o   options requiring package 'spsurvey' suspended - trap.builder(method = 
        'GRTS') and derivednj(method = 'local') - because of changes in spsurvey 5.0.0 
    o   'spsurvey' removed from Suggests
        
Changes in version 4.4.6 (2021-10-18)

New features or changed behaviour of old functions
    o   sim.popn() exponential (RDE), gamma (RDG) and lognormal (RDL) movement distance
    o   sim.popn() zero-inflated movement models BVNzi, BVEzi, RDEzi, INDzi
    o   addCovariates() accepts RasterLayer spatialdata
    o   make.capthist() and read.capthist() tweaked to allow nonspatial input

Bugs fixed
    o   snip() failed in recent versions
    o   secr.fit() and bias.D() spurious warning of variable usage

Other
    o   Boost math library used for statistical distributions in C++ code
    o   number of threads explicit in calls to RcppParallel parallelFor
    o   sim.popn() with movement: edgemethod 'truncate' now synonym 'normalize'
    o   deprecated and defunct functions handled formally (see e.g., help("secr-defunct")) 

Changes in version 4.4.5 (2021-07-12)

New features or changed behaviour of old functions
    o   'sigmak' parameterization allows session covariates
    o   experimental parameter 'd' for parameterization sigma = sigmak/sqrt(D+d) + c
    o   sim.popn() all movement simulations use polar coords + rgamma, rweibull etc.
    o   extractMoves() new function for checking movement simulations

Bugs fixed
    o   as.data.frame.capthist() in 4.4.4 mis-assigned traps to captures
    o   trivial: bad trace when fixedbeta specified

Other
    o   'BVN','BVE','BVT' aliases for movemodels 'normal','exponential','t2D'

Changes in version 4.4.4 (2021-05-29)

New features or changed behaviour of old functions
    o   animalID(), trap() etc. acquire argument 'sortorder' 

Bugs fixed
    o   erroneous plot(), verify() and RPSV() results for multi-polygon data
    o   ASAN error: container overflow prwifastproximity.cpp
    o   rectangularMask() misaligned covariates by one cell, with 
        consequences for raster method for 'mask' class

Other
    o   multithreaded Examples now in dontrun{} to avoid TBB library in checks
    o   interactive dontrun{} Examples trapped to allow R CMD check --run-dontrun
    o   new text files in extdata for MRCH addSightings example
    o   flip() arguments changed F to FALSE
    o   new test: multi-detector polygon likelihood
    o   new test: join() nonspatial data

Changes in version 4.4.2 (2021-05-04)

Other
    o   rename generic make.newdata() to makeNewData()
    o   Imports RcppParallel version >= 5.1.1 to dodge problems in earlier releases
    o   run tests with Sys.setenv(RCPP_PARALLEL_BACKEND = "tinythread") to avoid CRAN errors

Changes in version 4.4.1 (2021-05-01)

Other
    o   Add final '/' to url in DESCRIPTION and fix typo in secr-package.Rd


Changes in version 4.4.0 (2021-05-01)

New features or changed behaviour of old functions
    o   sim.popn() movement model may be user-provided function
    o   sim.popn() recrmodel may be 'specified' (add number in details$Nrecruits)
    o   sim.popn() optional age covariate for multisession populations
    o   HPX new detectfn (binary detection in polygon)
    o   plot.traps minor change in colours used with polygon detectors
    o   split.capthist() accepts multi-session input
    o   reduce.traps() 'newxy' selects 'mean' or 'first' for coordinates of 
        new detector from group defined by 'newtraps'

Bugs fixed
    o   make.capthist() rejected some valid records as duplicates (R. Glennie)
    o   length > 1 in coercion to logical (internal function sessionLL x2)
    o   sim.popn() with movement: 'normalize' edgemethod did not normalize
    o   secr.make.newdata() (and predict.secr()) sometimes ignored all.levels = FALSE
    o   make.grid() spacing attribute missing in case of single detector
    o   reduce.capthist() failed with polygon input and nonspatial output
    o   no warning when attempt to combine capped and other detector types
    o   subset.capthist() by occasion could return wrong session labels

Other
    o   Suggests testthat, adds some unit tests in 'tests' folder
    o   sim.popn() with movement: 'clip' edgemethod works with constantN
    o   generic make.newdata() replaces secr.make.newdata() (seldom used directly; see 4.4.2)
    o   shareFactorLevels() when not multisession now converts ch _covariates_ to factor

Changes in version 4.3.3 (2020-12-11)

New features or changed behaviour of old functions
    o   subset.capthist() all-negative subset argument indicates exclusion
    o   shareFactorLevels() default for stringsAsFactors now TRUE
    o   sim.popn() with movement: new 'normalize' option for edgemethod

Bugs fixed
    o   multisession hcov failed if only one level present in one or more sessions
    o   plot.capthist() failed when no detections in session
    o   plot.mask(..., dots = FALSE) crashed when no points in mask
    o   secr.fit failed with hcov if only one class present in a session
    o   region.N() with multisession model failed using 'hcov' and otherwise not reliable
    o   alive() incorrect order of output
    o   sim.detect() renumbered multi-session capthist even when renumber = FALSE

Other
    o   terminal '/' on https://www.otago.ac.nz/density/ in Rd required by CRAN
    o   verify() suggests shareFactorLevels() when needed
    o   more robust handling of sessions with zero detections
    o   join() gives advice when table limit exceeded (2^31 elements)
    o   output from region.N() with multisession model uses session names
    o   rectangularMask() rewritten to allow disjunct mask blocks
    o   character sessioncov used in D~ models automatically converted to factor
    o   sim.popn() undocumented movement options 'radialexp' and 'radialnorm'
    o   reduce.capthist() more robust when no detections
    o   sim.capthist() now accepts character detectfn when nsessions>1

Changes in version 4.3.1 (2020-08-31)

New features or changed behaviour of old functions
    o   subset.traps() allows subset argument to be function, as for 
        subset.capthist()
    o   de novo calculation of spacing for traps, mask uses median instead of mean
    o   read.traps() enables usage and covariate input from data and xls
    o   summary.traps() new argument 'covariates' for covariate summaries (default FALSE)
    o   verify() invisible output includes detail on captures
    o   ORL() new function for observed range length
    o   centroids() new function for detection centroids

Bugs fixed
    o   verify() bug on covariates call to stringsAsFactors fn
    o   moves() lost animal order when animal IDs numeric and names = TRUE
    o   secr.make.newdata() (and hence predict() etc.) included superfluous 
        combinations of session covariates
    o   read.mask() assigned wrong spacing for some unusual configurations
    o   occasion() could result in wrong sequence, with consequences for various plots 
        and summaries

Other
    o   summary.secr() always reports detector percent usage
    o   plotMaskEdge() increased robustness
    o   make.capthist() coerces third column of captures dataframe to integer
    o   updateCH() recoded to avoid reduce.capthist() that now assumes 3-D 
    o   secr.fit() calls check3D in case data pre-dates secr 3.0
    o   fxi.secr() and related functions work with models fitted using fastproximity = TRUE

Changes in version 4.3.0 (2020-07-14)

New features or changed behaviour of old functions
    o   RSE() returns matrix with one row for each row of newdata
    o   shareFactorLevels() gains argument stringsAsFactors to convert character to factor

Bugs fixed
    o   learned response models (b, B etc.) fitted incorrectly to data from multi-catch traps 
        (detector 'multi') and exclusive polygon-type detectors (detector 'polygonX', 'transectX')
    o   esa() ignored individual covariates in models with CL = TRUE, with consequences 
        for derived() and region.N()

Other
    o   internal changes for compatibility with R 4.0
    o   make.capthist() forces character covariates to factor for backward compatibility
    o   verify() converts character covariates to factor before checking levels consistent 
        across sessions
    o   derived() and region.N() now work for models fitted in secr versions before 4.0

Changes in version 4.2.2 (2020-04-08)

New features or changed behaviour of old functions
    o   none

Bugs fixed
    o   individual covariate (CL) models for proximity data failed unless fastproximity = FALSE
    o   Bk models for proximity data gave error unless fastproximity = FALSE
    o   join() sometimes failed (circumstances unclear)

Other
    o   adjusted protection for calls to suggested package rgdal
    o   suggest.buffer() trivial change to Examples

Changes in version 4.2.0 (2020-02-22)

New features or changed behaviour of old functions
    o   new mechanism for setting number of threads (default 2)
    o   setNumThreads() new function 
    o   make.systematic() 'rotate', 'centrexy' and 'keep.design' arguments
    o   make.lacework() new function
    o   make.grid() and make.circle() acquire argument 'leadingzero') (default TRUE)

Bugs fixed
    o   make.systematic() unintended result when spacing of rows and columns differs

Other
    o   pdot() uses multithreaded C++ function pdotpointcpp2
    o   pdot() acquires argument ncores
    o   derivedSystematic() acquires argument ncores
    o   esa() internal limit on ncores (2) removed
    o   trim.secr() drops designD, designNE by default (see 4.0.0)
    o   rotate.traps() checks for zero rows
    o   suggest.buffer() minor internal changes
    o   distancetotrap() uses rgeos::gDistance for polygon detectors if available
    o   fxi.secr() and related functions enabled for polygon detector types

Changes in version 4.1.0 (2019-12-17)

New features or changed behaviour of old functions
    o   AICcompatible() new S3 method to check models for AIC compatibility
    o   AIC() warns if secr models not compatible
    o   LR.test() stops if secr models not compatible
    o   secr.fit() faster fitting of polygon and transect data
    o   secr.fit() option details = list(convexpolygon = FALSE) allows non-convex polygons.
    o   autoini() uses simpler and more robust code; secr.fit() start values differ slightly 
        from earlier versions; new argument 'adjustsigma'.

Bugs fixed
    o   reduce.capthist() subtracted dead animals when outputdetector = "count"
    o   verify.capthist() spurious warning for transect data with character animalID
    o   derived() bad for polygon and transect data in secr 4.0 because esa() corrupted 
    o   secr.fit() in secr 4.0 bad likelihood and estimates for some covariate models 
        (bad indexing of parameter array PIA)
    o   secr.fit() failed with multi-session mark-resight data (fixed pID, non-null Tm)
    o   suggest.buffer() failed with input from multi-session fitted model
    o   make.systematic() unintended result when spacing of rows and columns differ

Other
    o   RcppNumerical used for numerical integration with polygon and transect detectors
    o   requires R >= 3.5.0 for obscure reasons (serialization of data objects)
    o   suppressed new warnings from regularize.values in approx()
    o   internal function secr.design.MS() argument bygroup replaced with CL
    o   LLsurface() returns value matrix when plot = FALSE (otherwise invisibly as before) 
        (NA where likelihood could not be evaluated)
    o   mark-resight sighting only, partial identification re-enabled

Changes in version 4.0.2 (2019-11-11)

New features or changed behaviour of old functions
    o   secr.fit() LLonly = TRUE stores number of parameters and timing information
    o   secr.fit() LLonly = TRUE uses default or autoini start values if none provided
    o   summary.secr() versiontime includes elapsed time
    o   summary.capthist() includes summary of individual covariates

Other
    o   CRAN release of 4.0

Changes in version 4.0.0 (2019-10-27)

New features or changed behaviour of old functions
    o   'ncores' argument defaults to NULL in most functions (meaning one less than number
        of available cores for multi-threading)
    o   fx functions 'normal' argument dropped
    o   'ncores' argument dropped from mask.check(), pmixProfileLL() and simulate.secr()
    o   autoini(), region.N() and suggest.buffer() acquire 'ncores' argument
    o   fast secr.fit() for binary and count proximity detectors (default details$fastproximity = TRUE)
    o   make.systematic() new argument 'order' to control cluster sequence
    o   RSE() extract precision of estimated parameter from fitted model
    o   par.secr.fit() no longer automatically sets ncores=1 in the separate calls to 'secr.fit'
    o   secr.fit() details option autoini = 'all' for start values from multi-session data
    
Bugs fixed
    o   sim.secr() with 'multi' detectors slightly understated detection rate owing to mis   
        -assignment of detection locations 
    o   make.systematic() and trap.builder() ignored region polygon when cluster not
        specified (edgemethod set internally to 'allowoverlap'

Other
    o   converted C code to C++ with multithreading in RcppParallel as appropriate
    o   some features of earlier versions have yet to be implemented in 4.0
    o   secr object from secr.fit() includes design matrices for D and noneuc
    o   functions read.SPACECAP() and write.SPACECAP() removed

Changes in version 3.2.2 (2019-07-02)

New features or changed behaviour of old functions
    o   summary method for popn objects
    o   write.mask() function

Bugs fixed
    o   sim.popn() exponential
    o   plotMaskEdge() sometimes shows internal lines (non-integer spacing)
    
Other
    o   write.capthist help wrote files to disk; now in \dontrun{}

Changes in version 3.2.1 (2019-06-01)

New features or changed behaviour of old functions
    o   sim.popn() allows exponential and t2D movement between sessions
    o   sim.popn() new details arguments movemodel, move.a; sigma.m deprecated

Bugs fixed
    o   make.capthist() with transect data gave error when points did not lie on transect
    o   moves() failed with nonspatial capthist (also summary.capthist(moves = T) etc.)
    o   plot.popn() ignored frame argument when collapse = TRUE
    
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   secr.fit() 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 
    https://www.otago.ac.nz/density/pdf/secr-manual.pdf or https://CRAN.R-project.org/package=secr/secr.pdf.

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   secr.fit 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   secr.design.MS() 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(), secr.fit() etc.
    o   as.data.frame 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   secr.fit() details argument 'contrasts' for specialised coding of factor predictors (example in secr-multisession.pdf)
    o   secr.fit() 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   par.secr.fit() acquires arguments save.intermediate and LB to allow
        load balancing (thanks to Mathias Tobler)
    o   par.secr.fit() 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 secr.fit mark-resight models
    o   documentation of random number seeds in ?secrRNG
    o   start vector returned by secr.fit 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 make.circle() 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 secr.fit() now integer with multiple levels
    o   sightingPlot() new function
    o   plot.capthist() new option "centres"
    o   secr.fit() 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   secr.fit() 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   par.secr.fit() 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 secr.fit 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   secr.fit() details savecall = FALSE suppresses call (default in par.secr.fit)
    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
