Hi Stefano
Groups could work (examples at
https://github.com/MurrayEfford/secr-simulations under STR). But there is a more direct way using explicit input of detector-specific detection parameters in sim.capthist. For a different reason (aiming to reduce number of occasions) I started out with HHN instead of HN (hence lambda0 instead of g0), but this should also work with HN/g0. It's not pretty, but it seems to get there.
Murray
library(secrdesign)
# some detectors with a binary covariate 1,2
grid<- make.grid(8,8, spacing = 5000, detector = 'proximity')
onoff <-
sample.int(2, nrow(grid), replace = TRUE)
covariates(grid) <- data.frame(onoff = onoff)
plot(secr::as.mask(grid), cov='onoff', dots = FALSE)
lambdas <- c(0.01,0.02) # for covariate levels 1,2
sigmas <- c(3000,4000,5000)
# manually construct some occasion x detector matrix inputs for sim.capthist
# (ultimately replaces lambda0, sigma from scen)
onedetpar <- function (noccasions, sigma) {
# filling by row re-uses detector-specific covariates on each occasion
mat <- matrix(lambdas[onoff], byrow = TRUE, nrow = noccasions, ncol = nrow(grid))
list(detectpar = list(lambda0 = mat, sigma = sigma))
}
# all combinations of duration and sigma
dets <- expand.grid(noccasions = c(60,80,100,120), sigma = sigmas)
detarglist <- mapply(onedetpar, dets$noccasions, dets$sigma, SIMPLIFY = FALSE)
detectfn = 'HHN',
lambda0 = 0.01, # placeholder - replaced later
sigma = 3000, # placeholder - replaced later
detindex = 1:12)
# force noccasions to follow matrices in detarg
scen$noccasions <- dets$noccasions[scen$detindex]
sims <- run.scenarios(
nrepl = 20,
scenarios = scen,
trapset = grid,
det.args = detarglist,
fit = TRUE,
fit.args = list(detectfn = 'HHN', model = lambda0~onoff))
estimateSummary(sims)