I am performing a known-fate analysis on the “survival” of volunteers in a mink eradication project, where their survival is analogous to a volunteer staying within the project for a given time step or leaving (I’m am sure some of you will be thinking this is madness!).
Before I get onto that, I have been trying to recreate the MARK 16.5.1. Staggered entry – worked example in RMark to check my understanding. Although I have managed to recreate it, I have done it only with substantial manual editing of the design matrix.
I added a “Cohort” column to the data frame and assigned a value to each individual which I used to group the data:
- ch freq Cohort
1 1100000000 865 1
2 1011000000 126 1
3 1010110000 113 1
4 1010101100 71 1
5 1010101011 71 1
6 1010101010 254 1
7 0011000000 921 2
8 0010110000 116 2
9 0010101100 102 2
10 0010101011 75 2
11 0010101010 286 2
12 0000110000 876 3
13 0000101100 121 3
14 0000101011 97 3
15 0000101010 406 3
16 0000001100 909 4
17 0000001011 119 4
18 0000001010 472 4
19 0000000011 916 5
20 0000000010 584 5
- Code: Select all
staggered.process <- process.data(staggered, model="Known", groups="Cohort", begin.time=2000,initial.age=0)
staggered.ddl <- make.design.data(staggered.process)
However my issues start with the .ddl
> staggered.ddl
group age time Age Time Cohort
1 1 1 2001 1 0 1
2 1 2 2002 2 1 1
3 1 3 2003 3 2 1
4 1 4 2004 4 3 1
5 1 5 2005 5 4 1
6 2 1 2001 1 0 2
7 2 2 2002 2 1 2
8 2 3 2003 3 2 2
9 2 4 2004 4 3 2
10 2 5 2005 5 4 2
11 3 1 2001 1 0 3
12 3 2 2002 2 1 3
13 3 3 2003 3 2 3
14 3 4 2004 4 3 3
15 3 5 2005 5 4 3
16 4 1 2001 1 0 4
17 4 2 2002 2 1 4
18 4 3 2003 3 2 4
19 4 4 2004 4 3 4
20 4 5 2005 5 4 4
21 5 1 2001 1 0 5
22 5 2 2002 2 1 5
23 5 3 2003 3 2 5
24 5 4 2004 4 3 5
25 5 5 2005 5 4 5
The make.design.data step generates a row for every cohort for every year. This is an issue because, for example, cohort 5 individuals are only added in 2005 where they should be aged 1 - not 5! I can address this issue by deleting the pointless rows (structural lack of data), then editing the age class manually.
Am I missing a clever trick in the import process where cohort can be recognised and and appropriate .ddl's generated? - (more akin to the age_ya example in "C.15. More complex examples" - where I would only have one entry for my 2005 cohort with an age of 1)?
Manually editing the .ddl will get very tiresome - especially as my actual data has 9 cohorts (each with 5 sub classifications) and I just cant think of a cunning fix!
Thanks in advance for any help!
(Sorry I cant find a better way to show those lists)
Chris