Trap -Type and Observation Level Covariates

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

Trap -Type and Observation Level Covariates

Postby jesse.whittington » Mon Jul 16, 2012 1:10 pm

Hi Murray,

I am using secr and openbugs to conduct spatially explicit capture recapture analysis of grizzly bear DNA data collected from Banff National Park. I have two questions:

1. We used both rub trees and hair snag stations (barbed wire surrounding a bait pile) to collect bear hair. I had planned to include “Trap Type” as an explanatory variable because we expected that the traps would have different detection probabilities. (E.g. m <- secr.fit( capthist = y, model = list(g0 ~ kcov, sigma ~ 1), mask=xy.mask) However, I heard that you may have some concerns about this approach. If so, could you elaborate on what those concerns are?

Both rub trees and hair snag stations were checked every 3 weeks. Rub trees were repeatedly checked throughout the summer (temporal replication). Hair snag stations were moved every 3 weeks within grid cells.

2. My understanding from reading the vignettes is that we cannot include observation level covariates (such as number of sampling days per trap) in the models. Am I correct?

We really appreciate all your work developing the secr package and the associated documentation. Thank-you!

Jesse Whittington
Wildlife Biologist
Banff National Park
jesse.whittington
 
Posts: 3
Joined: Mon Jul 16, 2012 12:35 pm

Re: Trap -Type and Observation Level Covariates

Postby murray.efford » Mon Jul 16, 2012 2:03 pm

Jesse
1. As you say, it makes sense to allow for different detection rates at rub trees and hair snags. There are multiple ways to do this, and I don't remember any inherent problem with using a trap-level covariate as you propose (note the wording... I may remember later! One possibile objection is that models with trap-level covariates can be very slow to fit). As hairs snags were moved it is necessary to treat each location as a separate detector and to code 'usage' for each (e.g. 01000 for a site used only in the second 3-week period). It is also possible to achieve the same effect by adding the rub-tree observations as extra occasions after the hair snag occasions and coding 'usage' of rub trees as zero for the hair snag occasions and vice versa. Other manipulations are possible.
2. Time-varying trap covariates are an undocumented experimental feature. Say your dataframe of trap covariates (i.e. covariates(traps(y)) includes one column for each of 5 occasions; modify traps(y) by adding an attribute to identify the covariate column for each occasion and give this set of columns a name that can be used in detection models:

Code: Select all
attr(traps(y), 'timevaryingcov') <- list(ndays = 1:5)
secr.fit(..., model = g0~ndays)


This mechanism may change, but it should work for now. Please let me know if you have trouble.
Murray
murray.efford
 
Posts: 712
Joined: Mon Sep 29, 2008 7:11 pm
Location: Dunedin, New Zealand

Re: Trap -Type and Observation Level Covariates

Postby jesse.whittington » Mon Jul 16, 2012 2:43 pm

Hi Murray,

Thanks a million for your prompt reply.

We have been coding usage correctly for the trap type. Your approach for adding the time-varying trap covariates is clever. I will give it a try.

The secr models may be a little slow to converge, but they certainly beats the days of waiting for the openbugs models to run.

Jesse
jesse.whittington
 
Posts: 3
Joined: Mon Jul 16, 2012 12:35 pm

Re: Trap -Type and Observation Level Covariates

Postby jesse.whittington » Mon Jul 23, 2012 12:09 pm

Hi Murray,

FYI, I was able to run a few models with time-varying trap covariates (ie number of sampling weeks), but most of the time I ran out of memory.

This is not surprising given that we have 445 traps, 79 individuals, 7 occasions, and 3 years of data = 738255 records. Given that time-varying trap covariates are experimental, I thought I would let you know.

##### Warning message
> m <- secr.fit( capthist = y, model = list(D ~ 1, g0 ~ rub + n.weeks, sigma ~ 1), trace=T , mask=xy.mask, start=m4)
Checking data
Preparing detection design matrices
Preparing density design matrix
Maximizing likelihood...
Eval Loglik D g0 g0.rub g0.n.weeks sigma
Error: cannot allocate vector of size 1.3 Gb
In addition: Warning messages:
1: In secr.design.MS(capthist, model, timecov, sessioncov, groups, :
implementation of user covariates with multi-session data is not fully tested
2: In secr.design.MS(capthist, model, timecov, sessioncov, groups, :
implementation of user covariates with multi-session data is not fully tested


##### sessionInfo()
> sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_Canada.1252 LC_CTYPE=English_Canada.1252 LC_MONETARY=English_Canada.1252 LC_NUMERIC=C LC_TIME=English_Canada.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] plyr_1.7.1 secr_2.3.2 abind_1.4-0 sp_0.9-99

loaded via a namespace (and not attached):
[1] grid_2.15.1 lattice_0.20-6 tools_2.15.1
jesse.whittington
 
Posts: 3
Joined: Mon Jul 16, 2012 12:35 pm

Re: Trap -Type and Observation Level Covariates

Postby murray.efford » Mon Jul 23, 2012 12:24 pm

Jesse
Thanks for that. The size of your problem doesn't seem extreme, so I'd like to check exactly where the problem is. Unfortunately I cannot tackle that in the next month. Using 64-bit R (if you can find a 64-bit system) would allow you to access somewhat more memory (useful only if the amount needed is modestly more than 1.3Gb), and would speed up model fitting.
Murray
murray.efford
 
Posts: 712
Joined: Mon Sep 29, 2008 7:11 pm
Location: Dunedin, New Zealand


Return to analysis help

Who is online

Users browsing this forum: No registered users and 0 guests

cron