Page 1 of 1

RMARK: Groups in Nest Survival

PostPosted: Fri Nov 07, 2008 3:38 pm
by bacollier
All,
Working with a simple nest survival model in RMark I am having some struggles (apparently) appropriately defining groups. I created a covariate (Group) in the data set, made it a factor on import

> str(vireo.data$Group)
Factor w/ 8 levels "1","2","3","4",..: 1 1 1 1 1 1 1 1 1 2 ...

and based on what I read in the RMark guide I put a groups= statement in my mark() call

dsr.g=mark(vireo.data, nocc=111, model="Nest", model.parameters=list(S=list(formula=~Group)), groups=c("1", "2", "3", "4", "5", "6", "7", "8"))

which then gives me the following error when I run my analysis.

> run.vireo=function()
+ {
+ dsr.g=mark(vireo.data, nocc=111, model="Nest", model.parameters=list(S=list(formula=~Group)), groups=c("1", "2", "3", "4" .... [TRUNCATED]

> vireo.results=run.vireo()
Error in `[.data.frame`(data, , groups[i]) : undefined columns selected

Since process.data does not exist for nest survival datatype (I think) I could not use the groups command there. Do I need to create an dummy variable for each factor level?

Any suggestions?

Bret

Mark 1 October build, using RMark v1.8.7 updated for 1 Oct Mark, R version 2.7.2.

PostPosted: Fri Nov 07, 2008 7:54 pm
by jlaake
Bret-

Proper syntax is

dsr.g=mark(vireo.data, nocc=111, model="Nest", model.parameters=list(S=list(formula=~Group)), groups="Group")


You use the name of the field(s) that define the groups. If you have 2 or more variables you would use groups=c("var1","var2"...) where var1 and var2 would be factor variables.

--jeff

PostPosted: Mon Nov 10, 2008 10:01 am
by bacollier
Thanks Jeff, I was using the c() thinking it needed to be a vector.

So, everyone, a follow up now that I have that fixed: In this nest survival model I am using 100 individual covariates associated with each sampling occasion (day) in the dataset which are stages of the nesting season (1=egg stage, about 10 days, 2=nestling stage, about 15 days).

So, I can use a time-varying individual covariates (outlined in RMARK whats new V. 1.8.2 (26 June 2008)) to estimate DSR for each stage (coded 1 or 2 as above) using plogis.

stage<-1:2
> DSR_WEVI<-plogis((intercept + slope_wevi*stage), lower.tail=T)
> DSR_BCVI<-plogis((intercept + slope_bcvi*stage), lower.tail=T)
> DSR_WEVI
[1] 0.9493673 0.8947853
> DSR_BCVI
[1] 0.9460775 0.8816069


But, I am stuck on how to apply the delta method for individual covariate type models like these as I have only seen them for PIMS based models in MARK? Assuming I extract the vc matrix (below), the only comparisons I am interested in are the 2 stages, but I obviously have 3 (0=not active is included) periods, but, does the same vc matrix hold for both species? I would think not, but I cannot figure it out? I can work out the delta method code myself, but I could use some help on what vc matrix I need to be using.

This is the vc matrix for the best model.

> vireo.results[4]$dsr.Spec.t$results$beta.vcv
[,1] [,2] [,3]
[1,] 0.1868626 -0.11514218 -0.12784094
[2,] -0.1151422 0.08286332 0.07877386
[3,] -0.1278409 0.07877386 0.11384983

Thanks,
Bret