Correct specifications of mlogit in MARK and RMARK

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

Correct specifications of mlogit in MARK and RMARK

Postby Bermad » Mon May 08, 2017 6:01 am

I would like to ask how I should specify in MARK and RMark the mlogit in order to calculate the transition probabilities in a multistate model with 3 states. Specifically, I am trying to calculate the estimates of the next model:
Phi{.} Psi{t} p{.}

The multistate model has 3 states, and I would like to allow exclusively the next transitions:
A -> B
B -> C
C -> B

In MARK, I specify a new Mlogit() parameter for each combination time step and transition because the Psi parameter is time varying. For example in the case that I would have 4 sampling occasions, the parameters would be:

Code: Select all
   PsiAB <- Mlogit(1) # Sampling occasion 2
   PsiAB <- Mlogit(2) # Sampling occasion 3
   PsiAB <- Mlogit(3) # Sampling occasion 4

   PsiBC <- Mlogit(4) # Sampling occasion 2
   PsiBC <- Mlogit(5) # Sampling occasion 3
   PsiBC <- Mlogit(6) # Sampling occasion 4

   PsiCB <- Mlogit(7) # Sampling occasion 2
   PsiCB <- Mlogit(8) # Sampling occasion 3
   PsiCB <- Mlogit(9) # Sampling occasion 4


When I read the MARK book, I understood that I should specify a new parameter "Mlogit()" for each parameter I want to estimate. I assumed I should create a new Mlogit for each combination of transition and time because the transitions probabilities are time varying. Furthermore, I put as constant and fixed as 0 the rest of the transitions (A->C / B->A / C->A). Is it right?

RMark
I would like to run the same model in MARK, however I am not sure how to specify correctly the transitions. So first I did:

(1) Process data, specifying regular time periods between sampling occassions.
Code: Select all
model_process <- process.data (input, model="Multistrata", time.intervals = rep(1, 3))


(2) Make design data
Code: Select all
model_make=make.design.data(model_process)


(3) Fix as 0 the impossible transitions
Code: Select all
model_make$Psi$fix=NA
model_make$Psi$fix[model_make$Psi$A & model_make$Psi$toC] <- 0
model_make$Psi$fix[model_make$Psi$B & model_make$Psi$toA] <- 0
model_make$Psi$fix[model_make$Psi$C & model_make$Psi$toA] <- 0


(4) Estimate a p and Phi constant estimates per state, and a time-varying estimates for Psi per state
Code: Select all
p.dot <- list(formula=~1+stratum)
Phi.dot=list(formula=~1+stratum)
Psi.time=list(formula=~1+time+stratum)


(5) Run the model
Code: Select all
model_mark <- mark (model_process, model_make, model.parameters = list(S=Phi.dot, p=p.dot, Psi=Psi.time))


The problem is that I got totally different estimates between MARK and RMark, and it should be because I am not specifying properly the Mlogit in RMark.
Could you tell me, how is the code for estimating time-varying estimates of the Psi parameters?
Thanks in advance,
Bermad
 
Posts: 7
Joined: Wed Jun 01, 2016 4:19 am

Re: Correct specifications of mlogit in MARK and RMARK

Postby jlaake » Tue May 09, 2017 9:10 am

RMark handles specification of the mlogit(x) values and you needn't do that as you do in the MARK interface. What is not clear from your post is what model you fit in MARK that you are comparing to RMark. As you said in an email to me, RMark uses MARK to fit the model so the question is really what model are you fitting in each. You posted that you are fitting Psi(t) (in MARK) but then the formula you gave RMark was ~stratum+time for Psi which is not the same. Not sure why you are including ~1 because it is redundant as intercept is assumed.

Please read the sticky post above about what to do if MARK and RMark results differ. The most likely difference in this case is the design matrices differ. You say the estimates differ but you don't say what estimates differ. The beta's or the real's?

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

Re: Correct specifications of mlogit in MARK and RMARK

Postby Bermad » Thu May 11, 2017 4:14 am

I have repeated the analysis removing the intercept from the RMark code, although it is not related with my problem. I would like to detail a bit more my doubt in order to facilitate an answer.

Goal
To calculate the different time varying Psi parameters for each stratum. In a hypothetical case with three time periods it would be:
    1.- PsiAB{time2}
    2.- PsiAB{time3}

    3.- PsiBC{time2}
    4.- PsiBC{time3}

    5.- PsiCB{time2}
    6.- PsiCB{time3}
MARK
I specified in the Parameter Index Matrix that each status (A, B and C) should have different time varying estimates. Specifically, I calculated the next estimates:
    pA{.}
    pB{.}
    pC{.}
    PsiAB{t}
    PsiBC{t}
    PsiCB{t}
    PhiA{.}
    PhiB{.}
    PhiC{.}

