state transition covariates

questions concerning analysis/theory using the R package 'marked'

state transition covariates

Postby ricardo » Tue Feb 07, 2017 1:27 pm

Hi,
I wonder whether there is any way in ‘marked’ for specifying multistate models testing the effects of state transition covariates on transition probabilities (e.g. like distances among geographical states)?
Thanks
ricardo
 
Posts: 6
Joined: Wed Aug 10, 2016 2:37 pm

Re: state transition covariates

Postby jlaake » Tue Feb 07, 2017 1:42 pm

Sure as long as you set up the design data in Psi to include the covariate. The same could be done with RMark/MARK as well.
jlaake
 
Posts: 936
Joined: Fri May 12, 2006 12:50 pm
Location: National Marine Mammal Laboratory, Seattle, WA

Re: state transition covariates

Postby ricardo » Tue Feb 07, 2017 3:30 pm

Thanks! You mean in the make.design.data function? Sorry if this is a naive question, but could you please provide me some guidelines for setting and incorporating such transition covariates into the design data for Psi? Or is there any tutorial or working example I can follow?
ricardo
 
Posts: 6
Joined: Wed Aug 10, 2016 2:37 pm

Re: state transition covariates

Postby jlaake » Tue Feb 07, 2017 4:04 pm

You can add design data with any R commands in both marked and RMark. Here is a simple dummy example using RMark/MARK in which I use the rudimentary approach of assigning each value. Note they should be symmetric obviously (distance from A to B same as B to A). Would work very similarly in marked. Note that I have this structured so that probability of remaining in the stratum is done by subtraction. That is the only way I can conceive of it working because you can't set the covariate value for the one computed by subtraction. One could also have ~stratum+distance such that probability of remaining is strata dependent but because Psi values sum to 1, this will happen to some degree without a stratum specific intercept. This is made clear by writing down formula for strata A and strata B using the values I assign in code below and beta is slope for distance and intercept is the Psi intercept value.

Psi A to B = exp(intercept + 10*beta)/[1+exp(intercept + 10*beta)+exp(intercept + 20*beta)]
Psi A to C = exp(intercept + 20*beta)/[1+exp(intercept + 10*beta)+exp(intercept + 20*beta)]
Psi A to A = 1/[1+exp(intercept + 10*beta)+exp(intercept + 20*beta)]

Psi B to A = exp(intercept + 10*beta)/[1+exp(intercept + 10*beta)+exp(intercept + 15*beta)]
Psi B to C = exp(intercept + 15*beta)/[1+exp(intercept + 10*beta)+exp(intercept + 15*beta)]
Psi B to B = 1/[1+exp(intercept + 10*beta)+exp(intercept + 15*beta)]

But intercept can still be stratum dependent as well. It is essential to understand fully the mlogit link because it has implications on how you can construct the formula and what it is doing for the model you are using.

Code: Select all
library(RMark)
data(mstrata)
dp=process.data(mstrata,model="Multistrata")
ddl=make.design.data(dp)
head(ddl$Psi)
# the following is only done to catch errors if I forgot to assign one of the values; an NA will create an error
ddl$Psi$distance=NA
ddl$Psi$distance[ddl$Psi$stratum=="A"&ddl$Psi$tostratum=="B"]=10
ddl$Psi$distance[ddl$Psi$stratum=="A"&ddl$Psi$tostratum=="C"]=20
ddl$Psi$distance[ddl$Psi$stratum=="B"&ddl$Psi$tostratum=="A"]=10
ddl$Psi$distance[ddl$Psi$stratum=="B"&ddl$Psi$tostratum=="C"]=15
ddl$Psi$distance[ddl$Psi$stratum=="C"&ddl$Psi$tostratum=="A"]=20
ddl$Psi$distance[ddl$Psi$stratum=="C"&ddl$Psi$tostratum=="B"]=15
mark(dp,ddl,model.parameters=list(Psi=list(formula=~distance)))
jlaake
 
Posts: 936
Joined: Fri May 12, 2006 12:50 pm
Location: National Marine Mammal Laboratory, Seattle, WA

Re: state transition covariates

Postby ricardo » Tue Feb 07, 2017 9:59 pm

Thanks a lot for the tip! cheers
ricardo
 
Posts: 6
Joined: Wed Aug 10, 2016 2:37 pm


Return to analysis help

Who is online

Users browsing this forum: No registered users and 1 guest

cron