Page 1 of 1

Specifying categorical/continuous detector-level covariates

PostPosted: Mon Aug 01, 2011 11:40 am
by jcusack
Hi,

I carried out mark-recapture sampling of small mammals in logged and unlogged forests, using 96-trap rectangular grids that were each sampled for 7 consecutive days. Within each grid, traps were separated from each other by a distance of 15m. I am coding different grids as different sessions and want to model the effect of session on D and g0.

In addition, I have a number of detector-level covariates which I would like to include in my analyses. These include both categorical (e.g. forest type) and continuous covariates (e.g. canopy closure), which I have added as columns in the trap input file. At what point should I specify the covariate types? Or does secr recognise them as categorical or continuous following a specific coding of covariate values?

Any recommendations would be very welcome. Thanks in advance for your help!

Jeremy

Re: Specifying categorical/continuous detector-level covaria

PostPosted: Mon Aug 01, 2011 12:01 pm
by murray.efford
Jeremy

This sounds like a solid dataset. Regarding detector-level covariates: your detector layout ('traps' object within 'capthist') will include a 'covariates' dataframe with one column per covariate. secr.fit uses this when constructing the design matrix with the R function 'model.matrix'. Numeric columns are treated by model.matrix as continuous; factor columns are categorical, and this applies also to character-valued columns as these are coerced to factors by model.matrix. (It is possible to recode individual covariate columns in situ if you have to, or just fix the input).

A couple of other tips: It is sometimes desirable to convert character columns to factors yourself, so that you can control the order of factor levels. You can use detector-level covariates in models for detection parameters (e.g. g0, sigma) but not for density; spatial covariates of density must be provided for each mask point.

Hope this lets you move on.
Murray

Re: Specifying categorical/continuous detector-level covaria

PostPosted: Mon Mar 17, 2014 3:11 pm
by Lombardijv
Hi Murray,

My question sort of relates to the same thing that Jeremy asked. I conducted camera surveys across 120 sites (30 sites every 16 days) for two months across 123.67 km2 in an urban city in Eastern Texas, USA. Each camera was on average separated from each by a distance of 641. 35m. My study is an urban carnivore study to see how certain landscape variables influences population density, detection probability of coyotes, bobcats, grey and red fox. I have a good sized data set for each species (e.g., 63 individual coyotes, 29 red fox, 17 bobcats, 12 grey fox).
My question relates to setting up the spatial covariates. I have several detector-level spatial covariates that I would like to include in my analysis. These are continuous covariates (e.g, usage, percent patch, patch area, building density, road density, etc). I added them as columns in the detector file (FallCameras), but I am not sure I wrote the correct code:

Code: Select all
CoyCH <- read.capthist("coyoteFallcaptures", "FallCameras", covnames = "usage" "percpatch" "patcharea" "BLDen" "RDensity", detector = "proximity", fmt = "trapID")
summary(coyCH)
plot(coyCH)
#END


Also, you stated previously that "You can use detector-level covariates in models for detection parameters (e.g. g0, sigma) but not for density; spatial covariates of density must be provided for each mask point." with that said, if I wanted to know if I could model for learned behavior after first detection (Mb) with detector-level covariates? What do you code do you suggest I use for detector-level covariates in models for density (being that I provided spatial covariates of density at each mask pt)?


Thank you in advance for the help,

Jason

Re: Specifying categorical/continuous detector-level covaria

PostPosted: Mon Mar 17, 2014 4:33 pm
by murray.efford
Jason
I'm having trouble understanding your question. Please start a new thread for a new topic - this one is old and only vaguely related.

Try head(covariates(CoyCH)) to check the covariates have been read as you intended. The code you show has an error (lowercase coyCH does not exist?).

Modelling a learned response (b or more likely bk for a site-specific response) does not require covariates. Despite having put in a lot of effort, you will find it hard to distinguish covariate effects on density with these sample sizes.
Murray