I specified a different Mlogit for each combination Time x Psi parameter, for example using only two time periods:
Code: Select all
PsiAB{t1} <- Mlogit(1)
PsiAB{t2} <- Mlogit(2)
PsiBC{t1} <- Mlogit(3)
PsiBC{t2} <- Mlogit(4)
PsiCB{t1} <- Mlogit(5)
PsiCB{t2} <- Mlogit(6)


So in a hypothetical case with three time periods I am calculating 12 parameters:
    1.- PhiA
    2.- PhiB
    3.- PhiC
    4.- pA
    5.- pB
    6.- pC
    7.- PsiAB{time2}
    8.- PsiAB{time3}
    9.- PsiBC{time2}
    10.- PsiBC{time3}
    11.- PsiCB{time2}
    12.- PsiCB{time3}

RMark
In order to get the same model using RMARK I specified the next model:
Code: Select all
Phi=~stratum
p=~stratum
Psi=~stratum+time


However I keep having different results between MARK and RMark. Please could you tell what I am doing different in MARK and RMark?

Thanks in advance,
Bermad
 
Posts: 7
Joined: Wed Jun 01, 2016 4:19 am

Re: Correct specifications of mlogit in MARK and RMARK

Postby cooch » Thu May 11, 2017 8:05 am

Bermad wrote:In MARK, I specify a new Mlogit() parameter for each combination time step and transition because the Psi parameter is time varying. For example in the case that I would have 4 sampling occasions, the parameters would be:

Code: Select all
      PsiAB <- Mlogit(1) # Sampling occasion 2
   PsiAB <- Mlogit(2) # Sampling occasion 3
   PsiAB <- Mlogit(3) # Sampling occasion 4

   PsiBC <- Mlogit(4) # Sampling occasion 2
   PsiBC <- Mlogit(5) # Sampling occasion 3
   PsiBC <- Mlogit(6) # Sampling occasion 4

   PsiCB <- Mlogit(7) # Sampling occasion 2
   PsiCB <- Mlogit(8) # Sampling occasion 3
   PsiCB <- Mlogit(9) # Sampling occasion 4


When I read the MARK book, I understood that I should specify a new parameter "Mlogit()" for each parameter I want to estimate. I assumed I should create a new Mlogit for each combination of transition and time because the transitions probabilities are time varying. Furthermore, I put as constant and fixed as 0 the rest of the transitions (A->C / B->A / C->A). Is it right?


Not quite -- for 3 states, full time-dependence, 3 intervals (4 sampling occasions), there are 18 \psi parameters. The MLogit links would be specified as:

Code: Select all
 PsiAB <- Mlogit(1) # interval 1
   PsiAB <- Mlogit(2) # interval 2
   PsiAB <- Mlogit(3) # interval 3

   PsiAC <- Mlogit(1) # interval 1
   PsiAC <- Mlogit(2) # interval 2
   PsiAC <- Mlogit(3) # interval 3

   PsiBA <- Mlogit(4) # interval 1
   PsiBA <- Mlogit(5) # interval 2
   PsiBA <- Mlogit(6) # interval 3

   PsiBC <- Mlogit(4) # interval 1
   PsiBC <- Mlogit(5) # interval 2
   PsiBC <- Mlogit(6) # interval 3

        PsiCA <- Mlogit(7) # interval 1
   PsiCA <- Mlogit(8) # interval 2
   PsiCA <- Mlogit(9) # interval 3

   PsiCB <- Mlogit(7) # interval 1
   PsiCB <- Mlogit(8) # interval 2
   PsiCB <- Mlogit(9) # interval 3

cooch
 
Posts: 1628
Joined: Thu May 15, 2003 4:11 pm
Location: Cornell University

Re: Correct specifications of mlogit in MARK and RMARK

Postby jlaake » Thu May 11, 2017 8:13 am

He fixed some transitions to 0 which is why he doesn't have 18 parameters. But the problem is that you specified an additive time and stratum model in RMark and an interaction model in Mark.

Use ~stratum *time for the Psi formula.

You need to spend some time reading the workshop notes and learning about R formulas.
jlaake
 
Posts: 1417
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: Correct specifications of mlogit in MARK and RMARK

Postby cooch » Thu May 11, 2017 8:29 am

jlaake wrote:He fixed some transitions to 0 which is why he doesn't have 18 parameters.


OK -- thanks. Missed that earlier in the thread.

However, I'll add that with only 3 states, with some transitions fixed, you probably don't need the MLogit link anyway for a straight MS model.
cooch
 
Posts: 1628
Joined: Thu May 15, 2003 4:11 pm
Location: Cornell University


Return to RMark

Who is online

Users browsing this forum: No registered users and 19 guests