-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmscjs_phiSex_pGearEffort.jag
78 lines (64 loc) · 2.24 KB
/
mscjs_phiSex_pGearEffort.jag
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
#data{
# for(i in 1:nind) {
# sex12[i] <- ifelse(equals(Sex[i],0), 1, 2)
# }
#}
model{
phi[1] ~ dunif(0,1) # Annual survival prob for females
phi[2] ~ dunif(0,1) # male survival
p0fyke ~ dunif(0,1) # Capture prob in fyke when effort is 1
#p0seine ~ dunif(0,1)
p0pit ~ dunif(0,1)
p0seine ~ dunif(0,1)
# We don't have much effort info for seine
# Apparently no seining happened in years 4 and 5
pSeine[1] ~ dunif(0,1)
pSeine[2] <- p0seine #dunif(0,1)
pSeine[3] <- p0seine #dunif(0,1)
pSeine[4] <- 0
pSeine[5] <- 0
for(t in 1:5) {
# Effective capture probability in fyke net in year t
# fykeEffort should be the number of days of effort in each year
pFyke[t] <- 1-(1-p0fyke)^fykeEffort[t]
# pitEffort is the number of antanae run each year. (Time was constant among years)
pPit[t] <- 1-(1-p0pit)^pitEffort[t]
}
for(t in 1:n.occ){
cap.probs[1,t,1] <- (1-pSeine[t])*(1-pFyke[t])*(1-pPit[t]) # Pr(not detected|alive)
cap.probs[1,t,2] <- pSeine[t]*(1-pFyke[t])*(1-pPit[t]) # Pr(detected in seine, but not by other gear)
cap.probs[1,t,3] <- pFyke[t]*(1-pSeine[t])*(1-pPit[t])
cap.probs[1,t,4] <- pPit[t]*(1-pFyke[t])*(1-pSeine[t])
cap.probs[1,t,5] <- pFyke[t]*pPit[t]*(1-pSeine[t])
cap.probs[1,t,6] <- pSeine[t]*pFyke[t]*(1-pPit[t])
cap.probs[1,t,7] <- pSeine[t]*pPit[t]*(1-pFyke[t])
cap.probs[1,t,8] <- pSeine[t]*pFyke[t]*pPit[t]
cap.probs[2,t,1] <- 1 # If dead, can't be detected
cap.probs[2,t,2] <- 0
cap.probs[2,t,3] <- 0
cap.probs[2,t,4] <- 0
cap.probs[2,t,5] <- 0
cap.probs[2,t,6] <- 0
cap.probs[2,t,7] <- 0
cap.probs[2,t,8] <- 0
}
for (i in 1:nind){
z[i, f[i]] <- 1 # Known to be alive in first capture year
for(t in 1:f[i]) {
survivor[i,t] <- 0
}
for (t in (f[i]+1):n.occ){
z[i,t] ~ dbern(z[i,t-1]*phi[sex12[i]]) # Actual alive/dead state (partially observed)
state[i,t] <- ifelse(z[i,t]<1, 2, 1)
y[i,t] ~ dcat(cap.probs[state[i,t],t,1:8])
survivor[i,t] <- z[i,t]>0
}
}
for(t in 2:n.occ){
PrNewCap[t] <- 1 - (1-pFyke[t])*(1-pSeine[t])
PrRecap[t] <- 1 - (1-pFyke[t])*(1-pSeine[t])*(1-pPit[t])
Survivors[t] <- sum(survivor[,t])
# N[t] <- NewCaps[t-1]/PrNewCap[t] + Recaps[t-1]/PrRecap[t]
N[t] <- NewCaps[t-1]/PrNewCap[t] + Survivors[t]
}
}