GithubHelp home page GithubHelp logo

secr's Introduction

CRAN status Downloads (total) R-CMD-check

secr

Spatially Explicit Capture-Recapture

This is the development version of the R package distributed on CRAN.

It may be installed using

devtools::install_github("MurrayEfford/secr")

Compilation of C++ code is required.

Please report bugs as Issues on this GitHub page.

Help is also available from the DENSITY | secr forum at phidot.org or the Google group secr.

See www.otago.ac.nz/density for general background.

secr's People

Contributors

murrayefford avatar philjd avatar

Stargazers

Zoe Woodgate avatar  avatar  avatar

Watchers

James Cloos avatar  avatar

Forkers

philjd

secr's Issues

Support exact integral for detectfn (where possible)

While working on #4 , I've been looking into other ways of speeding up the computation.
One option would be to use the exact CDF instead of approximating the integral via Numer::Integrate where possible.

E.g.,the half normal function (zhhnrC) has an exact solution (found via WolframAlpha, this includes the y calculations).

This gives ~10x speedup, reducing computation time from 40 to ca. 4 minutes in my case. I've confirmed that results are the same. This is of course limited to convex polygons though.

Do you think this is worth adding? I'd be happy to contribute this if yes :)

secr.fit failed initial values not found

Hello,
I am trying to fit a secr model to some camera trap data and I've tried a few different inputs I found when trying to find a solution and they all yield the same error/warning :

library(secr)
CH <- read.capthist(captfile = "DEC21cap2.txt",trapfile = "DEc21trap.txt", skip=1, detector = "proximity",covnames = NULL,binary.usage=TRUE)
No errors found :-)
my_traps <- traps(CH)
my_mask <- make.mask(my_traps, buffer = 3500, spacing = 1200, type = "trapbuffer")
m0<-secr.fit(CH,detectfn = "HHN", mask = my_mask, model = list(D=~1, lambda0=~1, sigma=~1))
Checking data
Preparing detection design matrices
Preparing density design matrix
Finding initial parameter values...
Warning messages:
1: In autoini(capthist = ch, mask = msk, binomN = tempbinomN, adjustg0 = details$binomN[1] == :
'dbar' close to zero; using detector spacing instead
2: In makeStart(start, parindx, capthist, mask, detectfn, link, details, :
'secr.fit' failed because initial values not found (data sparse?); specify transformed values in 'start'

initialsigma <-RPSV(captdata, CC=TRUE)[[1]]
cat("Quick and biased estimate of sigma=", initialsigma, "m/n")
Quick and biased estimate of sigma= 25.62888 m/n
fit <- secr.fit(CH, buffer = 4*initialsigma, trace = FALSE)
Warning messages:
1: In autoini(capthist = ch, mask = msk, binomN = tempbinomN, adjustg0 = details$binomN[1] == :
'dbar' close to zero; using detector spacing instead
2: In makeStart(start, parindx, capthist, mask, detectfn, link, details, :
'secr.fit' failed because initial values not found (data sparse?); specify transformed values in 'start'

library(secr)

ftraps<-read.csv("DEC21trap.csv")
names(ftraps)[2:3]<-c('x','y')
qtraps<-read.traps(data = ftraps, detector = "proximity")
cap<-read.csv("DEC21cap2.csv")
Dcap<-cap[,c(1,2,3,4)]
CH<-make.capthist(Dcap,qtraps,fmt = "trapID",noccasions = 38)
summary(CH, terse = TRUE)
Occasions Detections Animals Detectors
38 38 22 103
mask<-make.mask(qtraps,spacing = 1200)
Cats.secr0<-secr.fit(CH,model = list(D1,g01,sigma~1),mask = mask)
Checking data
Preparing detection design matrices
Preparing density design matrix
Finding initial parameter values...
Warning messages:
1: In autoini(capthist = ch, mask = msk, binomN = tempbinomN, adjustg0 = details$binomN[1] == :
'dbar' close to zero; using detector spacing instead
2: In makeStart(start, parindx, capthist, mask, detectfn, link, details, :
'secr.fit' failed because initial values not found (data sparse?); specify transformed values in 'start'
DEC21trap.csv
DEC21cap2.csv

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.