Page 1 of 1

Diagonals for 3 age class, 2 sex CJS model

PostPosted: Thu Jan 11, 2018 2:20 pm
by mconner
I am relatively new to RMark, so this may be dumb. I trying to convert a CJS analysis I do every year to RMark; there are 3 age classes, captured as subad yr1, subad yr2, and ad. Below is my code. My problem is that I'm getting pims for the sub2, which need 2 diags, that look like:

group = ageS1.sexF
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
1 27 28 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
2 29 30 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
3 31 32 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
4 33 34 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
5 35 36 7

I want the 28 to be below the 27 on the first year diagonal, and then the second year diagonal to start at 53.

I alos want my second diagonal for S1 to match the first (and only) diag for S2. Can I do this with bins? Thanks for your help. Mary

*****************************************
SIEallowls1990_2016cjs=convert.inp("SIEallowls1990_2016cjs",
group.df=data.frame(age=c("S1","S1","S2","S2","A","A"),sex=c("M","F","M","F","M","F")))

#Data are resorted by grps in alphabet order, so AF,AM,S1F,S2F,S1M,S2M is RMARK order
SIEallowls1990_2016cjs.process=process.data(SIEallowls1990_2016cjs,groups=c("age","sex"),initial.ages=c(2,0,1))

SIEallowls1990_2016cjs.ddl=make.design.data(SIEallowls1990_2016cjs.process)

# Setting the bins here key, 0=start for juvies,1-26=adults - tricky for 3 grps
SIEallowls1990_2016cjs.ddl=add.design.data(SIEallowls1990_2016cjs.process,SIEallowls1990_2016cjs.ddl,"Phi","age",
bins=c(0,1,2,27),
right=FALSE,name="age",replace = T)

Re: Diagonals for 3 age class, 2 sex CJS model

PostPosted: Thu Jan 11, 2018 10:04 pm
by jlaake
Hi Mary

Age bins is what you want to use. Make sure you assign an initial age to each group. Once you add the age bin, look at the design data and see if it is setup the way you want.

Jeff

Re: Diagonals for 3 age class, 2 sex CJS model

PostPosted: Fri Jan 12, 2018 3:36 pm
by mconner
Hi Jeff: So are the bins below 'age bins'? My initial ages for the 3 groups are 2=ad, 0=subad1, 1=subad2.

datacjs.process=process.data(datacjs,groups=c("age","sex"),initial.ages=c(2,0,1))

datacjs.ddl=add.design.data(datacjs.process,datacjs.ddl,parameter="Phi",type="age",
bins=c(0,1,2,27),
right=FALSE,name="age",replace = T)

Thanks for your help! Cheers, Mary

Re: Diagonals for 3 age class, 2 sex CJS model

PostPosted: Fri Jan 12, 2018 10:58 pm
by jlaake
Looks correct to me. You can also add fields with any R commands. You don't need to use add.design.data.