geometricCdf¶
Evaluates the discrete geometric cumulative distribution function (CDF).
Synopsis¶
geometricCdf (ix, pin)
Required Arguments¶
- int
ix
(Input) - Argument for which the discrete geometric CDF is to be evaluated.
ix
must be non-negative. - float
pin
(Input) - Probability parameter of the discrete geometric CDF (the probability of
success for each independent trial).
pin
must be in the open interval (0, 1).
Return Value¶
The probability that a discrete geometric random variable takes a value less
than or equal to ix
. A value of NaN is returned if an input value is in
error.
Description¶
The function geometricCdf
evaluates the discrete geometric cumulative
distribution function (CDF), defined
\[F(I|p) = \sum_{i=0}^{I} p(1-p)^i = 1 - (1-p)^{I+1}, \phantom{...} 0 < p < 1\]
where the return value F(I∣p) is the probability that up to I
= ix
trials would be observed before observing a success, and input
parameter p = pin
is the probability of success for each independent
trial.
Example¶
In this example, we evaluate the discrete geometric CDF at ix
= 3,
pin
= 0.25.
from __future__ import print_function
from numpy import *
from pyimsl.stat.geometricCdf import geometricCdf
ix = 3
pin = 0.25
p = geometricCdf(ix, pin)
print("The probability that a discrete geometric random variable")
print("with probability parameter pin = %4.2f is less than or equal" % pin)
print("to %1i is %8.6f" % (ix, p))
Output¶
The probability that a discrete geometric random variable
with probability parameter pin = 0.25 is less than or equal
to 3 is 0.683594