Hi Hanah,
I had a quick run of your code and saw that some elements of O are not 0 but the corresponding means are 0 for the Poisson distribution used. This caused the -Inf log probability calculation. I did not change other parts of the code and used the following (I added initial value to s and removed E from data to constants) to build the model and tested it:
nb.data = list(
O = data$dthsim
)
nb.const <-list(
N = N,
Q = Q,
R0=rep(0,N),
RD=RD,
E=data$dth2020
)
# Initials
inits <- list(alpha=0.1, prec=2, rho = 0.7, s = rep(0, N))
model <- nimbleModel(LRfit, nb.const, nb.data, inits)
model$calculate("O[4]") # -Inf
model$O[4] # 1
model$mu[4] # 0
I am not sure about the model itself, but it might be worth paying attention to the zero mean issue.
Best wishes,
Wei