Inverse of the Poisson distribution CDF

View versions (1)

Interface

#include <codecogs/statistics/distributions/discrete/poisson/cdf_inv.h>

using namespace Statistics::Distributions::Discrete::Poisson;

Returns the Poisson variable x such that the integral from 0 to x of the Poisson density is equal to the given probability y.

Example:

#include <iostream>
#include <codecogs/stats/dists/discrete/poisson/cdf_inv.h>
#include <codecogs/stats/dists/discrete/poisson/cdf.h>
using namespace Stats::Dists::Discrete::Poisson;
int main()
{
  printf( "    x              CDF              INV \n" );
  for( double x=0.5; x<16; x+=1.5 )
  {
    double y = CDF( 5, x );
    double z = CDF_inv( 5, y );
    printf( "%f \t %f \t %f \n", x, y, z );
  }
  return getchar();
}

Output:

x              CDF              INV
0.500000         0.999986        0.500000
2.000000         0.983436        2.000000
3.500000         0.857614        3.500000
5.000000         0.615961        5.000000
6.500000         0.369041        6.500000
8.000000         0.191236        8.000000
9.500000         0.088528        9.500000
11.000000        0.037520        11.000000
12.500000        0.014823        12.500000
14.000000        0.005532        14.000000
15.500000        0.001970        15.500000

Parameters

k
the number of terms to sum, must not be negative
y
the probability, must be in range 0..1 (but not equal to 1)

Returns

the Poisson variable x

if (k < 0) or (y < 0) or (y >= 1) this function writes to the error stream and returns value -1

GPL Licence — free for non commercial use. See Licence details.

Interactive Calculator

k
y
Result