js_super.stan line 222 uses (1 - z[i, t - 1]) instead of q for the recruitment process. A possible fix is to create and incorporate q into lines 216:222 (see js_rest_occ.stan lines 212:224 for similar example and also Kery and Schaub BPA pg 327). Possible fix is described below.
// Generate w[] and z[]
for (i in 1:M) {
int q = 1;
if (bernoulli_rng(psi)) { // Included
z[i, 1] = bernoulli_rng(nu[1]);
for (t in 2:n_occasions) {
q = q * (1 - z[i, t - 1]);
z[i, t] = bernoulli_rng(z[i, t - 1] * phi[i, t - 1]
+ q * nu[t]);
This prevents dead individuals from recruiting back into the population.
js_super.stan
line 222 uses(1 - z[i, t - 1])
instead ofq
for the recruitment process. A possible fix is to create and incorporateq
into lines 216:222 (seejs_rest_occ.stan
lines 212:224 for similar example and also Kery and Schaub BPA pg 327). Possible fix is described below.This prevents dead individuals from recruiting back into the population.