-
Notifications
You must be signed in to change notification settings - Fork 0
/
model_gamma_pred.txt
43 lines (35 loc) · 1.31 KB
/
model_gamma_pred.txt
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
model{
# priors:
alpha[1] <- 0 #area baseline
for (a in 2:A){alpha[a] ~ dnorm(0, 0.0001)}
for (a in 1:A){beta[1,a] <- 0 } #area baseline
beta[2, 1] <- 0 ; #fleet baseline
for (a in 2:A){ beta[2,a] ~ dnorm(0, 0.0001)}
# gamma[1] <- 0 #area baseline
# for (a in 2:A){gamma[a] ~ dnorm(0, 0.0001)}
epsilon[1] <- 0 #area baseline
for (a in 2:A){epsilon[a] ~ dnorm(0, 0.0001)}
for (a in 1:A){gamma[1,a] <- 0 } #area baseline
gamma[2,1] <- 0 ; #fleet baseline
for (a in 2:A){ gamma[2,a] ~ dnorm(0, 0.0001)}
tau ~ dgamma(0.001, 0.001) # prior for mixed effect precision
sd <- sqrt(1/tau)
for(f in 1:2){ #loop around fleet
for(y in 1:Y){ # loop around years
count[y,f,1:A] ~ dmulti(q[y,f,1:A], M[y,f])
for(a in 1:A){
re[y,f,a] ~ dnorm(0, tau)
q[y,f,a] <- phi[y,f,a]/sum(phi[y,f,])
log(phi[y,f,a]) <- alpha[a] + beta[f,a] + epsilon[a]*yearc[y] + gamma[f,a]*yearc[y] + re[y,f,a]
}
}
}
for(f in 1:2){ #loop around fleet
pred_count[f,1:A] ~ dmulti(q_pred[f,1:A], pred_M[f])
for(a in 1:A){
re_pred[f,a] ~ dnorm(0, tau)
q_pred[f,a] <- phi_pred[f,a]/sum(phi_pred[f,])
log(phi_pred[f,a]) <- alpha[a] + beta[pred_fleet[f] + 1,a] + epsilon[a]*pred_year[f] + gamma[pred_fleet[f] + 1,a]*pred_year[f] + re_pred[f,a]
}
}
}