The (discrete) cumulative distribution function of the binomial distribution
This functionality does not run in MATLAB.
stats::binomialCDF(n, p) returns a procedure representing the (discrete) cumulative distribution function
of the binomial distribution with "trial parameter" n and "probability parameter" p.
The procedure f := stats::binomialCDF(n, p) can be called in the form f(x) with an arithmetical expression x. The return value of f(x) is either a floating-point number, an exact numerical value, or a symbolic expression:
If x is a numerical real value and n is a positive integer, then an explicit value is returned. If p is a numerical value satisfying 0 ≤ p ∧ p ≤ 1, this is a numerical value. Otherwise, it is a symbolic expression in p.
If x is a numerical value with x < 0, then 0, respectively 0.0, is returned for any value of n and p.
For symbolic values of n, explicit results are returned if x is a numerical value with x < 2.
For symbolic values of n, explicit results are returned if n - x is a numerical value with n - x ≤ 2.
If n - x is a numerical value with n - x ≤ 0, then 1, respectively 1.0, is returned for any value of n and p.
In all other cases, f(x) returns the symbolic call binomialCDF(n, p)(x).
Numerical values for n are only accepted if they are positive integers.
Numerical values for p are only accepted if they satisfy 0 ≤ p ≤ 1.
If x is a real floating-point number, the result is a floating number provided n and p are numerical values. If x is an exact numerical value, the result is an exact number.
The function is sensitive to the environment variable DIGITS which determines the numerical working precision.
We evaluate the distribution function with n = 20 and at various points:
f := stats::binomialCDF(5, 3/4): f(-1), f(2), f(PI), f(5), f(6)
f(-1.2), f(2.0), f(float(PI)), f(5.5)
We use symbolic arguments:
f := stats::binomialCDF(n, p): f(x), f(8), f(8.0)
When numerical values are assigned to n and p, the function f starts to produce explicit results if the argument is numerical:
n := 3: p := 1/3: f(2), f(2.5), f(PI +1), f(4.0)
delete f, n, p:
If n and x are numerical, symbolic expressions are returned for symbolic values of p:
f := stats::binomialCDF(3, p): f(-1), f(0), f(3/2), f(1 + sqrt(3)), f(2.999), f(3)
The "trial parameter": an arithmetical expression representing a positive integer
The "probability parameter": an arithmetical expression representing a real number 0 ≤ p ≤ 1.