Hi all
I'm developing a multievent model for a study population of common kestrel, which is a part of a large model (IPM). We are interested in sex-specific temporal changes in survival and site fidelity, but the weakness in the data is that the sex is imperfectly identified especially for juveniles. Hence, the multievent approach. The data includes ~ 10k individuals captured and banded from nest boxes and encountered in the following 29 years by recapturing them in and outside the study area and recovering dead birds throughout their range.
As the data is somewhat big and the number of states (events) gets large, there is a need to marginalize over the latent states and pool the encounter histories for efficient sampling (and parallelize sampling, of course). I tried implementing the marginalization using distributions from the nimbleEcology package but faced an error I couldn't figure out. The error comes when compiling the model, and the error message is:
Error: LHS indexing for a multivariate random draw can only use sequential blocks (via ':').
This occurred for: model_y[getNodeFunctionIndexedInfo(ARG1_INDEXEDNODEINFO__,1), (Interm_28:29)]
This was part of the call: model_y[getNodeFunctionIndexedInfo(ARG1_INDEXEDNODEINFO__,1), (Interm_28:29)] <<- rcFun_nimbleEcology55(n=1,init=Interm_24,probObs=Interm_25,probTrans=Interm_26,len=Interm_27,checkRowSums=1)
I attached a heavily reduced reprex using a fraction of the data. Note that I reduced the model for the example a lot (switched from dDHMMo to dHMMo, removed time-depencies, random structures etc.). The problem is likely in the model code, but I couldn't figure out where. I'm unsure whether the dHMMo can properly handle the four-dimensional observation array. However, I got the same error with a three-dimensional observation array (which should be ok) which indicates that the problem is somewhere else.
Any help/thoughts will be highly appreciated.
Thanks in advance,
-Antti