Exposing the beta function - yes/no/maybe?

I’ve noticed that the beta function in the math library isn’t currently exposed to the Stan language, and was adding signatures for it. But as Rok pointed out over on Github, beta is a pretty common variable name and exposing it as a function could break current models.

At the moment, users can employ the beta function in stan models by specifying exp(lbeta(a, b)), which is all the beta function does in the math library anyway. So if it’s going be a userspace-breaking change, it might not be necessary to expose the function at all.

Alternatively, a simple fix could be to capitalise and denote it Beta(a,b), similar to the Phi function.

Any thoughts/preferences here?

1 Like

If there are no gains anyway over lbeta… then don’t bother. beta is really used a lot. I don’t think it’s worth the effort if we have lbeta.

4 Likes

As @wds15 mentions, lbeta is the workhorse. That’s because beta is going to underflow very quickly for larger arguments. So I agree we should just skip it.

As far as the language goes, we’re discussing separately rather to allow variables to be named after functions in the general case in the language. We could do that like pi() and e(), so that’s not a technical obstacle.