AddCovariates Help

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

AddCovariates Help

Postby Lombardijv » Mon Apr 07, 2014 4:56 pm

Murray and fellow PhiDot Users,

My research used camera surveys to estimate population density and detection probability of coyotes and other mesopredators. I also wanted to determine the influence of trap-specific covariates (e.g., building density, road density, patch size, etc) on population density and detection probability. Now I know that when modeling density, you need covariates values at each mask point (e.g. Mask Covariates). I know this can be done using addCovariates to extrapolate the trap-specific covariates included in a traps object to a mask, which takes values for each mask point from the nearest trap.

Now, I might be over thinking this, but before I do this it was my understanding that a traps object with trap-specific covariates had to be created using the read.traps function. I wrote the code for this:

Code: Select all
traps <- read.traps("G:/R/Cameras/fall/FallCameras/CamsBinVars.txt", data = data.frame(trap), detector = "proximity", covnames = c("dH20", "dBLD", "dSE", "BLDensity", "PercPatch", "PatchArea", "RoadDensity"))


When the traps object was created, it only included the XY coordinates of each trap site and not the associated trap-specific covariate values. Due to my status as a beginner-level user of R, I am at a loss for how to add the data frame of the trap-specific covariates to the traps object, so I can then create mask covariates in order to model effects of density.

Any help or recommendations will be greatly appreciated as I cannot continue my analysis until this is figured out.


Sincerely,

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

Re: AddCovariates Help

Postby murray.efford » Mon Apr 07, 2014 5:10 pm

Hi Jason
Strictly, you can read detector-level covariates with the read.capthist function as well, using the 'trapcovnames' argument to assign the names.

Unless your 'read.traps' failed I think you'll find the covariates safely hidden away in the 'covariates' attribute of the traps object. This is a separate data frame stored with the traps object that you can see (in your case) by typing 'covariates(traps)'. [As a tip - I think it's going to get confusing if you use the name 'traps' for your detector data as that also refers to a function for extracting the detectors from a capthist object].

This use of a hidden 'covariates' attribute bundled with the core, visible data is common across traps (detector-level covariates), capthist (individual-level covariates) and masks (habitat covariates). When you ask for a covariate by name in a model, secr.fit automatically looks in these places. But I admit it can be hard to get your head around!

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

Re: AddCovariates Help

Postby Lombardijv » Mon Apr 07, 2014 5:50 pm

Murray,


I was not aware that the covariates were safely hidden away in the covariates attribute of the traps object, and when I went to addCovariates, it worked just as it was suppose to.


Thanks,

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 2 guests

cron