geometric_inverse_cdf
Evaluates the inverse of the discrete geometric cumulative distribution function (CDF).
Synopsis
#include <imsls.h>
int imsls_f_geometric_inverse_cdf (float p, float pin)
The type double function is imsls_d_geometric_inverse_cdf.
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 geometric_inverse_cdf 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.
#include <imsls.h>
#include <stdio.h>
int main()
{
int ix;
float pin = 0.25;
float p = 0.6835;
ix = imsls_f_geometric_inverse_cdf(p, pin);
printf("The probability that a discrete geometric ");
printf("random variable\nwith probability ");
printf("parameter pin = %4.2f is less than ", pin);
printf("or equal\nto %2i is %6.4f\n\n", 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