CJS age model with no new animals in last interval

posts related to the RMark library, which may not be of general interest to users of 'classic' MARK

CJS age model with no new animals in last interval

Postby agoldberg » Fri Apr 24, 2020 5:40 pm

Hi, I am working on CJS models where I have multiple groups. I also have 2 age classes. However, for this data set we continue trapping after we stop marking new individuals (we only mark juveniles for the first 2 sessions while we continue to trap them for another 2 sessions hence we have juveniles in interval 1 and 2 and adults in interval 2 and 3). We are interested in time as the age classes may differ as a result of not just age but time (trapping season). Despite having no new individuals trapped in the 3rd and 4th session, MARK still calculates an estimate for the juveniles in the 3rd interval. Any suggestions for how to deal with this? Should I set the 3rd interval equal to the 2nd interval? Or should I somehow (not sure how to do this in RMark but it can be done in MARK) set the juvenile survival (Phi) for the 3rd interval equal to the 2nd interval but allow the 3rd interval of adults differ for the 2nd and 3rd interval? Any other suggestions?

Thanks,
Amanda

Below is my basic code without constraining any parameters:

Code: Select all
buck <- convert.inp("d:/allspec_4sites_nonew.inp",
                     covariates = c("sex","trt","species","site"))

# convert spec2, sex, and trt2 variables to factors so that we can treat them as
# grouping variables in the analysis to ease working with output later
buck$species <- factor(buck$species,
                     levels = c(0, 1,2),
                     labels = c("msp","nmex","pman"))
buck$sex  <- factor(buck$sex,
                     levels = c(0, 1),
                     labels = c("fem", "male")) 
buck$trt  <- factor(buck$trt,
                    levels = c(0, 1),
                    labels = c("Pl", "Vac"))
buck$site  <- factor(buck$site,
                     levels = c(0,1,2,3),
                     labels = c("PJ","fs131","fs127a","fs117"))

buck.process=process.data(buck,model="CJS", time.intervals=c(.858,.775,.833),groups=c("sex","trt","species","site"))
                         
#add 2 age bins
buck.ddl=make.design.data(buck.process)
buck.ddl=add.design.data(buck.process,buck.ddl,parameter="Phi",type="age",
                    bins=c(0,.5,3),name="tages")
buck.ddl=add.design.data(buck.process,buck.ddl,parameter="p",type="age",
                    bins=c(0,1,4),name="tages")

buck.models=function()
{
  Phi.time.adtrt.sex.adspecies.site=list(formula=~time+trt*sex+species*site)
  Phi.site.adtime.adtrt.sex.adspecies.tages=list(formula=~site+time+trt*sex+species*tages)
  Phi.time.adtrt.sex.adtrt.tages.adspecies.tages=list(formula=~time+trt*sex+trt*tages+species*tages)
  Phi.site.adtime.adtrt.sex.adtrt.tages=list(formula=~site+time+trt*sex+trt*tages)
  Phi.time.adtrt.sex.adspecies.sex.adspecies.tages=list(formula=~time+trt*sex+species*sex+species*tages)
  Phi.time.adtages.sex.adtrt.sex.adspecies.tages=list(formula=~time+tages*sex+trt*sex+species*tages)
  Phi.trt.sex.adspecies.tages.adtime.trt=list(formula=~trt*sex+species*tages+time*trt)

 p.1=list(formula=~1)
 p.site.time=list(formula=~site*time)

  cml=create.model.list("CJS")
  results=mark.wrapper(cml,data=buck.process,ddl=buck.ddl)
  return(results)
}
agoldberg
 
Posts: 11
Joined: Sun Aug 23, 2015 9:10 pm

Re: CJS age model with no new animals in last interval

Postby jlaake » Fri Apr 24, 2020 10:50 pm

