Hello,

I am trying to adjust some code from a previous post: Code for Poisson Hurdle Model in Documentation is Slow

In this post, they are using a poisson distribution for the hurdle model but I was trying to simply adjust it for a negative binomial, and then eventually turn it into a regression model. When I add truncation to the neg_binomial_2_log() in the code below, I get the very vague error:

Error in stanc(file = file, model_code = model_code, model_name = model_name, :

c++ exception (unknown reason).

However, if I remove the truncation, the code runs fine.

```
data {
int<lower=0> N;
int<lower=0> y[N];
}
parameters {
real<lower=0, upper=1> theta;
real alpha;
real<lower=0> phi;
}
model {
for (n in 1:N) {
(y[n] == 0) ~ bernoulli(theta);
if (y[n] > 0)
y[n] ~ neg_binomial_2_log(alpha, phi) T[1,];
}
}
generated quantities{
real<lower = 0> lambda;
lambda = exp(alpha);
}
```

The R code I am using for an example data is:

```
sim_data <- list(
N = 10000,
y = c(RawDat0, RawDatNB)
)
fit2 <- stan(
file = "log_nb_hurdle.stan",
data = sim_data
)
```

Any thoughts on how to make this run correctly?

Thanks,

Mike