The type double function is imsls_d_discrete_uniform_inverse_cdf.
Required Arguments
floatp (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].
intn (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 discrete_uniform_inverse_cdf 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 I≤N with discrete uniform CDF value ≥p, defined
where p = p, N = n, and is defined as the smallest integer ≥ real value x.
Example
#include <imsls.h>
#include <stdio.h>
int main()
{
float p = 0.60;
int n = 5;
int ix;
ix = imsls_f_discrete_uniform_inverse_cdf(p, n);
printf("The probability that a discrete uniform ");
printf("random variable\nwith scale ");
printf("parameter n = %1i is less than ", n);
printf("or equal to %2i\nis %4.2f\n\n", ix, p);
}
Output
The probability that a discrete uniform random variable
with scale parameter n = 5 is less than or equal to 3