## state transition covariates

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

### state transition covariates

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: 8
Joined: Wed Aug 10, 2016 2:37 pm

### Re: state transition covariates

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: 1409
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

### Re: state transition covariates

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: 8
Joined: Wed Aug 10, 2016 2:37 pm

### Re: state transition covariates

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 errorddl\$Psi\$distance=NAddl\$Psi\$distance[ddl\$Psi\$stratum=="A"&ddl\$Psi\$tostratum=="B"]=10ddl\$Psi\$distance[ddl\$Psi\$stratum=="A"&ddl\$Psi\$tostratum=="C"]=20ddl\$Psi\$distance[ddl\$Psi\$stratum=="B"&ddl\$Psi\$tostratum=="A"]=10ddl\$Psi\$distance[ddl\$Psi\$stratum=="B"&ddl\$Psi\$tostratum=="C"]=15ddl\$Psi\$distance[ddl\$Psi\$stratum=="C"&ddl\$Psi\$tostratum=="A"]=20ddl\$Psi\$distance[ddl\$Psi\$stratum=="C"&ddl\$Psi\$tostratum=="B"]=15mark(dp,ddl,model.parameters=list(Psi=list(formula=~distance)))`
jlaake

Posts: 1409
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

### Re: state transition covariates

Thanks a lot for the tip! cheers
ricardo

Posts: 8
Joined: Wed Aug 10, 2016 2:37 pm

### Who is online

Users browsing this forum: No registered users and 1 guest