stanc3
stanc3 copied to clipboard
Expose `hypergeometric_2F1` and `hypergeometric_3F2`
These functions are in stan-math from from the PRs https://github.com/stan-dev/math/pull/2792 and https://github.com/stan-dev/math/pull/2797.
Let's expose them.
There is demand on the forums https://discourse.mc-stan.org/t/gaussian-hypergeometric-function-for-exact-distribution-of-a-correlation/30606/3 https://discourse.mc-stan.org/t/hypergeometric-functions/252 https://discourse.mc-stan.org/t/confluent-hypergeometric-functions-to-estimate-population-size-and-detection-probability-from-spatially-replicated-counts/28758 (1F1 but still...)
Exposing these should be easy if you can provide the list of supported signatures
@andrjohns, I don't see a rev version of hypergeometric_3F2 so we probably shouldn't expose that now. I also see that hypergeometric_pFq has a comment about not being exposed to users but I think it could be useful. What are your thoughts on that?
At the end, I believe we just have hypergeometric_2F1 which is quite a useful function.
A couple of questions for @andrjohns:
- Does this function accept
complexarguments? Mathematically, it is able but not sure that is built out. - We do not have
apply_*to for vectorization so the signatures forhypergeometric_2F1area real or intb real or intc real or intz real or int - We need to handle the following restrictions in the function to
rejectand document this
| a | arbitrary |
|---|---|
| b | Must be greater 0 |
| c | Must be greater than b if |z| < 1, and c > b + a if z = 1 |
| z | |z| <= 1 |
More forum requests: https://discourse.mc-stan.org/t/how-to-use-stan-hypergeometric-2f1-in-stan/33840