date of survey as covariate

734 views
Skip to first unread message

Neil Carter

unread,
Sep 1, 2011, 9:31:25 AM9/1/11
to unmarked
Hello,
I'm new to unmarked and I'm slowly formatting my data to run some
Royle (pcount) models on tiger abundance. I had a total of 76 camera
trap locations. These were set in 4 spatially adjacent blocks, with 19
traps set for 20 days in block 1, and then those traps were taken down
and moved to the next block for 20 days, and so on. I have input my
observations and site covariate data with no problems. One of my
hypotheses is that detection probability varies over time due to
temperature. Originally, I collapsed the data from 89 surveys (i.e.,
trap-nights) to 24 and included a 'block' indicator covariate to
roughly capture that temporal aspect. It turns out that block 3 and 4
(later in the season when it is much hotter) did have a significant
negative effect on detection. Could I 'uncollapse' the data back to
89 surveys and simply add julian date as a covariate on detection?
Although, I'm not sure how to do that since it is not a site
covariate. I thought I could include julian date as an observation
covariate but that doesn't seem quite right. Observation covariate
must be M x J matrix but julian date would simply be a vector with
length # of surveys. Any help would be immensely appreciated.
Thanks.
Best,
--Neil

Andy Royle

unread,
Sep 1, 2011, 11:59:20 AM9/1/11
to unma...@googlegroups.com, unmarked
hi Neil,
an easty thing to do is take your date vector of length J = 89 (right?) and then replicate it into a matrix with M rows

 X<- matrix(datevector   ,nrow=M,byrow=TRUE)

However, since you have 4 different date vectors (one for each block right?) then you need to construct 4 of these and then rbind() them together basically, assuming that I understand everything correctly.

regards
andy





From: Neil Carter <nhcar...@gmail.com>
To: unmarked <unma...@googlegroups.com>
Date: 09/01/2011 11:54 AM
Subject: [unmarked] date of survey as covariate
Sent by: unma...@googlegroups.com


Neil Carter

unread,
Sep 1, 2011, 12:52:51 PM9/1/11
to unma...@googlegroups.com
Hi Andy,
Thanks.  I have tried creating a matrix with M rows (76 sites) and J columns (89 surveys) with julian dates replicated down M.  I get the following error when I try to construct unmarkedFrame.  

Error in validObject(.Object) : 
  invalid class "unmarkedFrame" object: obsCovData does not have M*obsNum rows.

I tried it again with "NA" in the corresponding cells.  I still get that message.  I have verified that the count data matrix and julian date matrix have identical dimensions.  I suspect it is a housekeeping thing and will continue playing with it. 
Best,
--Neil

Richard Chandler

unread,
Sep 2, 2011, 9:38:17 AM9/2/11
to unma...@googlegroups.com
Hi Neil,

Are you providing obsCovs as a list or as a data.frame? I usually use the list option and format each covariate as a matrix (the way Andy suggested). Then you can do something like:

umf <- unmarkedFramePCount(y=y, obsCovs=list(date=date))

where date is the MxJ matrix, and y has the same dimensions as date.


Hope this helps.

Richard


_____________________________________
Richard Chandler, post-doc
USGS Patuxent Wildlife Research Center
301-497-5643

Neil Carter

unread,
Sep 4, 2011, 11:55:26 AM9/4/11
to unma...@googlegroups.com
Thanks Richard and Andy for helping.  Making the obsCovs appear as a list worked!  
Reply all
Reply to author
Forward
0 new messages