I need some clarification on estimates of fidelity in live-dead models. In RMARK: A gentle introduction, fidelity is defined as the probability that a bird that has survived from year i to i+1 has returned to capture site.
Given this definition, why does RMARK estimate fidelity for the hatch-year age class, given that no birds return at t+1 as hatch years?
In my case, I am modelling survival of waterfowl banded as HY, SY, ASY, and I don't think it makes sense to have HY fidelity estimates. But I can't seem to make the model run.
I have provided my code below. I would like to model F as
"~ -1 + sy + asy:sex" but the model will not run without hy included, "~ -1 + hy + sy + asy:sex"
any ideas and or clarification?
- Code: Select all
pre.df <- convert.inp("./data/SNGO_BLGO_livedead_1998-2007.inp", group.df = data.frame(age_sex=c("HY Male", "HY Female", "SY Male", "SY Female", "ASY Male", "ASY Female")) , use.comments = TRUE)
#split the age and sex information into two separate columns
pre.df <- tidyr::separate(pre.df, age_sex, c("age", "sex"), " ")
#coerce age and sex into factors
pre.df$age <- as.factor(pre.df$age)
pre.df$sex <- as.factor(pre.df$sex)
```
#process the data by defining the model type as "Burnham" and the groups in the data
pre.proc = process.data(data = pre.df,
model = "Burnham",
groups = c("age", "sex"),
age.var = 1,
initial.age = c(2, 0, 1))
#ASY (2), HY (0), SY (1)
# make the design data from the process data above
pre.ddl = make.design.data(pre.proc)
#add the correct binning to the design data so that individuals that were marked as HY are SY
#in their second year of life, and ASY in their third year, etc
pre.ddl=add.design.data(data = pre.proc,
ddl = pre.ddl,
parameter="S",
type = "age",
bins = c(0, 0.5, 1.5, 30),
right = FALSE,
name = "age",
replace = TRUE)
levels(pre.ddl$S$age) = c("HY", "SY", "ASY")
#add a dummy variables; all three age classes
pre.ddl$S$hy = ifelse(pre.ddl$S$age == "HY", 1, 0)
pre.ddl$S$sy = ifelse(pre.ddl$S$age == "SY", 1, 0)
pre.ddl$S$asy = ifelse(pre.ddl$S$age == "ASY", 1, 0)
#add a dummy variables for HY and AHY
pre.ddl$S$adult = ifelse(pre.ddl$S$age != "HY", 1, 0)
pre.ddl$S$young = ifelse(pre.ddl$S$age == "HY", 1, 0)
#pre.ddl$S$adultclass = ifelse(pre.ddl$S$age == "HY", "HY", "AHY")
#repeat for p
pre.ddl=add.design.data(data = pre.proc,
ddl = pre.ddl,
parameter="p",
type = "age",
bins = c(0, 0.5, 1.5, 30),
right = FALSE,
name = "age",
replace = TRUE)
levels(pre.ddl$p$age) = c("HY", "SY", "ASY")
#add a dummy variables; all three age classes
pre.ddl$p$hy = ifelse(pre.ddl$p$age == "HY", 1, 0)
pre.ddl$p$sy = ifelse(pre.ddl$p$age == "SY", 1, 0)
pre.ddl$p$asy = ifelse(pre.ddl$p$age == "ASY", 1, 0)
#add a dummy variables for HY and AHY
pre.ddl$p$adult = ifelse(pre.ddl$p$age != "HY", 1, 0)
pre.ddl$p$young = ifelse(pre.ddl$p$age == "HY", 1, 0)
#repeat for F
pre.ddl=add.design.data(data = pre.proc,
ddl = pre.ddl,
parameter="F",
type = "age",
bins = c(0, 0.5, 1.5, 30),
right = FALSE,
name = "age",
replace = TRUE)
levels(pre.ddl$F$age) = c("HY", "SY", "ASY")
#dummy variables for all three age classes
pre.ddl$F$hy = ifelse(pre.ddl$F$age == "HY", 1, 0)
pre.ddl$F$sy = ifelse(pre.ddl$F$age == "SY", 1, 0)
pre.ddl$F$asy = ifelse(pre.ddl$F$age == "ASY", 1, 0)
#dummy variables for HY and AHY
pre.ddl$F$adult = ifelse(pre.ddl$F$age != "HY", 1, 0)
pre.ddl$F$young = ifelse(pre.ddl$F$age == "HY", 1, 0)
#repeat for r
pre.ddl=add.design.data(data = pre.proc,
ddl = pre.ddl,
parameter="r",
type = "age",
bins = c(0, 0.5, 30),
right = FALSE,
name = "age",
replace = TRUE)
levels(pre.ddl$r$age) = c("HY", "AHY")
#dummy variables for HY and AHY
pre.ddl$r$adult = ifelse(pre.ddl$r$age != "HY", 1, 0)
pre.ddl$r$young = ifelse(pre.ddl$r$age == "HY", 1, 0)
test2 = RMark::mark(data = pre.proc,
ddl = pre.ddl,
model.parameters = list(
S = list(formula = ~ -1 + age + time),
p = list(formula = ~ -1 + sy + asy:time),
F = list(formula = ~ -1 + hy + sy + asy:sex),
r = list(formula = ~ -1 + young + adult:sex)),
invisible = FALSE,
model = "Burnham")
```