-
Notifications
You must be signed in to change notification settings - Fork 0
/
nMix.txt
41 lines (41 loc) · 1.16 KB
/
nMix.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
model
{
for (t in 1:nyear) {
for (k in 1:nsite) {
log(lambda[k, t]) <- lambda.mu[k, t]
for (j in 1:reps) {
lp[k, j, t] <- p.mu
p[k, j, t] <- exp(lp[k, j, t])/(1 + exp(lp[k,
j, t]))
}
}
}
p.mu ~ dunif(-10, 10)
for (t in 1:nyear) {
for (k in 1:nsite) {
lambda.mu[k, t] ~ dunif(-10, 10)
}
}
for (t in 1:nyear) {
eps[t] ~ dnorm(0.00000E+00, tau)
}
tau <- 1/(sd * sd)
sd ~ dunif(0.00000E+00, 2)
for (t in 1:nyear) {
for (k in 1:nsite) {
N[k, t] ~ dpois(lambda[k, t])
for (j in 1:reps) {
y[k, j, t] ~ dbin(p[k, j, t], N[k, t])
eval[k, j, t] <- p * N[k, t]
E[k, j, t] <- pow((y[k, j, t] - eval[k, j, t]),
2)/(eval[k, j, t] + 0.5)
y.new[k, j, t] ~ dbin(p, N[k, t])
E.new[k, j, t] <- pow((y.new[k, j, t] - eval[k,
j, t]), 2)/(eval[k, j, t] + 0.5)
}
}
N_est[t] <- sum(N[, t])
}
fit <- sum(E[, , ])
fit.new <- sum(E.new[, , ])
}