murrayefford / secr Goto Github PK
View Code? Open in Web Editor NEWSpatially Explicit Capture-Recapture
Spatially Explicit Capture-Recapture
secr.fit fails with start values from a previous model fitted with fixed beta values (details$fixedbeta)
see makeStart.R
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 :)
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.