Michael and Ben are both right.
Ben: The lower truncations in our generated
code for discrete distributions normalize in such a way
to make the lower bounds exclusive and the upper bounds
inclusive. The lower-bound checks make the lower
bound inclusive.
Michael: The CDFs and CCDFs are doing the right thing,
with CDF being Pr[X <= x] and CCDF being Pr[X > x],
so that CDF + CCDF = 1.
I revised the issue and included the currently generated
code for for lower bounds, upper bounds,
and both:
https://github.com/stan-dev/stan/issues/2054
This one's going to be a hassle to fix because we only need
to make the change for discrete distributions, so I'm going to need
to test for discreteness. I think the easiest thing to do is going
to be to adjust for the lower bound using the pmf.
I'll try to fix this later tonight (Sunday 4 September).
This will cause sampling errors in cases where the discrete
distribution parameters are Stan model parameters (e.g, poisson(lambda)
where lambda is declared as a parameter).
- Bob