covariates in ORDMS: time since arrival in sec sessions

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

covariates in ORDMS: time since arrival in sec sessions

Postby mlampo » Fri Nov 04, 2011 12:42 pm

I am trying to analyze 26 years of capture histories for turtles using ORDMS in RMark. Most secondary periods have 14 sessions, although some are shorter. I am trying to model the probability of staying in the study area, Phi, as a function of the time since arrival to a secondary period, as suggested on page 15-35 of Mark Book. However, I see no variable that relates to time since arrival to sec-periods in the default ddl table , so I tried adding a covariate using data.frame and merge.design.covariates with no luck. I managed to pull the time vector from the ddl table, compute the new vector using a simple operation(time-cohort) and lined up the time vector with the new vector in the data.frame. However, I get the following error message when I tried to merge the data frame with the ddl table using merge.design.covariates.

Error in `row.names<-.data.frame`(`*tmp*`, value = c("1", "2", "3", "4", :
invalid 'row.names' length

I noticed a post by Anabell with a similar problem, but I could not follow what she did to solve the problem. I appreciate any help.
mlampo
 
Posts: 5
Joined: Thu Nov 03, 2011 5:58 pm

Re: covariates in ORDMS: time since arrival in sec sessions

Postby jlaake » Fri Nov 04, 2011 12:52 pm

You don't have to merge in a covariate. You can use any R commands to create the column that you want. In particular you may be able to use Time and Cohort (Time-Cohort) to compute time since arrival if I'm understanding what you want. Send me a snippet of your ddl$Phi if that doesn't help.

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

Re: covariates in ORDMS: time since arrival in sec sessions

Postby mlampo » Fri Nov 04, 2011 3:13 pm

Here is the snipped ddl$Phi
group cohort age time stratum session Cohort Age Time 1 U
1 1 1 0 1 1 1 0 0 0 1 0
2 1 1 0 2 1 1 0 0 1 1 0
3 1 1 0 3 1 1 0 0 2 1 0
4 1 1 0 4 1 1 0 0 3 1 0
5 1 1 0 5 1 1 0 0 4 1 0
6 1 1 0 6 1 1 0 0 5 1 0
7 1 1 0 7 1 1 0 0 6 1 0
8 1 1 0 8 1 1 0 0 7 1 0
9 1 1 0 9 1 1 0 0 8 1 0
10 1 1 0 10 1 1 0 0 9 1 0
11 1 1 0 11 1 1 0 0 10 1 0
12 1 1 0 12 1 1 0 0 11 1 0
13 1 1 0 13 1 1 0 0 12 1 0
14 1 2 0 2 1 1 1 0 1 1 0

I tried defining Phi as list(formula=~(Time-Cohort)) but when I look at the PIM matrix in the ouput file it looks like a time dependent parameter

group=1 Phi 1:Stratum1 Session 1 rows=13 cols=13 Triang ;
INPUT --- 3 4 5 6 7 8 9 10 11 12 13 14 15 ;
INPUT --- 4 5 6 7 8 9 10 11 12 13 14 15 ;
INPUT --- 5 6 7 8 9 10 11 12 13 14 15 ;
INPUT --- 6 7 8 9 10 11 12 13 14 15 ;
mlampo
 
Posts: 5
Joined: Thu Nov 03, 2011 5:58 pm

Re: covariates in ORDMS: time since arrival in sec sessions

Postby jlaake » Fri Nov 04, 2011 3:43 pm

You could do it that way but you would want

~I(Time-Cohort)

but what I was suggesting was to create the design data as in

ddl$Phi$TimeSinceArrival=ddl$Phi$Time-ddl$Phi$Cohort

Then use ~TimeSinceArrival

You can create any design data that you want or need and then use it in the formula. There are several examples of this in Appendix C of Cooch and White and the Workshop notes. You may want to spend some more time with the documentation.

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

Re: covariates in ORDMS: time since arrival in sec sessions

Postby mlampo » Fri Nov 04, 2011 4:52 pm

Thanks Jeff. Problem solved. I'll review the documentation again.
ML
mlampo
 
Posts: 5
Joined: Thu Nov 03, 2011 5:58 pm

Re: covariates in ORDMS: time since arrival in sec sessions

Postby mlampo » Mon Nov 07, 2011 1:39 pm

In running the ORDMS with constant probability of entry, pent, I am getting a constant value for all years except for those that have a fewer secondary sessions.

I created a grouping index as suggested in the Appendix C:
Code: Select all
up2=as.numeric(row.names(aves.ddl$pent[aves.ddl$pent$stratum=="U",]))


and I defined pent as follows:
Code: Select all
pent.dot=list(formula=~1,fixed=list(index=up2,value=0))


However, in my output all pent values are identical except for those that correspond to primary sessions 5, 20-26 that have fewer secondary sessions. All other primary sessions have 14 secondary sessions. My time interval was defined as follows:

Code: Select all
t.int<-c(0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0)


I appreciate if you can help me.

best regards,
margarita
mlampo
 
Posts: 5
Joined: Thu Nov 03, 2011 5:58 pm

Re: covariates in ORDMS: time since arrival in sec sessions

Postby jlaake » Mon Nov 07, 2011 1:53 pm

With the constant model it is constant on the link space but not in the real space if you have different numbers of occasions. Below is a snippet from the MARK help for mlogit

The multinomial logit link (MLogit) function is useful for constraining a set of parameters to have a sum <= to 1. A common application of this link function would be the psi parameters of a multi-state model. The multinomial logit works as follows. Assume that each of the transition parameters from state A have their own beta value, so that A to B is B1, A to C is B2, and A to D is B3. To constrain these 3 parameters to sum to <= 1, the multinomial logit link works as follows:

psi A to B = exp(B1)/[1 + exp(B1) + exp(B2) + exp(B3)]
psi A to C = exp(B2)/[1 + exp(B1) + exp(B2) + exp(B3)]
psi A to D = exp(B3)/[1 + exp(B1) + exp(B2) + exp(B3)]

That is for Psi but it works the same for pent. A constant model implies B1=B2=B3. You can see that the real parameter value will depend on how many B's there are. In the model that you specified what will shift will be pent(0) which is computed by subtraction.

Thinking out loud here but if you use the logit link for pent that may give you what you want but it may run into convergence issues. Hope this helps.

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

Re: covariates in ORDMS: time since arrival in sec sessions

Postby mlampo » Tue Nov 08, 2011 2:28 pm

Thanks Jeff, the logit link worked although, as you suspected, it took a long time to converge. Just to make sure I understood, that problem should not arise if pent is a function of time or Time, so in those cases, I do not need to write the mlogit link function in the code?
mlampo
 
Posts: 5
Joined: Thu Nov 03, 2011 5:58 pm

Re: covariates in ORDMS: time since arrival in sec sessions

Postby jlaake » Tue Nov 08, 2011 3:12 pm

Because this is ORDMS your pent is session specific correct? If you use ~time or ~Time it will try to use the same model across sessions. Because you have a different number of occasions per session, you still have the same problem as with the constant model. Look at the definition in the previous post and try different numbers of occasions. The only way you can use mlogit and specify what you want is with ~-1+session:time where the time values differ across sessions. Otherwise, you'll need to use the logit link.

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


Return to RMark

Who is online

Users browsing this forum: No registered users and 1 guest

cron