Along the lines of add poisson_log_lcdf and poisson_log_lccdf functions · Issue #2015 · stan-dev/stan · GitHub and Error with Truncation on Negative Binomial Distribution (log alternative parameterization), would changing the code in the for-loop to:
y[n] ~ neg_binomial_2_log(mu[n], phi); // no truncation here
target += - log1m(neg_binomial_2_log_lpmf(0 | mu[n], phi)); // manually adjusting computation of likelihood
be a fruitful avenue?