Evaluates the binomial cumulative probability distribution function.

Namespace: Imsl.Stat
Assembly: ImslCS (in ImslCS.dll) Version: 6.5.0.0

Syntax

C#
public static double Binomial(
	int k,
	int n,
	double pin
)
Visual Basic (Declaration)
Public Shared Function Binomial ( _
	k As Integer, _
	n As Integer, _
	pin As Double _
) As Double
Visual C++
public:
static double Binomial(
	int k, 
	int n, 
	double pin
)

Parameters

k
Type: System..::.Int32
The int argument for which the binomial distribution function is to be evaluated.
n
Type: System..::.Int32
The int number of Bernoulli trials.
pin
Type: System..::.Double
A double scalar value representing the probability of success on each independent trial.

Return Value

A double scalar value representing the probability that a binomial random variable takes a value less than or equal to k. This value is the probability that k or fewer successes occur in n independent Bernoulli trials, each of which has a pin probability of success.

Remarks

Method Cdf.Binomial evaluates the distribution function of a binomial random variable with parameters n and p with p=pin. It does this by summing probabilities of the random variable taking on the specific values in its range. These probabilities are computed by the recursive relationship

\Pr \left( {X = j} \right) =
            \frac{{\left( {n + 1 - j} \right)p}}{{j\left( {1 - p} \right)}}\Pr
            \left( {X = j - 1} \right)

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

See Also