marked as pup,juvenile and adult and age dependent

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

marked as pup,juvenile and adult and age dependent

Postby Knabi » Mon Nov 06, 2017 4:55 pm

Hello,
I struggle with coding an age-dependent model with 3 age classes and where the animals have been captured in all of these 3 age classes. i.e. they were captured as young, as sub-adult and as adult and pups pass through the age-class pup (0-<1year), then juvenile (1-3years) and then they are considered adult (4 years and older), the juveniles pass only through the stage of juvenile and adult, and adult (obviously) only being adult. The model I aim for beside others is e.g. (Phi(3a-t/t but same for the juveniles of age 1,2 and 3/dot).

At the moment I have that as R code:

Code: Select all
#create input file
GSL_F_A <- convert.inp("Inputfile_RMark_CJS_marked_p_j_a_02112017.inp", group.df = data.frame(age=c("p","j","a")), use.comments = TRUE)

#Process data
GSL_F_A.process <- process.data(GSL_F_A,model="CJS", groups="age", initial.age=c(4,1,0),begin.time=2003)

#create design data
GSL_F_A.ddl=make.design.data(GSL_F_A.process)

#add age classes
GSL_F_A.ddl=add.design.data(GSL_F_A.process, GSL_F_A.ddl,parameter="Phi", type="age", bins=c(0,1,4,18),name="ageclass", right=FALSE)

#Add dummy variables: marked as pup (1, 0), marked as juvenile (0, 1), marked as adult (1,1)
GSL_F_A.ddl$Phi$marked.as.pup=0
GSL_F_A.ddl$Phi$marked.as.pup[GSL_F_A.ddl$Phi$group!="j"]=1
GSL_F_A.ddl$Phi$marked.as.juvenile=0
GSL_F_A.ddl$Phi$marked.as.juvenile[GSL_F_A.ddl$Phi$group!="p"]=1

#for p
GSL_F_A.ddl$p$marked.as.pup=0
GSL_F_A.ddl$p$marked.as.pup[GSL_F_A.ddl$p$group=="p"]=1

# set up models
GSL_F_A.models=function() { Phi.ageclass.time.plus.marked.as.adult=list(formula=~ageclass*time+marked.as.pup+marked.as.juvenile)
  Phi.ageclass.time=list(formula=~ageclass*time)
  p.marked.as.adult=list(formula=~marked.as.pup)
  cml=create.model.list("CJS")
  results=mark.wrapper(cml,data=GSL_F_A.process,ddl=GSL_F_A.ddl,output=FALSE)
  return(results) }

ageclass.results=GSL_F_A.models()

ageclass.results



I think my dummy definition of marked as pup, juvenile and adult might cause some trouble. I also don't know how to implement that the juveniles of 1, 2 and 3 don't differ in the survival.

Any hints are appreciated, thanks a lot!
Knabi
 
Posts: 6
Joined: Fri Feb 24, 2017 12:30 pm

Re: marked as pup,juvenile and adult and age dependent

Postby jlaake » Tue Nov 07, 2017 9:56 am

What is the problem? Are you not getting the results you expect. You don't know the actual ages of juveniles and are assigning them all to age 1 but other than that I don't see a problem in what you posted.
jlaake
 
Posts: 1417
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: marked as pup,juvenile and adult and age dependent

Postby Knabi » Tue Nov 07, 2017 12:39 pm

My question was probably not clearly formulated, sorry.
I was wondering how I can code that phi of the juvenile stage is time-dependent but not different betweeen the 3 years when the animals are in the juvenile phase, i.e. that the DM for the "tagged as juvenile group" would look like this:
5 5 5 x x x x x
.. 6 6 6 x x x x
.... 7 7 7 x x x
...... 8 8 8 x x
........ 9 9 9 x
.......... 10 10
.............. 11
(... are just space holders, x would be adult stage)
Knabi
 
Posts: 6
Joined: Fri Feb 24, 2017 12:30 pm

Re: marked as pup,juvenile and adult and age dependent

Postby jlaake » Tue Nov 07, 2017 12:46 pm

what you showed via the PIM isn't a time effect but is a cohort effect for juveniles.

cohort:marked.as.juvenile will create that structure for those that are marked as juveniles but recognize that pups will also go through juvenile stage but won't have this structure.

--jeff
jlaake
 
Posts: 1417
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: marked as pup,juvenile and adult and age dependent

Postby Knabi » Tue Nov 07, 2017 2:42 pm

:oops: absolutely.
Thanks for the hint/correction!!
Knabi
 
Posts: 6
Joined: Fri Feb 24, 2017 12:30 pm

Re: marked as pup,juvenile and adult and age dependent

Postby Knabi » Thu Nov 09, 2017 7:07 pm

I went on with my models and also did some as comparison in Mark. I am happy now with what I see in the PIMs however, the DMs are not the way I want them:( I'm pretty sure it's because of the way I consider or not manage to consider the interaction terms in my formulas. So for example if I run:

Code: Select all
GSL_F_A.age.dependent.models=function()
{
  Phi.ageclass.p.time.j.time.a.time.group = list(formula= ~ p:time+j:time+a:time+marked.as.pup+marked.as.juvenile) #correct
  Phi.ageclass.p.time.j.time.a.time.group.interaction = list(formula= ~ p:time+j:time+a:time*(marked.as.pup+marked.as.juvenile))
  Phi.ageclass.p.time.j.time.a.time.group.interaction = list(formula= ~ p:time+j:time+a:time*(marked.as.pup+marked.as.juvenile))
  p.dot = list(formula= ~1)
  cml =create.model.list("CJS")
  results =mark.wrapper(cml,data=GSL_F_A.process,ddl=GSL_F_A.ddl,output=FALSE)
  return(results)
}
age.dependent.results=GSL_F_A.age.dependent.models()

age.dependent.results


I get 2 different DMs which makes sense, however, non of them is what I want...
How would my formula have to look like to get a model with marked at three different age classes and age time dependence in each age class [Phi(3a-t/t/t)p(dot)]?
In Mark I did three seperate intercepts for each agemarked group and then in the marked as pup group 2 columns for the age classes, in the marked as juvenile 1 column for the age class, and in the adult no column for the age class and then the corresponding interactions between age and time for each group (not sure if that is a clear explanation, would be easier to send a screen shot). I don't manage the same in RMark... :?

Thanks!!
Knabi
 
Posts: 6
Joined: Fri Feb 24, 2017 12:30 pm


Return to RMark

Who is online

Users browsing this forum: Google [Bot] and 18 guests