discreteUniformInverseCdf

Evaluates the inverse of the discrete uniform cumulative distribution function (CDF).

Synopsis

discreteUniformInverseCdf(p, n)

Required Arguments

float p (Input)
Probability for which the inverse of the discrete uniform cumulative distribution function is to be evaluated. p must lie in the closed interval [0, 1].
int n (Input)
Scale parameter. n must be positive.

Return Value

The probability that a discrete uniform 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 discreteUniformInverseCdf evaluates the integer value I of the discrete uniform inverse cumulative distribution function (CDF) with probability argument p and scale parameter N, i.e., the smallest integer IN with discrete uniform CDF value ≥ p, defined

\[I = F^{-1}(p|N) = \lceil pN \rceil, \phantom{...} 0 \leq p \leq 1\]

where p = p, N = n, and \(\lceil x \rceil\) is defined as the smallest integer ≥ real value x.

Example

from __future__ import print_function
from numpy import *
from pyimsl.stat.discreteUniformInverseCdf import discreteUniformInverseCdf

p = 0.60
n = 5

ix = discreteUniformInverseCdf(p, n)

print("The probability that a discrete uniform random variable")
print("with scale parameter n = %1i is less than or equal to %2i" % (n, ix))
print("is %4.2f" % p)

Output

The probability that a discrete uniform random variable
with scale parameter n = 5 is less than or equal to  3
is 0.60