assigning initial.ages

Hello,
I'm working on a CJS model where animal ages are continuous and can be anything from 0.5 to 15 at first capture. I managed to write a model where ages are given as a time-varying covariate, but am finding it a bit cumbersome. However, I can't figure out how to assign initial.ages correctly in my setup, so that they only depend on the year of birth. Any help would be appreciated.
Here's a toy dataset:
## data processing
I'm working on a CJS model where animal ages are continuous and can be anything from 0.5 to 15 at first capture. I managed to write a model where ages are given as a time-varying covariate, but am finding it a bit cumbersome. However, I can't figure out how to assign initial.ages correctly in my setup, so that they only depend on the year of birth. Any help would be appreciated.
Here's a toy dataset:
- Code: Select all
df <- structure(list(ch = c("010000000", "001000000", "000100000", "000010000", "000010000", "000001000", "000001000", "000000100", "100000000", "100000000", "000000010", "010000000", "000000010",
"000000010", "000000001", "000100000", "000000001", "000100000", "000100000", "000001000", "000001000", "000001000", "000001000", "000001000", "000000100", "110000000", "000000010", "001000000", "000000001", "000000001"), BirthYear = c("2009", "2009", "2009", "2009", "2009", "2009", "2009", "2009", "2005", "2005", "2009", "2005", "2009", "2009", "2009", "2005", "2009", "2005", "2005", "2005", "2005", "2005", "2005", "2005", "2005", "2001", "2005", "2001", "2005", "2001"), Age.Occ1 = c(3.6, 3.6, 3.6, 3.6, 3.6, 3.6, 3.6, 3.6, 7.6, 7.6, 3.6, 7.6, 3.6, 3.6, 3.6, 7.6, 3.6, 7.6, 7.6, 7.6, 7.6, 7.6, 7.6, 7.6, 7.6, 11.6, 7.6, 11.6, 7.6, 11.6), Age.firstcap = c(4.1, 4.7, 5.1, 5.7, 5.7, 6.1, 6.1, 7.1, 7.7, 7.7, 8.1, 8.1, 8.1, 8.1, 9.1, 9.1, 9.1, 9.1, 9.1, 10.1, 10.1, 10.1, 10.1, 10.1, 11.1, 11.7, 12.1, 12.7, 13.1, 17.1)), row.names = c(NA, -30L), class = "data.frame")
## data processing
- Code: Select all
library(RMark)
library(ggplot2)
data1.proc <- process.data(df, model="CJS", groups = c("BirthYear", "Age.firstcap"), age.var = 2, initial.ages = unique(df$Age.firstcap))
data1.ddl <- make.design.data(data1.proc)
# this shows the issue - the ages should form a single line per panel...
ggplot(data1.ddl$p) +
geom_line(aes(x = time, y = Age, colour = BirthYear, group = group)) +
facet_wrap(~ BirthYear)