Secondary occasion covariate for psi

posts related to the RMark library, which may not be of general interest to users of 'classic' MARK

Secondary occasion covariate for psi

Postby Artax » Wed Nov 18, 2020 6:13 pm

Hi,

I am using robust design models for single species multi season occupancy models. So I have 4 primary occasions and secondary occasions 81,92,91,64.

I am trying to use merge_design.covariates to add a secondary occasion specific covariate to psi for two of my models using the RDOPG model. I am trying to follow this example viewtopic.php?f=21&t=1736 but I still haven't gotten it to work.

First, I created a ddl

Coyote.RDOPG<-process.data(coyote,model = "RDOccupPG", begin.time=1,
time.intervals = c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,30, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0))

coyote.ddl2 = make.design.data(coyote.RDOPG)
coyote.ddl2$Gamma$eps = 1

Then I made a separate .inp file for the human presence covariate and tried to merge it to psi by adding a time_new column like this:

coyote.ddl2$Psi$time_new<-data.frame(coyote.ddl2$Psi$time,rbind(1:81,1:92,1:91,1:64))

but got this message

Warning message:
In rbind(1:81, 1:92, 1:91, 1:64) :
number of columns of result is not a multiple of vector length (arg 1)

and when I check I can see it only counts up to 92 for some reason for each of the 4 rows.

The human presence .inp file has 46 rows for "ch" for each of my 46 sites and a "freq" of 1. A sample is below.

10000000000000000000000000000000000000000000100000000000000000000000000000000000000000000010000000000000000000000000010000000000000000000000000000000000000.............................................................................................................................................................................
1;

I read it in like this
human_presence<-convert.inp("C:/R_work/human_presence.inp",covariates=NULL,use.comments=FALSE)

and I was hoping to merge it to psi like this

coyote.ddl2$psi<- merge_design.covariates(coyote.ddl2$psi,human_presence,bygroup=FALSE,bytime=TRUE)

but I am not sure how to get this to merge correctly because I can't get the time column to work.

I would appreciate any help. Thanks!
Artax
 
Posts: 3
Joined: Wed Nov 18, 2020 4:07 pm

Re: Secondary occasion covariate for psi

Postby jlaake » Thu Nov 19, 2020 12:05 pm

A few mistakes here.

1) although it won't be entirely relevant you R code is not correct. The following is probably not what you intended.

Code: Select all
data.frame(rbind(1:81,1:92,1:91,1:64))


You are binding vectors into a matrix and the vectors are not of equal length.

2) Psi is not capitalized in the following - case matters
Code: Select all
coyote.ddl2$psi<- merge_design.covariates(coyote.ddl2$psi,human_presence,bygroup=FALSE,bytime=TRUE)


But none of this is entirely relevant to your problem which is that you are trying to assign a covariate measured for secondary occasions to Psi which is a primary occasion parameter. Look at coyote.ddl2$Psi and you will see there is a only a single record per primary occasion. Your human presence covariate measured can only be used on secondary occasions unless you summarize it somehow to a primary level (eg mean value). For something like Psi where there is only a few records you could just add the column directly with a vector of values rather than using merge which is intended for more complex situations.
jlaake
 
Posts: 1479
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA


Return to RMark

Who is online

Users browsing this forum: No registered users and 1 guest

cron