Skip to content

Commit

Permalink
Remove demographic stochasticity from lambda in Bayesian model
Browse files Browse the repository at this point in the history
  • Loading branch information
Hughes authored and Hughes committed Oct 2, 2024
1 parent a4cd9ff commit 4aef690
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions inst/templates/JAGS_template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ for(k in 1:nYears){

#Recruitment
for(k in 1:nYears){
mu.R[k] <- max(0.01,min(0.99,exp(l.R + anthro[k]*beta.Rec.anthro + fire[k]*beta.Rec.fire)))
mu.R[k] <- composition.bias*max(0.01,min(0.99,exp(l.R + anthro[k]*beta.Rec.anthro + fire[k]*beta.Rec.fire)))
#Constrain sd of beta distribution to what is theoretically possible, given mu
sig.R[k] <- min(cv.R*mu.R[k],0.99*(mu.R[k]*(1-mu.R[k]))^0.5)
#Get beta distribution parameters from mean and sd
Expand All @@ -33,11 +33,10 @@ for(k in 1:nYears){

#Growth
for(k in 1:nYears){
Rfemale[k] <- composition.bias*R[k]/2
Rfemale[k] <- R[k]/2
survivors[k] ~ dbin( S.annual.KM[k], fpop.size[k] )
recruits[k] ~ dbin(Rfemale[k],survivors[k])
#small minimum in demoninator to give 0 when fpop.size=0
pop.growthr[k] <- (survivors[k]+recruits[k])/max(fpop.size[k],0.0000001)
pop.growthr[k] <- S.annual.KM[k]*(1+Rfemale[k]) #without demographic stochasticity
}
for(k in 2:assessmentYrs){
pop.growth[k-1] <- pop.growthr[k-1]
Expand Down
7 changes: 3 additions & 4 deletions inst/templates/JAGS_template2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,15 @@ for(k in 1:nYears){

#Recruitment
for(k in 1:nYears){
R[k] <- max(0.01,min(0.99,exp(l.R + anthro[k]*beta.Rec.anthro + fire[k]*beta.Rec.fire)))
R[k] <- composition.bias*max(0.01,min(0.99,exp(l.R + anthro[k]*beta.Rec.anthro + fire[k]*beta.Rec.fire)))
}

#Growth
for(k in 1:nYears){
Rfemale[k] <- composition.bias*R[k]/2
Rfemale[k] <- R[k]/2
survivors[k] ~ dbin( S.annual.KM[k], fpop.size[k] )
recruits[k] ~ dbin(Rfemale[k],survivors[k])
#small minimum in demoninator to give 0 when fpop.size=0
pop.growthr[k] <- (survivors[k]+recruits[k])/max(fpop.size[k],0.0000001)
pop.growthr[k] <- S.annual.KM[k]*(1+Rfemale[k]) #without demographic stochasticity
}
for(k in 2:assessmentYrs){
pop.growth[k-1] <- pop.growthr[k-1]
Expand Down

0 comments on commit 4aef690

Please sign in to comment.