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