simulate data with multistate CR nimble model

4 views
Skip to first unread message

Marwan Naciri

unread,
Dec 17, 2025, 12:19:57 PM (2 days ago) Dec 17
to nimble-users
Hi nimble team,

I’m trying to simulate CR (and ultimately IPM) data from a nimble. While the CJS model worked fine, for some reason, I can’t get the multistate model to work: I keep getting multiple rows of the following warnings

[Warning] Dynamic index out of bounds: dcat(prob = S[z[i, t_minus_1], i, t_minus_1, 1:3])

[Warning] Dynamic index out of bounds: dcat(prob = E[z[i, t], i, t_minus_1, 1:3])

(with S and E being my transition and observation matrix, respectively).

I am fairly certain that my indexing is fine, and that I have provided all constants used in the loops (the nimble model code works fine when fitted to data simulated using R code). I checked whether I would be able to simulate data using the nimble model despite the warnings, but unsurprisingly, it doesn’t work: I get NA on the occasion of first capture, and NaN on all the following occasions in both the matrix of capture histories and the matix of latent states. I imagine I should specify the latent states at first capture or something along these lines, but I’m not sure how. What am I missing?

The code is attached.

Many thanks in advance,

Marwan


reproducible_example.R
Reply all
Reply to author
Forward
0 new messages