You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are several tricks that we need to know to use nimbleEcology::d(D)HMM(o)(), including i) can't accomodate individuals with first == K and ii) doesn't condition on first capture. I wonder whether I should use my own likelihood w/ forward algo. See extracts of discussions from the NIMBLE users mailing list below.
What nimble is trying to tell you is that the dHMM distribution expects a dimension=1 node for the "value", which means a vector. Generally, "y[i,(first[i]+1):K]" will be a vector, except when first[i] = K for some value(s) of i, in which case that reduces to a single value, or a scalar, or a dimension=0 quantity. Unfortunately, at this point, nimble cannot distinguish between dimension=0 scalars, and vectors of length 1, which is causing the error you're seeing.
What` you'll have to do to get around this, since capture histories of length=1 generally do not contribute anything to inference, is to remove the capture histories for which first[i]=K from the dataset - remove the individuals that were first sighted on the final sampling occasion K.
This generally won't affect inference, unless you were also doing inference on the initial state probabilities "init[1:9]", which it appears you are not, since those appear to be hard-coded as c(1,0,0,0,....) in your model, meaning you condition on the initial state of capture being state 1, and also individuals being observed in that first time period. So removing these individuals won't affect the inferences from your model, it will just require a little bit of data manipulation, and changing the value of N.
I think Daniel's response is exactly correct. dHMM doesn't condition on first capture, meaning that we expect you to have at least two observations of each individual. Since a one-observation individual has a simpler likelihood you could probably handle those separately; that's another workaround that could work for you. Or, you could include the first instance of each individual and provide y[i, first[i] : K] as Daniel suggested. If you want to condition on first capture I think you could do that pretty easily by hard-coding your detection matrix for the first event for each individual. Let me know if this is unclear and if you want any support going in one of these directions!
I think Daniel's response is exactly correct. dHMM doesn't condition on first capture, meaning that we expect you to have at least two observations of each individual. Since a one-observation individual has a simpler likelihood you could probably handle those separately; that's another workaround that could work for you. Or, you could include the first instance of each individual and provide y[i, first[i] : K] as Daniel suggested. If you want to condition on first capture I think you could do that pretty easily by hard-coding your detection matrix for the first event for each individual. Let me know if this is unclear and if you want any support going in one of these directions!
The text was updated successfully, but these errors were encountered:
There are several tricks that we need to know to use
nimbleEcology::d(D)HMM(o)()
, including i) can't accomodate individuals with first == K and ii) doesn't condition on first capture. I wonder whether I should use my own likelihood w/ forward algo. See extracts of discussions from the NIMBLE users mailing list below.See solution for the CJS model by Jay Rotella here https://groups.google.com/g/nimble-users/c/_anpyNTx1_I/m/z2JMHAgmAAAJ
The text was updated successfully, but these errors were encountered: