binomialDistribution

Binomial distribution and complemented binomial distribution

The binomial distribution is defined as the sum of the terms 0 through k of the Binomial probability density. The complement returns the sum of the terms k+1 through n.

binomialDistribution = $(BIGSUM j=0, k) $(CHOOSE n, j) pj (1-p)n-j

binomialDistributionCompl = $(BIGSUM j=k+1, n) $(CHOOSE n, j) pj (1-p)n-j

The terms are not summed directly; instead the incomplete beta integral is employed, according to the formula

y = binomialDistribution( k, n, p ) = betaDistribution( n-k, k+1, 1-p ).

The arguments must be positive, with p ranging from 0 to 1, and k<=n.

real
binomialDistribution
(
int k
,
int n
,
real p
)

Meta