geometricInverseCdf¶
Evaluates the inverse of the discrete geometric cumulative distribution function (CDF).
Synopsis¶
geometricInverseCdf (p, pin)
Required Arguments¶
- float
p
(Input) - Probability for which the inverse of the discrete geometric CDF is to be
evaluated.
p
must be in the open interval (0, 1). - 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 the returned value is the input probability, p
. A value
of -1 is returned if an input value is in error.
Description¶
The function geometricInverseCdf
evaluates the inverse CDF of a discrete
geometric random variable with parameter pin
. The discrete geometric CDF
is defined:
where the return value \(p=F(I|P)\) is the probability that up to I
trials would be observed before observing a success, and input parameter P
= pin
is the probability of success for each independent trial. The
discrete geometric inverse CDF is defined:
which is the smallest integer I such that the discrete geometric CDF is
greater than or equal to input argument p = p
, where 0 < p < 1, and
input parameter P = pin
.
Example¶
In this example, we evaluate the inverse probability function at pin
=
0.25, p
= 0.6835.
from __future__ import print_function
from numpy import *
from pyimsl.stat.geometricInverseCdf import geometricInverseCdf
pin = 0.25
p = 0.6835
ix = geometricInverseCdf(p, 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 %2i is %6.4f" % (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.6835