-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodel_ss.jags
26 lines (23 loc) · 1.01 KB
/
model_ss.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
model{
# Priors
N.est[1] ~ dunif(0.00001, 10) # Prior for initial population density (max in dataset:6.6)
mean.rmax ~ dunif(0.00001, 10) # Prior for mean rmax
K ~ dunif(0.00001, 100) # prior for carrying capacity
sigma.proc ~ dunif(0.00001, 50) # Prior for sd of state process
sigma2.proc <- pow(sigma.proc, 2) # Variance = sd^2
tau.proc <- pow(sigma.proc, -2) # Tau = sqrt(sd)
sigma.obs ~ dunif(0.00001, 50) # Prior for sd of observation process
sigma2.obs <- pow(sigma.obs, 2)
tau.obs <- pow(sigma.obs, -2)
# Likelihood
# State process
for (t in 1:(T-1)){
rmax[t] ~ dnorm(mean.rmax, tau.proc)T(0, 10) # Truncated normal distribution to prevent values < 0
rd[t] <- rmax[t]*(1-N.est[t]/K)
N.est[t+1] <- N.est[t]+N.est[t]*rd[t]
}
# Observation process
for (t in 1:T){
y[t] ~ dnorm(N.est[t], tau.obs)
}
}