Fixing parameters for age in a multistate model

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

Fixing parameters for age in a multistate model

Postby Rebekah Ry » Sat Aug 08, 2020 11:29 pm

Hello,

I have searched the forum far and wide and could not seem to find the answer to my question.

I am running a MS model in MARK through RMark with four states: A, F, R, D
-A and F are only possible for adults
-R and D are only possibly for juveniles

I have been successful fixing Psi parameters to zero for A to D, A to R, F to D, and F to R, along with some other petty transitions, but I cannot for the life of me figure out how to fix a parameter to zero for S or p. There can be no survival (or recapture) estimate for adults in states R and D, and there can be no survival estimates for juveniles in states A and F.

Essentially the whole S and p PIMs should be zeros for state A and F at age 0, and all zeros for states R and D at age 1+. Or so I would think?

Here is my current R code:

#setting up data with age bins#
Freeman.process <- process.data(Freeman.df,model ="Multistrata", time.intervals=c(0.5,rep=14),
begin.time=2013,groups=c("sex","age"))
Freeman.ddl <- make.design.data(Freeman.process)
Freeman.ddl <- add.design.data (Freeman.process, Freeman.ddl, "S","age", bins=c(0,1,8), right=FALSE,
name="ya")
Freeman.ddl$S$marked.as.adult=0
Freeman.ddl$S$marked.as.adult[Freeman.ddl$S$group=="adult"]=1

#creating fixed parameters that won't allow transitions between certain states#
#example, an F (adult near family) cannot transition into a D (dispersed juvenile) or R (retained juvenile)#

fromAtoD=as.numeric(row.names(Freeman.ddl$Psi[Freeman.ddl$Psi$stratum=="A"
&Freeman.ddl$Psi$tostratum=="D",]))
fromAtoD.values=rep(0,length(fromAtoD))
fromFtoD=as.numeric(row.names(Freeman.ddl$Psi[Freeman.ddl$Psi$stratum=="F"
&Freeman.ddl$Psi$tostratum=="D",]))
fromFtoD.values=rep(0,length(fromFtoD))
fromDtoD=as.numeric(row.names(Freeman.ddl$Psi[Freeman.ddl$Psi$stratum=="D"
&Freeman.ddl$Psi$tostratum=="D",]))
fromDtoD.values=rep(0,length(fromDtoD))
fromDtoF=as.numeric(row.names(Freeman.ddl$Psi[Freeman.ddl$Psi$stratum=="D"
&Freeman.ddl$Psi$tostratum=="F",]))
fromDtoF.values=rep(0,length(fromDtoF))
fromDtoR=as.numeric(row.names(Freeman.ddl$Psi[Freeman.ddl$Psi$stratum=="D"
&Freeman.ddl$Psi$tostratum=="R",]))
fromDtoR.values=rep(0,length(fromDtoR))
fromAtoR=as.numeric(row.names(Freeman.ddl$Psi[Freeman.ddl$Psi$stratum=="A
"&Freeman.ddl$Psi$tostratum=="R",]))
fromAtoR.values=rep(0,length(fromAtoR))
fromFtoR=as.numeric(row.names(Freeman.ddl$Psi[Freeman.ddl$Psi$stratum=="F"
&Freeman.ddl$Psi$tostratum=="R",]))
fromFtoR.values=rep(0,length(fromFtoR))

#putting all of these fixed parameters into a list#

myPsifixed=list(index=c(fromAtoD,fromFtoD,fromDtoD,fromDtoF,fromAtoR,fromFtoR,fromDtoR),
value=c (fromAtoD.values,fromFtoD.values, fromDtoD.values,fromDtoF.values,
fromAtoR.values, fromFtoR.values,fromDtoR.values))

#R cannot transition to A during the non-breeding season (half years, 2013.5, 2014.5, etc)#

Freeman.ddl$Psi$fix[Freeman.ddl$Psi$stratum=="R"& Freeman.ddl$Psi$tostratum=="A"
&Freeman.ddl $Psi$time%in%c(2013.5,2014.5,2015.5,2016.5,2016.5,2017.5,2018.5
,2019.5)]=0

All of the above code works! Yay! But...

#what I have tried for fixing S and p to zero for certain states for certain ages#
#none of these worked#


Freeman.ddl$S$fix=NA
Freeman.ddl$S$fix[Freeman.ddl$S$stratum=="R"&Freeman.ddl$S$age==1]=0

#or#

Freeman.ddl$S$fix[Freeman.ddl$S$stratum=="R"&Freeman.ddl$S$age==1& Freeman.ddl$S$time%in%c (2013,2013.5,2014,2014.5,2015,2015.5,2016,2016.5,2017,2017.5,2018,2018.5,2019,2019.5,2020)]=0

#or#

S.age1=as.numeric(row.names(Freeman.ddl$S[Freeman.ddl$S$stratum=="A"&Freeman.ddl$S$age==0,]))
S.age1.values=rep(0,length(S.age1))

#and repeated this for S.age2, S.age3, S.age4 like I had with fixing Psi transition parameters#
mySfixed=list(index=c(S.age1,S.age2,S.age3,S.age4),
value=c(S.age1.values,S.age2.values,S.age3.values,S.age4.values))

I am at a loss. I spent a day trying to code for this, and I feel defeated. Any advice on how to fix parameters for S or p for certain states in R would be amazing.

Thank you so much for your time,
Rebekah
Rebekah Ry
 
Posts: 13
Joined: Wed Jul 15, 2020 6:46 pm

Re: Fixing parameters for age in a multistate model

Postby Bill Kendall » Sun Aug 09, 2020 11:36 am

Rebekah,

I can't help you with RMARK coding, but it sounds like what you are trying to do with these should be unnecessary. First, something you said is a little confusing:

"There can be no survival (or recapture) estimate for adults in states R and D,
and there can be no survival estimates for juveniles in states A and F."

From what you state about the model structure (R and D for juveniles and A and F for adults), by definition there should be no adults R or D, nor juveniles in A or F. The real key is to be sure the model sends all juveniles that survive to one of the two adult states (i.e., fix psi(R->R)=psi(R->D)=psi(D->D)=psi(D->R)=0). To fix psi(R->R) and psi(D->D) requires changing the PIM definition, since these are usually derived by subtraction.

If you do that, then your other concerns should go away.
Bill Kendall
 
Posts: 93
Joined: Wed Jun 04, 2003 8:58 am

Re: Fixing parameters for age in a multistate model

Postby jlaake » Mon Aug 10, 2020 9:23 am

You are using the original messy approach to fixing parameters. See the second frozen post on the list which explains how to use an easier way.

viewtopic.php?f=21&t=2887
jlaake
 
Posts: 1295
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: Fixing parameters for age in a multistate model

Postby Rebekah Ry » Tue Jan 19, 2021 10:10 pm

Hey Jeff and Bill,

For some odd reason I did not get an email saying that others had responded to this post, so I first want to apologize if I seemed ungrateful for y'all's help! I took some time to work on other parts of my dissertation, but I'm jumping back into MARK (via RMark) now.

Secondly, I just looked over the link that you posted with your reply, Jeff, about the new code to fix parameters. This makes a lot of sense to me! I will apply it to my multistate models in hopes that it works (or more like it, that I can make it work - I don't doubt your coding).

Thank you again, I really appreciate all of your help!

Sincerely,
Rebekah
Rebekah Ry
 
Posts: 13
Joined: Wed Jul 15, 2020 6:46 pm


Return to RMark

Who is online

Users browsing this forum: No registered users and 1 guest

cron