I'm trying to generate non-uniform populations using a mask with density values. I would like to test 9 different trap layouts so I'm creating the following scenario and poplist with D1 (inhomogeneous) and D2 (homogeneous), which are stored as attributes in the masks:
scen1 <- make.scenarios(trapsindex=1:9, sigma = 1500, g0 = 0.32, noccasions = 8, popindex = 1:2)
poplist <- list(list(model2D = "IHP", D = "D1"), list(model2D = "IHP", D = "D2"))
sims1 <- run.scenarios(nrepl = 10, scenarios = scen1, trapset = mydetectors, maskset = mymask, pop.args = poplist, seed = 345, fit=TRUE, fit.args = list(detectfn = 'HN'))
I'm trying to run the previous code, but I'm getting the following error message:
Error in (function (f, p, ..., hessian = FALSE, typsize = rep(1, length(p)), :
missing value in parameter
In addition: There were 18 warnings (use warnings() to see them)
Error in for (j in seq_along(x)) { :
Shadow graphics device error: r error 4 (R code execution error)
Error in for (j in seq_along(x)) { :
Shadow graphics device error: r error 4 (R code execution error)
Warning messages:
1: In mean.default(covariates(full.pop.args[[pi]]$core)[, ... :
argument is not numeric or logical: returning NA
The masks that I'm using were created using:
mymasks <- lapply(mydetectors, make.mask, buffer = 4500, type = "trapbuffer", spacing = 100)
mymask <- lapply(mymasks, addCovariates, covers, replace = TRUE)
The masks with the density covariates are plotted correctly with the traps on it. I'm not sure what I'm missing or why the error is produced... Any help or hint that you could provide me will be very helpful! I could generate data and fit the model correctly before including a mask, so maybe it has to do with it... Also I'm using secr 4.2.2 and secrdesign 2.5.10.