if (FALSE) {
# Generate some detection and telemetry data, combine them using
# addTelemetry, and perform analyses
# detectors
te <- make.telemetry()
tr <- make.grid(detector = "proximity")
# simulated population and 50% telemetry sample
totalpop <- sim.popn(tr, D = 20, buffer = 100)
tepop <- subset(totalpop, runif(nrow(totalpop)) < 0.5)
# simulated detection histories and telemetry
# the original animalID (renumber = FALSE) are needed for matching
trCH <- sim.capthist(tr, popn = totalpop, renumber = FALSE, detectfn = "HHN")
teCH <- sim.capthist(te, popn = tepop, renumber=FALSE, detectfn = "HHN",
detectpar = list(lambda0 = 3, sigma = 25))
combinedCH <- addTelemetry(trCH, teCH)
# summarise and display
summary(combinedCH)
plot(combinedCH, border = 150)
ncapt <- apply(combinedCH,1,sum)
points(totalpop[row.names(combinedCH)[ncapt==0],], pch = 1)
points(totalpop[row.names(combinedCH)[ncapt>0],], pch = 16)
# for later comparison of precision we must fix the habitat mask
mask <- make.mask(tr, buffer = 100)
fit.tr <- secr.fit(trCH, mask = mask, CL = TRUE, detectfn = "HHN") ## trapping alone
fit.te <- secr.fit(teCH, mask = mask, CL = TRUE, start = log(20), ## telemetry alone
detectfn = "HHN")
fit2 <- secr.fit(combinedCH, mask = mask, CL = TRUE, ## combined
detectfn = "HHN")
# improved precision when focus on realised population
# (compare CVD)
derived(fit.tr, distribution = "binomial")
derived(fit2, distribution = "binomial")
# may also use CL = FALSE
secr.fit(combinedCH, CL = FALSE, detectfn = "HHN", trace = FALSE)
}
Run the code above in your browser using DataLab