secrdesign and fixed N (Ndist = "fixed")

questions concerning anlysis/theory using program DENSITY and R package secr. Focus on spatially-explicit analysis.

secrdesign and fixed N (Ndist = "fixed")

Postby bgerber » Mon Jan 27, 2020 10:36 am

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
bgerber
 
Posts: 24
Joined: Wed Dec 12, 2007 1:01 pm

Re: secrdesign and fixed N (Ndist = "fixed")

Postby murray.efford » Mon Jan 27, 2020 4:59 pm

Doesn't sound right that you can catch more animals than are in the population. Can you post a minimal example?
murray.efford
 
Posts: 686
Joined: Mon Sep 29, 2008 7:11 pm
Location: Dunedin, New Zealand

Re: secrdesign and fixed N (Ndist = "fixed")

Postby murray.efford » Mon Jan 27, 2020 5:37 pm

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)
murray.efford
 
Posts: 686
Joined: Mon Sep 29, 2008 7:11 pm
Location: Dunedin, New Zealand

Re: secrdesign and fixed N (Ndist = "fixed")

Postby bgerber » Tue Jan 28, 2020 2:07 pm

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
bgerber
 
Posts: 24
Joined: Wed Dec 12, 2007 1:01 pm

Re: secrdesign and fixed N (Ndist = "fixed")

Postby murray.efford » Tue Jan 28, 2020 2:46 pm

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
murray.efford
 
Posts: 686
Joined: Mon Sep 29, 2008 7:11 pm
Location: Dunedin, New Zealand

Re: secrdesign and fixed N (Ndist = "fixed")

Postby bgerber » Tue Jan 28, 2020 4:49 pm

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
bgerber
 
Posts: 24
Joined: Wed Dec 12, 2007 1:01 pm


Return to analysis help

Who is online

Users browsing this forum: No registered users and 13 guests