Hello,

I am trying to use the segment function to break up my ragged occupancy dataset. However, it appears the data is not being passed through the bernoulli_logit§ portion of the model.

Thank you

```
data {
int<lower=0> N; //of observations/ # temporal replication
int<lower=0> K; // of groups/ # of arrays
int pos[K]; // position of the first detection of each group
int y[N]; // observations/ Detection at each site for all temporal replication
int s[K]; // group size s={45,42,42,41,54,...}
int x[K]; // Observed occupancy at each site
vector[K] t_burn;
vector[N] air_temp;
}
parameters {
real a_psi;
real b1_psi;
real a_p;
real b1_p;
}
transformed parameters {
vector[K] logit_psi;
vector[N] logit_p;
logit_psi = a_psi + b1_psi * t_burn;
logit_p = a_p + b1_p * air_temp;
}
model {
// Priors
a_psi ~ normal(0, 1);
b1_psi ~ normal(0,1);
a_p ~ normal(0, 1);
b1_p ~ normal(0, 1);
// Likelihood
for (i in 1:K) {
if (x[i] == 1) { // Occurred and observed
1 ~ bernoulli_logit(logit_psi[i]);
segment(y, pos[i], s[i]) ~ bernoulli_logit(logit_p[i]);
} else {
// Occurred and not observed
target += log_sum_exp(bernoulli_logit_lpmf(1 | logit_psi[i])
+ bernoulli_logit_lpmf(0 | logit_p[i]),
// Not occurred
bernoulli_logit_lpmf(0 | logit_psi[i]));
}
}
}
```