Just to expand on this point a little I view CDFs and PDFs as somewhat
different. A CDF can be mathematically well defined for any value on
the real line and while it might seem silly to write x ~
exponential(lambda) T[-100,] I can't see a reason to disallow it. For
instance, if you had a lower bound parameter b so
b ~ normal(0,1)
x ~ exponential(lambda) T[b,]
where b is used elsewhere in the model it seems unnecessary to cause
an error either forcing the user to construct a variable which is just
max(b,0) or slowing the sampler down due to a lot of rejected
trajectories.
With PDFs there are two cases I can think of. One is the typical use-case
model {
x ~ exponential(lambda)
}
where x is data or some other parameter. If x < 0 then
exponential_log will return either -infinity or throw an exception.
The exception will get caught and NUTS will terminate that end of the
trajectory the -infinity will propagate to lp__ and cause NUTS to
similarly terminate that end of the trajectory. The result of either
option is the same, but the exception will result in some small amount
of saved computation on the step because everything after that point
won't be evaluated.
The flip side of things is that someone may want to use the density
functions on their own. For instance, a model I played with recently
had an exponential decay after an event at time t0 which could be well
modeled with exponential_pdf(t - t0,lambda) which relies on the
behaviour being proper when the variate is less than zero.
I'm not really certain what the right answer is here for the PDFs as
both have some pros and cons. (I think it's clearer with the CDFs.)
A third option would be to have a parameter or different functions for
different behaviour but that requires more work.
Cheers,
Marcus
> --
>
>