Hello,
I am trying to fit the single-season, single species occupancy model bellow to a dataset with more than 8000 sites and hundreds of thousands of observations. Because there are so many observations, I am vectorializing the detection part. The model, thus, uses a single data object, called y1, which has 785,718 elements, all equal to 0 or 1.
The problem is that function 'runMCMC' is returning many (hundreds) of warnings of the sort:
'logProb of data node y[66057]: logProb is NA or NaN
Im pasting the model code below. Some details of the occupancy part may look funny because this is set up to add a CAR component later on. Likewise, aspects of the detection code may look funny because it is set up for integration of different data sources on a later stage. But still, I would really like to see this simplified version working without the strange warnings.
I am initializing with a vector of ones and zeros that has as many elements as sites and has z=1 for every site where my focal species was seen.
I am new with NIMBLE, so it is quite possible that I am doing something dumb. I will be thankful if anyone can spot anything obviously wrong in the model code below.
Thank you,
Gonçalo
# Write NIMBLE model ----
Model0b_RQmap <- nimbleCode({
## Priors
beta0 ~ dnorm(0, tau = 0.01)
alpha1 ~ T(dnorm(0, tau = 0.01),0,10) # tried truncating at 10,..., 10000
# truncating at 10 seems too restrictive, but I tried just to see if warnings kept coming
## Likelihood
# Cell-specific occupancy
for(i in 1:ncell) { # loop over grid cells
z[i] ~ dbern(psi[i]) # True occupancy z at site i
# put guard rails on the variation of psi[i]
mu.lim[i] <- min(10, max(-10, mu[i]))
logit(psi[i]) <- mu.lim[i]
# linear function for logit(psi[i]) - will have CAR at later stage
mu[i] <- beta0
}
# visit-specific detection of the focal species for one data source
for(j in 1:nobs1) { # loop over observations
e1[j] <- alpha1*nsps[j] # detection parameter e1 as function of n sps seen in visit
p1[j] <- 1 - pow((1-0.5),e1[j])
zp1[j] <- p1[j]*z[cellID[j]]
y1[j] ~ dbern(zp1[j])
}
})