3
$\begingroup$

I ran scipy.stats.binom.cdf(500006, 1000000, 0.5) and it took less than a milisecond. This is crazy as binomial CDF involves summing up a bunch of binomial coefficients. What approximation algorithm goes behind the implementation? Thanks!

$\endgroup$

1 Answer 1

7
$\begingroup$

There's a connection between the binomial cdf and the beta cdf. As a result, most software implementations of binomial cdf use a call to a regularized incomplete beta function. That's what scipy.stats does also, as it says in the documentation of special.bdtr (which is what gets called when you ask for a binomial cdf)

https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.bdtr.html

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.