extracting traps with operation==1

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

extracting traps with operation==1

Postby hbunderw » Wed Apr 13, 2022 1:09 pm

Been wracking my brain on how to do this. I first used subset on the capture history to isolate occasions 2:6 (of 7). That was easy. Where I'm falling down is in wanting to restrict the trap locations (and their effects on a multi-capthist) to those with a complete operational history (all usage(trap)==1). Seems like I have to work with the capthist object rather than a traps(capthist) object because removing a "multi" detector has consequences on the capture history. I know I can subset the capture history on trapIDs, but only a handful of the 600+ detectors have incomplete usage profiles. Does the row.number of the traps(capthist) correspond to the index of the trapID in trap(capthist, names=TRUE)? If so, I think I can get at it that way. I must be missing something. Thanks in advance.

Posts: 2
Joined: Tue Apr 12, 2022 5:45 pm

Re: extracting traps with operation==1

Postby murray.efford » Wed Apr 13, 2022 3:08 pm

I'm not convinced what you're attempting makes sense - removing traps (and associated capture data) post-hoc that were actually there and affecting the capture pattern is a bit hard to justify.

On your specific question: trap(..., names = FALSE) should give you the row numbers.

However, this seems easy enough using a logical vector as the 'traps' argument to the subset method for capthist objects:

# construct some data with incomplete usage
usge <- matrix(runif(500) < 0.9, 100, 5)
tr <- make.grid(10,10)
usage(tr) <- usge
ch <- sim.capthist(tr, popn = list(D=5), detectpar=list(g0=0.2, sigma=25 ))

# criterion TRUE if trap used on all occasions, FALSE otherwise
all.traps.used <- apply(usage(traps(ch)), 1, sum) == 5
ch2 <- subset(ch, traps = all.traps.used)

Posts: 686
Joined: Mon Sep 29, 2008 7:11 pm
Location: Dunedin, New Zealand

Re: extracting traps with operation==1

Postby hbunderw » Thu Apr 14, 2022 3:37 pm

I understand your concern, Murray. It's a large trap array involving hundreds of animals. The spatial capture has already been analyzed using secr and published. I'm writing a JAGS version of an integrated model using the secr objects. I'm trying to avoid looping through the occasions in the likelihood to reduce computational time. However, I think I can just pass the number of occasions associated with each trap instead and just loop over individuals and traps (my model uses data augmentation). You did answer my direct questions about how to extract the information and I appreciate your time.

Posts: 2
Joined: Tue Apr 12, 2022 5:45 pm

Return to analysis help

Who is online

Users browsing this forum: No registered users and 1 guest