-
Notifications
You must be signed in to change notification settings - Fork 0
/
MAPR_IPM_v2.jags
143 lines (93 loc) · 6.11 KB
/
MAPR_IPM_v2.jags
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
model {
#-------------------------------------------------
# integrated population model for the MacGillivray's Prion population
# - age structured model with 4 age classes
# - adult survival based on CMR ringing data
# - productivity based on Prion Cave nest monitoring data
# - simplified population process with informed prior for adults skipping breeding and uninformed immatures recruiting
# - TWO future scenarios to project population growth with and without eradication
# -------------------------------------------------
#-------------------------------------------------
# 1. PRIORS FOR ALL DATA SETS
#-------------------------------------------------
# -------------------------------------------------
# 1.1. Priors and constraints FOR FECUNDITY
# -------------------------------------------------
mean.fec ~ dunif(0,1) ## uninformative prior with upper bound from Nevoux & Barbraud (2005)
full.fec ~ dnorm(0.519,1000) ## prior for full fecundity without predation from Nevoux & Barbraud (2005) - very high precision
# -------------------------------------------------
# 1.2. Priors and constraints FOR SURVIVAL
# -------------------------------------------------
phi ~ dunif(0.7, 1)
p ~ dunif(0, 1)
juv.surv <- juv.surv.prop*phi
juv.surv.prop ~ dnorm(mean.juv.surv.prop,1000) T(0,1)
#-------------------------------------------------
# 2. LIKELIHOODS AND ECOLOGICAL STATE MODEL
#-------------------------------------------------
# -------------------------------------------------
# 2.1. System process: female based matrix model
# -------------------------------------------------
for (scen in 1:2){
fec.proj[scen]<-max(mean.fec,(scen-1)*full.fec) ## takes current fecundity for scenario 1 and full fecundity for scenario 2
### INITIAL VALUES FOR COMPONENTS FOR YEAR 1 - based on stable stage distribution from previous model
JUV[1,scen]<-max(2,round(Ntot.breed[1,scen]*0.5*(mean.fec+0.16)))
N1[1,scen]<-round(Ntot.breed[1,scen]*0.5*(mean.fec+0.17)*juv.surv)
N2[1,scen]<-round(Ntot.breed[1,scen]*0.5*(mean.fec+0.18)*juv.surv*phi)
N3[1,scen]<-round(Ntot.breed[1,scen]*0.5*(mean.fec+0.19)*juv.surv*phi*phi)
Ntot.breed[1,scen] ~ dnorm(POP.SIZE,10) # initial value of population size
for (tt in 2:66){
## THE PRE-BREEDERS ##
nestlings[tt,scen] <- round((mean.fec+0.30/tt) * 0.5 * Ntot.breed[tt,scen]) ### number of locally produced FEMALE chicks
JUV[tt,scen] ~ dpois(nestlings[tt,scen]) ### need a discrete number otherwise dbin will fail, dpois must be >0
N1[tt,scen] ~ dbin(juv.surv, max(2,round(JUV[tt-1,scen]))) ### number of 1-year old survivors
N2[tt,scen] ~ dbin(phi, max(2,round(N1[tt-1,scen]))) ### number of 2-year old survivors
N3[tt,scen] ~ dbin(phi, max(2,round(N2[tt-1,scen]))) ### number of 3-year old survivors
## THE BREEDERS ##
Ntot.breed[tt,scen] ~ dbin(phi, max(2,round(N3[tt-1,scen]+Ntot.breed[tt-1,scen]))) ### the annual number of breeding birds is the sum of old breeders and recent recruits
} # tt
for (tt in 67:PROJ){
## THE PRE-BREEDERS ##
nestlings[tt,scen] <- round(fec.proj[scen] * 0.5 * Ntot.breed[tt,scen]) ### number of locally produced FEMALE chicks
JUV[tt,scen] ~ dpois(nestlings[tt,scen]) ### need a discrete number otherwise dbin will fail, dpois must be >0
N1[tt,scen] ~ dbin(juv.surv, max(2,round(JUV[tt-1,scen]))) ### number of 1-year old survivors
N2[tt,scen] ~ dbin(phi, max(2,round(N1[tt-1,scen]))) ### number of 2-year old survivors
N3[tt,scen] ~ dbin(phi, max(2,round(N2[tt-1,scen]))) ### number of 3-year old survivors
## THE BREEDERS ##
Ntot.breed[tt,scen] ~ dbin(phi, max(2,round(N3[tt-1,scen]+Ntot.breed[tt-1,scen]))) ### the annual number of breeding birds is the sum of old breeders and recent recruits
} # tt
} # scen
# -------------------------------------------------
# 2.2. Likelihood for fecundity: Poisson regression from the number of surveyed broods
# -------------------------------------------------
for (t in 1:(T.fec)){ ### T-1 or not
J[t] ~ dpois(rho.fec[t])
rho.fec[t] <- R[t]*mean.fec
} # close loop over every year in which we have fecundity data
# -------------------------------------------------
# 2.3. Likelihood for adult and juvenile survival from CMR
# -------------------------------------------------
for (i in 1:nind){
# Define latent state at first capture
z[i,f[i]] <- 1
for (t in (f[i]+1):n.occasions){
# State process
z[i,t] ~ dbern(mu1[i,t])
mu1[i,t] <- phi * z[i,t-1]
# Observation process
y[i,t] ~ dbern(mu2[i,t])
mu2[i,t] <- p * z[i,t]
} #t
} #i
# -------------------------------------------------
# 4. DERIVED POPULATION GROWTH RATE
# -------------------------------------------------
## DERIVED POPULATION GROWTH RATE
for (scen in 1:2){
for (tt in 1:33){
lambda[tt,scen]<-Ntot.breed[tt+67,scen]/max(1,Ntot.breed[tt+66,scen])
loglam[tt,scen]<-log(lambda[tt,scen])
} ## end of tt
growth.rate[scen] <- exp((1/(33))*sum(loglam[1:(33),scen])) ### geometric mean growth rate
} ## end of scen
} ## END MODEL LOOP