The IMSL_BINOMIALCDF function evaluates the binomial distribution function.

This routine requires an IDL Advanced Math and Stats license. For more information, contact your sales or technical support representative.

The IMSL_BINOMIALCDF function evaluates the distribution function of a binomial random variable with parameters n and p by summing probabilities of the random variable taking on the specific values in its range. These probabilities are computed by the following recursive relationship:

To avoid the possibility of underflow, the probabilities are computed forward from 0 if k is not greater than n times p; otherwise, they are computed backward from n. The smallest positive machine number, ε, is used as the starting value for summing the probabilities, which are rescaled by (1 – p)nε if forward computation is performed and by pnε if backward computation is done. For the special case of p = 0, IMSL_BINOMIALCDF is set to 1; for the case p = 1, IMSL_BINOMIALCDF is set to 1 if k = n and is set to zero otherwise.

Examples


Suppose X is a binomial random variable with n = 5 and p = 0.95. This example finds the probability that X is less than or equal to 3.

p = IMSL_BINOMIALCDF(3, 5, .95)
PM, 'Pr(x < 3) = ', p, FORMAT = '(a12, f7.4)'

IDL prints:

Pr(x < 3) = 0.0226

Syntax


Result = IMSL_BINOMIALCDF(K, N, P [, /DOUBLE])

Return Value


The probability that k or fewer successes occur in n independent Bernoulli trials, each of which has a probability p of success.

Arguments


K

Argument for which the binomial distribution function is to be evaluated.

N

Number of Bernoulli trials.

P

Probability of success on each trial.

Keywords


DOUBLE (optional)

If present and nonzero, double precision is used.

Errors


Informational Errors

STAT_LESS_THAN_ZERO: Input parameter, k, is less than zero.

STAT_GREATER_THAN_N: Input parameter, k, is greater than the number of Bernoulli trials, n.

Version History


6.4

Introduced

See Also


IMSL_BINOMIALCOEF, IMSL_BINOMIALPDF