Trap Covariates and Varying Effort

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

Trap Covariates and Varying Effort

Postby Lombardijv » Mon Mar 24, 2014 3:53 pm

Hi Murray,


I hope this question is easier to understadn than the previous question I posted last week on an older thread. I am having trouble writing my read.capthist code. The goal of my research is to distinguish how density and detection probability is influenced by different spatial covariate effects (e.g. building density, road density, area of nonurban habitat patch , percentage of nonurban habitat patch within a 250 meter around each of my 120 trap sites). Within my trap input file, I included the covariates at each trap point along with the usage (binary values) of when each camera was active.

When I wrote the following code I received an error, but I am not sure what correction needs to be made

Code: Select all
usage(traps("bobcatcapt.txt")
>NULL

CH <- read.capthist("bobcapt.txt", "CamSites.txt", trapcovnames = "BLDensity", "PercPatch", "PatchArea", "RoadDensity", detector = "proximity", fmt = "trapID", binary.usage = TRUE)

Error in read.traps(file = "CamSites.txt", detector = "proximity",  :
  'usage' fields suggest varying number of occasion



Any recommendations would be greatly appreciated as I am a bit confused on how to proceed.

Thank You Again in Advance,


Jason
Lombardijv
 
Posts: 9
Joined: Mon Mar 17, 2014 1:07 pm

Re: Trap Covariates and Varying Effort

Postby murray.efford » Mon Mar 24, 2014 5:15 pm

Hi
This looks like a simple R error. As I understand it, you have 4 columns of covariates in your trap layout file. The argument 'trapcovnames' should therefore be a character vector of length 4, which you form with the c() function:
Code: Select all
trapcovnames = c("BLDensity", "PercPatch", "PatchArea", "RoadDensity")

Murray
murray.efford
 
Posts: 712
Joined: Mon Sep 29, 2008 7:11 pm
Location: Dunedin, New Zealand

Re: Trap Covariates and Varying Effort

Postby Lombardijv » Fri Mar 28, 2014 3:02 pm

Murray,


Thank you for clarifying this for me, but I still received an error when I added in the correction you gave for the trap covariates. Please let me know if I made a coding error in R.

Code: Select all

usage(traps("CamSites.txt"))
>Null

CH <- read.capthist(captfile ="coyoteFALL.txt", trapfile =c("CamSites.txt"), trapcovnames = c("BLDensity", "PercPatch", "PatchArea", "RoadDensity"), detector = "proximity", fmt = "trapID", binary.usage = TRUE)

Error in read.traps(file = "CamSites.txt", detector = "proximity",  :
  'usage' fields suggest varying number of occasions



Thanks Again,


Jason
Lombardijv
 
Posts: 9
Joined: Mon Mar 17, 2014 1:07 pm

Re: Trap Covariates and Varying Effort

Postby murray.efford » Fri Mar 28, 2014 5:05 pm

The line
Code: Select all
usage(traps("CamSites.txt"))
doesn't make sense - 'traps' extracts the detectors from a capthist object, whereas "CamSites.txt" is just a character value. Not sure what you wanted to achieve here.

Otherwise there is clearly a mismatch between your data and the code, which could only be resolved by looking at (a sample of) the data. Check the format for detector layout data in secr-datainput.pdf; covariates are separated by / from preceding coordinates and usage codes.
Murray
murray.efford
 
Posts: 712
Joined: Mon Sep 29, 2008 7:11 pm
Location: Dunedin, New Zealand

Re: Trap Covariates and Varying Effort

Postby Lombardijv » Tue Apr 01, 2014 1:33 pm

Murray,

I looked at the secr-datainput.pdf, (as you suggested) over the weekend and figured out what was going on, which turned out to be the lack of "/" after the usage and coordinates.



Jason
Lombardijv
 
Posts: 9
Joined: Mon Mar 17, 2014 1:07 pm


Return to analysis help

Who is online

Users browsing this forum: No registered users and 1 guest