My hypothesis was that it could impact survival at all ages or only for juveniles.
- Code: Select all
# 2. Process the data
cjs_proc <- process.data(rmark_data, model = "CJS", begin.time = start_year,groups="subpop")
# 3. Create design data
cjs_ddl <- make.design.data(cjs_proc)
#Add age column to the design data (age classes)
cjs_ddl$Phi$ageclass3=cut(cjs_ddl$Phi$Age,c(0, 1, 4, Inf), right =FALSE)
levels(cjs_ddl$Phi$ageclass3)=c("Juveniles","Adults(1-3)","Adults(4+)")
# Create an indicator for juveniles (age0)
cjs_ddl$Phi$is_juvenile <- ifelse(cjs_ddl$Phi$ageclass3 == "Juveniles", 1, 0)
# Create an indicator for young adults (age1-3)
cjs_ddl$Phi$youngA <- ifelse(cjs_ddl$Phi$ageclass3 == "Adults(1-3)", 1, 0)
# Create an indicator for older adults (age4+)
cjs_ddl$Phi$olderA <- ifelse(cjs_ddl$Phi$ageclass3 == "Adults(4+)", 1, 0)
#modify another parameter (e.g. "p")
cjs_ddl$p$ageclass6=cut(cjs_ddl$p$Age,c(-Inf,2,3,4,5,6,Inf),right=FALSE)
levels(cjs_ddl$p$ageclass6) <- c("1","2","3","4","5","6+")
#Run set of models
cjs_time_age <- mark(cjs_proc, cjs_ddl, model.parameters = list(
Phi = list(formula=~time:ageclass3),
p = list(formula=~time:ageclass6+subpop,remove.intercept=TRUE,link="logit")))
cjs_time_age_SF <- mark(cjs_proc, cjs_ddl, model.parameters = list(
Phi = list(formula=~time:ageclass3+SFdist),
p = list(formula=~time:ageclass6+subpop,remove.intercept=TRUE,link="logit")))
cjs_time_age_SF_juv <- mark(cjs_proc, cjs_ddl, model.parameters = list(
Phi = list(formula=~is_juvenile:time:SFdist + youngA:time + olderA:time), #seperate age classes, try with SFdist effect on juveniles only
p = list(formula=~time:ageclass6+subpop,remove.intercept=TRUE,link="logit")))
How can I plot how SFdist is impacting:
1. Juveniles survival only?
2. Average survival estimates at any age class of the entire dataset?
I aim to achieve it the same way as in the RMark workshop (12. Covariate Predictions) with the weight effect on survival.
Thanks!