For each group, cjs has a triangular PIM with a row for each occasion/cohort. You are saying that the juvenile group only is using the first 2 rows and after and after the first entry in each row they are adults. That's fine and even though there are rows after that for time 3 onward there aren't any data so they aren't used in the likelihood and you don't have to make any changes because you are using time in an additive way for age. Thus it is possible to make an estimate of juvenile survival for time 3 onward. Had you used time*age in the model you would have found that those past time 2 would not be estimable.
jlaake
 
Posts: 1295
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: CJS age model with no new animals in last interval

Postby agoldberg » Sat Apr 25, 2020 12:31 pm

Thank you, that explanation makes perfect sense. If I do include an interaction between time and age which results in non-estimable parameter is the best solution to fix the parameter to 0? Or do I leave an un-estimable parameter in the model (not count it in my parameter count) and not be concerned that it is un-estimable because it should be (I don't really want an estimate for it since it is not a real part of the dataset)? Or is the only solution to set the final juvenile estimate equal to the previous one?

If the pim looks like this:
1 2 3
4 3
5

change to:
1 2 3
4 3
4

So essentially it is now estimable. And is there a way to do this in RMark? I know how to do it Mark with PIMS or the design matrix.

Thanks,
Amanda
agoldberg
 
Posts: 11
Joined: Sun Aug 23, 2015 9:10 pm

Re: CJS age model with no new animals in last interval

Postby Morten Frederiksen » Sun Apr 26, 2020 4:27 am

In fact, it doesn't matter which of these solutions you use. There is no information available to estimate survival when no animals were marked, so the deviance and AICc will be identical for the three cases, and estimates of other parameters shoudl be unaffected. Whatever you do, just remember not to present the 'estimate' of first-year survival for the last interval.

Morten
Morten Frederiksen
 
Posts: 41
Joined: Thu May 29, 2003 4:53 am
Location: Roskilde, Denmark

Re: CJS age model with no new animals in last interval

Postby agoldberg » Mon Apr 27, 2020 10:45 am

Morten,
That makes perfect sense. Thank you very much. I really appreciate it.

Amanda
agoldberg
 
Posts: 11
Joined: Sun Aug 23, 2015 9:10 pm

Re: CJS age model with no new animals in last interval

Postby jlaake » Mon Apr 27, 2020 1:11 pm

Actually if you do use time*age, RMark will count the additional non-estimable parameter and the AIC values will not be correct. RMark assumes all of the beta parameters (columns in the design matrix) are estimable unless you tell it to use the count from MARK (adjust argument). I have described in the documentation in several places why I chose to do this. I have seen too many examples where people take the MARK parameter count assuming it is correct and end up fitting overly-complex time dependent models because many of the parameters are at boundaries (phi=1 or p=0). Parameters at boundaries are falsely not included in the MARK count. I chose to use an approach that would result in simpler models by counting all parameters. But I give you the option to use the parameter count from MARK with adjust or to adjust.parameter.count.

Now to answer your question. In RMark you always use the design matrix. You never assign PIM values. So if you think that you can do it with a DM in MARK that is how you would do it in RMark. You just need to be clever and think of design data values to construct the DM you want with a formula. For example, if you wanted time variation for juvenile survival but only for the first 2 occasions. You simply need to create a 0/1 dummy variable that is 1 for juveniles for times 1 and 2 and 0 otherwise. I'll call it juv. The code might look like (look at your design data since I don't know how you have it set)
Code: Select all
ddl$Phi$juv=ifelse(ddl$Phi$time%in%1:2&ddl$Phi$age==0,1,0)


Then you would use juv:time in the model. There are lots of examples of this on phidot and in the documentation where you limit an interaction with a 0/1 dummy variable.
jlaake
 
Posts: 1295
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: CJS age model with no new animals in last interval

Postby agoldberg » Mon May 04, 2020 12:57 pm

Jeff,
Thank you very very much. It took a few tries but I have figured out how to code it. It is a huge lifesaver to understand how to code it in R rather than individually change all the DM's by hand in MARK.

Cheers,
Amanda
agoldberg
 
Posts: 11
Joined: Sun Aug 23, 2015 9:10 pm


Return to RMark

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron