Page 1 of 1
secrdesign and fixed N (Ndist = "fixed")

Posted:
Mon Jan 27, 2020 10:36 am
by bgerber
I am simulating data and fitting an IHP model in secrdesign. I noticed that with a fixed population size (Ndist = "fixed") I can capture more individuals than the true population size. As such, the population estimates are much too high. Is there a way to remedy this?
Backing up, my goal is to simulate a stochastic detection process with different sampling layouts to determine the likelihood of each layout in censusing a small population of a critically endangered species (also looking at pop estimates) . I need to do this with spatial varying density. I would prefer to keep N as fixed, however, could consider D (thus N as well) as random from an IHP if for each simulation if I could know the true N within each simulation step.
thanks
cheers, brian
Re: secrdesign and fixed N (Ndist = "fixed")

Posted:
Mon Jan 27, 2020 4:59 pm
by murray.efford
Doesn't sound right that you can catch more animals than are in the population. Can you post a minimal example?
Re: secrdesign and fixed N (Ndist = "fixed")

Posted:
Mon Jan 27, 2020 5:37 pm
by murray.efford
Here is my attempt. (I'm using a new version of secrdesign that I was about to send to CRAN, but the changes from 2.5.7 are very minor and not relevant). It seems you have a different problem?
- Code: Select all
library(secrdesign)
grid <- make.grid(detector = 'proximity')
mask <- make.mask(grid)
covariates(mask) = data.frame(xpy = abs(apply(mask,1,sum)))
poparg <- list(D = 'xpy', core = mask, model2D = "IHP", Nbuffer = 100, Ndist = 'fixed')
## plot example
pop <- do.call(sim.popn, poparg)
plot(mask, covariate='xpy', dots = FALSE)
plot(pop, frame = FALSE, add = TRUE)
mtext(side = 3, paste0(nrow(pop) , " individuals"))
## run some sims; relative D specified in poparg as covariate of mask
scen <- make.scenarios(D = NA, g0 = 0.5, sigma = 25, noccasions = 10)
sim <- run.scenarios(nrepl = 5, scenarios = scen, trapset = list(grid),
pop.args = poparg)
# warning about non-numeric D can be ignored
sim
# OK at first glance
## but non-numeric D causes trouble in summary function due to bug in header
header(sim)
Re: secrdesign and fixed N (Ndist = "fixed")

Posted:
Tue Jan 28, 2020 2:07 pm
by bgerber
Thanks Murray. I believe my mistake was that I didn't specify "D=NA" in the make scenarios function, but only specified pop.args where model2D = "IHP". This fixed it so D and thus N are no longer stochastic.
make.scenarios (D = NA, g0 = 0.01, sigma = 1100, noccasions = 10,popindex = 1)
cheers, brian
Re: secrdesign and fixed N (Ndist = "fixed")

Posted:
Tue Jan 28, 2020 2:46 pm
by murray.efford
I'm glad it's now working for you. As far as I can see it makes no difference what you specify for D in make.scenarios() if you override it with the pop.args model2D = "IHP" etc. I just used D = NA to make clear that that D was irrelevant. Maybe something else changed?
Murray
Re: secrdesign and fixed N (Ndist = "fixed")

Posted:
Tue Jan 28, 2020 4:49 pm
by bgerber
Murray,
You're right. I just tested that theory out and that wasn't it.
Something else I changed was that Ndist was accidentally in its own list outside of the first. That looks to be it....but is confusing because I checked this before and was sure Ndist was an attribute of the output from run.scenarios. I am chalking this up to careless coding and diagnostics on my part. Sorry.
thanks
cheers, brian