Hi everyone,
I am facing a problem I can't quite put my finger on. In fact I think its a BUGS problem but again not so sure, and given expertise in this forum think maybe someone could help out. Here goes:
I'm trying to scale from an occupancy (0/1) to abundance (0,1,...) model. Here is some stripped down code and data to higlight the problem.
The occupancy code works, the individual (change prior on N and z[i] distribution) does not. Increasing the prior on N (dunif(0,100) say) does work, presumably because it removes zeros from the binomial distribution. My problem is why would these zeroes be a problem in the abundance but not species case?
I would be indebted for a solution (even if I've missed something stupidly obvious as is often my case).
------< warning code below!! >-------
SPECIES MODEL & DATA
model {
p~dunif(0,1)
N~dunif(0,1)
for (i in 1:nsite) {
z[i] ~ dbern(N)
for(k in 1:K) {
x[i,k] ~ dbin(p,z[i])
} } }
}
list(nsite=4, K=4,
x = structure(.Data = c(1,0,1,1,1,1,0,1,1,1,0,1,1,1,0,1), .Dim=c(4,4)))
INDIVIDUAL MODEL & DATA
model {
p~dunif(0,1)
N~dunif(0,10)
for (i in 1:nsite) {
z[i] ~ dpois(N)
for(k in 1:K) {
x[i,k] ~ dbin(p,z[i])
} } }
}
list(nsite=4, K=4,
x = structure(.Data = c(1,0,1,5,1,1,0,4,1,2,0,1,2,1,0,1), .Dim=c(4,4)))