Page 1 of 1

removing time effect for a subset of years

PostPosted: Wed Feb 20, 2019 12:56 pm
by splash1199
Hi RMark Users,

First, I'd like to mention that I've been working really hard to learn the basics of Mark/RMark, but I'm still very much a novice.

I'm conducting a joint live-dead recovery analysis on a 20-year goose banding dataset. One of the challenges of the dataset is that there is a 7 year period where there was no banding (so no releases or recaptures). During this time, there were still birds being shot, retrieved, and reported.

I would like to model a time effect for S, p, and r. But to deal with the gap in banding, I would like to 1) set p=0 for years in which there was no banding, and 2) set S and F constant (no time effect) during this period.

I have read "Mark: a gentle introduction" and figured out how to fix p to zero. I'm unsure of how to modify the design data to remove the time effect for non-banding years.

Thanks very much! My code is posted below.

Code: Select all
ld <- convert.inp("./data/SNGO_BLGO_livedead_1998-2018.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
ld <- tidyr::separate(ld, age_sex, c("age", "sex"), " ")
#coerce age and sex into factors
ld$age <- as.factor(ld$age)
ld$sex <- as.factor(ld$sex)

proc = process.data(data = ld,
   model       = "Burnham",
   groups      = c("age", "sex"),
   age.var     = 1,
   initial.age = c(2, 0, 1))

# make the design data from the processed data above
design = make.design.data(proc)

design = add.design.data(data = proc,
   ddl = design,
   parameter="S",
   type = "age",
   bins = c(0, 0.5, 1.5, 20),
   right = FALSE,
   name = "age",
   replace = TRUE)
levels(design$S$age) = c("HY", "SY", "ASY")

#repeat for p
design=add.design.data(data = proc,
   ddl = design,
   parameter="p",
   type = "age",
   bins = c(0, 0.5, 1.5, 20),
   right = FALSE,
   name = "age",
   replace = TRUE)
levels(design$p$age) = c("HY", "SY", "ASY")

#repeat for F
design=add.design.data(data = proc,
   ddl = design,
   parameter="F",
   type = "age",
   bins = c(0, 0.5, 1.5, 20),
   right = FALSE,
   name = "age",
   replace = TRUE)
levels(design$F$age) = c("HY", "SY", "ASY")

#repeat for r
design=add.design.data(data = proc,
   ddl = design,
   parameter="r",
   type = "age",
   bins = c(0, 0.5, 1.5, 20),
   right = FALSE,
   name = "age",
   replace = TRUE)
levels(design$r$age) = c("HY", "SY", "ASY")

full.model = mark(data = proc,
  ddl = design,
  model.parameters = list(
    S = list(formula = ~ -1 + time*age),
    p = list(formula = ~ -1 + time*age,
             fixed = list(time = c(11, 12, 13, 14, 15, 16, 17), value = 0)),
    F = list(formula = ~ sex*age),
    r = list(formula = ~ time*age)),
   invisible = FALSE,
   model = "Burnham")

Re: removing time effect for a subset of years

PostPosted: Wed Feb 20, 2019 9:43 pm
by jlaake
Bin the time field so that you have separate year values except for the 7 year time bin. Look at the function cut which works with numeric values. So you can use it with either Time or as.numeric(as.character(time)). The latter is probably want you want to use for labels that will respond to your years. You should set begin.time in process.data to the first year.

Re: removing time effect for a subset of years

PostPosted: Mon Feb 25, 2019 6:19 pm
by splash1199
Great, thank you very much!

I just want to be 100% sure I understand what RMark is doing in this scenario....my understanding is that it is essentially holding the estimates constant over this time period?
What I don't want is for RMark to treat this 7 year period of no banding (but with recovery data) as one interval.

Re: removing time effect for a subset of years

PostPosted: Mon Feb 25, 2019 7:40 pm
by jlaake
Yes, that is what it will do if you use the binned time for the parameters you want to hold constant over that time period. Do it and then look at the resulting PIM.