Dear all,
I need to estimate the effect of 4 experimental treatments on the size of 12 populations of aquatic snails (n = 3 populations/treatment). Snails were batch-marked and captured only twice (Lincoln-Petersen design). I started from a WinBUGS code provided as teaching material by Simon Bonner (
http://people.stat.sfu.ca/~cschwarz/Consulting/Trinity/Phase2/TrinityWorkshop/Workshop-material-Simon/). However, I am running into multiple problems (I am new to JAGS, population modelling and mark-recapture, so I might ask silly questions...):
1). The model requires sampling recapture probability
p from an unknown number
U of unmarked individuals (
un[i] ~ dbin(p[i],U[i]) in the model below).
p and
U are the parameters to be estimated (I treat
p as a random parameter so that the model is hierarchical). This requires providing a flat discrete prior for
U, but I can't figure out how to do that. Any help with that would be greatly appreciated! As a work around, I have used a discrete informative prior produced by dbin, so that I was still able to pursue model fitting. Then, I met problem 2:
2). I can't find proper start values (from the previous posts, I see that this is a recurrent problem with JAGS). I am wondering whether this might come from the data (two populations, #1 and #7, went extinct during the course of the experiment). Would anyone have an opinion on that?
3). Finally, in case the two previous probelms would be solved, I would like to add a covariate (treatment) effect on population size (and ideally also on p), but this is another story (only commented in model code below).
Best wishes!
Eric
## 1) Model
cat(file = "Lincoln_petersen.jags", "
model{
## Likelihood function
for(i in 1:pop){ #loop through populations
## Marked individuals
mk[i] ~ dbin(p[i],n[i])
## Unmarked individuals
un[i] ~ dbin(p[i],U[i])
## Population numbers
N[i] <- n[i] + U[i]
##ANOVA for effects of experimental treatments on population size
#N[i] ~ dpois(lambda)
#log(lambda) <- alpha[treat[i]]
}
## Priors for population parameters
for(i in 1:pop){
## Capture probabilities
logit(p[i]) <- lproba[i]
lproba[i] ~ dnorm(mu,tau)
## Number of unmarked fish
U[i] ~ dbin(0.1,50) #CANNOT FIND FLAT DISCRETE DISTRIBUTION!
}
## Hyperpriors for capture probability
mu ~ dnorm(0,.001)
tau ~ dgamma(.01,.01)
## Priors for ANOVA parameters
#for(i in 1:4){ #loop through experimental treatments
# alpha[i] ~ dnorm(0, 0.001)
#}
}
")
## 2) Data list
bac <- c(1:12) #pop indices
treat <- c(rep(c("C","S","P","SP"), 3)) #experimental treatments
n <-c(0, 20, 19, 7, 1, 20, 0, 135, 30, 190, 14, 17) #nb captured and marked
recapt <- c(0, 21, 18, 8, 1, 23, 0, 150, 42, 251, 18, 28) #nb recaptured
mk <- c(0, 20, 17, 7, 1, 20 , 0, 134, 30, 186, 14, 17) #nb marked among recaptures
un <- (recapt - mk) #nb unmarked among recaptures
data <- list(mk = mk, n = n, un = un, pop = length(bac))
## 3) Initial values
inits <- function(){list(lproba = rep(1, 12), U = rep(1, 12))} #c(0,1,1,1,0,3,0,2,2,2,4,2)
## 4) Parameters monitored
parameters <- c("mu", "tau", "N")
## 5) MCMC settings
ni <- 2000
nt <- 5
nb <- 1000
nc <- 3
#model
library(jagsUI)
mod <- jags(data, inits, parameters, "Lincoln_petersen.jags", n.chains = nc, n.thin = nt, n.iter = ni, n.burnin = nb, n.adapt = 2000, parallel = TRUE)