Problems adding covariates to constrain "session" on CRDMS

Hi,
I am running a CRDMS analysis in RMark using 740ish capture histories with 18 primary occassions*5 secondary occassions each. I would like to modify the structure of the design data to merge some estimates of "p" and "c".
When trying to modify the design structure of primary session estimates of "p" ("session" in the design data) , I am finding problems with using some functions related to the fact that the functions expect a field of type "time" instead of type "session" (SEE BELOW). However, when modifying the design structure of secondary sessions in "c", I have no problems because there is a field called "time" (which actually stands for secondary session or visit for that parameter). I'm sure that I am missing something, but I have hanged around through postings and manuals but haven't found anything related.
Preliminar code:
Problems start when I try to merge some primary sessions by using bins through the function "add.design.data"
I get the following message
If I try it in a different way, by using "merge_design.covariates" and a new categorical covariate
I get another error message (below)
Now, when defining a covariate "night" in parameter "c" that accounts for different capture rates morning vs. night shifts, everything works fine
This problem also arises when using formulas with "p"
Can anyone help me to see what am I missing?
Cheers,
N
I am running a CRDMS analysis in RMark using 740ish capture histories with 18 primary occassions*5 secondary occassions each. I would like to modify the structure of the design data to merge some estimates of "p" and "c".
When trying to modify the design structure of primary session estimates of "p" ("session" in the design data) , I am finding problems with using some functions related to the fact that the functions expect a field of type "time" instead of type "session" (SEE BELOW). However, when modifying the design structure of secondary sessions in "c", I have no problems because there is a field called "time" (which actually stands for secondary session or visit for that parameter). I'm sure that I am missing something, but I have hanged around through postings and manuals but haven't found anything related.
Preliminar code:
- Code: Select all
grazing=convert.inp("Grazing_Robust_RMARK",group.df=data.frame(sex=c(rep("Male",4),rep("Female",4)),grid=rep(c("A2","A4","E2","E4"),2)))
summary(grazing)
#set time intervals with 18 primary periods each with 5 secondary occasions
t.int<-c(rep(c(0,0,0,0,1),17),c(0,0,0,0))
grazing.processed=process.data(grazing,model="CRDMS",time.interval=t.int,groups=c("sex","grid"))
grazing.ddl=make.design.data(grazing.processed)
Problems start when I try to merge some primary sessions by using bins through the function "add.design.data"
- Code: Select all
grazing.ddl=add.design.data(grazing.processed, grazing.ddl, parameter="p", type="session",
bins=c(0,1,2,3,4,5,6,13,14,15,16,17,18),name="newsession",right="FALSE",replace=TRUE)
I get the following message
- Code: Select all
#Error in add.design.data(grazing.processed, grazing.ddl, parameter = "p", :
#invalid type
If I try it in a different way, by using "merge_design.covariates" and a new categorical covariate
- Code: Select all
Monthdf=data.frame(session=1:18,Month=c("May06","June06","July06","Aug06","Sept06","Oct06","Winter06","Winter06","Winter06","Winter06","Winter06","Winter06","May07","June07","July07","Aug07","Sept07",
"Oct07"))
grazing.ddl$p= merge_design.covariates(grazing.ddl$p,Monthdf)
I get another error message (below)
- Code: Select all
#Error in merge_design.covariates(grazing.ddl$p, Monthdf) :
#Monthdf does not contain field named time
Now, when defining a covariate "night" in parameter "c" that accounts for different capture rates morning vs. night shifts, everything works fine
- Code: Select all
grazing.ddl$c$night=0 #dummy field "night" in c with all 0s
grazing.ddl$c$night[grazing.ddl$c$time==2|grazing.ddl$c$time==4]=1 #dummy night (=1) affects captures 2 and 4 of every session
This problem also arises when using formulas with "p"
- Code: Select all
p.session.stratum.sex.grid.coffset=list(formula=session*stratum*sex*grid+c:night, share=TRUE)
#Error: object 'session' not found
Can anyone help me to see what am I missing?
Cheers,
N