## population of animals at 1 / hectare generates random
## Poisson number of cues, lambda = 5
mics4 <- make.grid( nx = 2, ny = 2, spacing = 44, detector = "signal")
pop <- sim.popn (D = 1, core = mics4, buffer = 300, nsessions = 6)
pop <- clone (pop, "poisson", 5)
attr(pop[[1]],"freq")
clone(captdata, "poisson", 3)
# To avoid losing any individuals use zero-truncated Poisson
# First find lambda of truncated Poisson with given mean
getlambda <- function (target) {
fn <- function(x) x / (1-exp(-x)) - target
uniroot(interval = c(1e-8, target), f = fn)$root
}
clone(captdata, "truncatedpoisson", getlambda(3))
Run the code above in your browser using DataLab