geomcdf

 

The geomcdf function calculates the geometric cumulative distribution (CDF).

Synopsis

geomcdf(trials,success_probability)

Summary

The geometric distribution is used for a random trial where there are exactly two mutually exclusive outcomes. It describes the probability p of a number of trials x needed to get a success. The geometric CDF is:

where q = 1 − p, the number of trials is x, and the probability of success in any given trial is p.

Example

Find the probability that, in a series of throws of a fair six-sided die, you will get N or fewer outcomes not equal to six before finally rolling a six.
 

  1. Create a 1-by-20 array called toss_array with a double attribute called toss:

    AFL% CREATE ARRAY toss_array<toss:double>[i=0:19];
      
  2. Put numerical values of 1-20 into the cells of the array:

    AFL% store(build(toss_array, double(i+1)), toss_array);
  3. Apply the geomcdf function to the values in the attribute toss:

    AFL% apply(toss_array, success_probability, geomcdf(toss, 1.0/6.0));

    The output is:

    {i} toss,success_probability
    {0} 1,0.305556
    {1} 2,0.421296
    {2} 3,0.517747
    {3} 4,0.598122
    {4} 5,0.665102
    {5} 6,0.720918
    {6} 7,0.767432
    {7} 8,0.806193
    {8} 9,0.838494
    {9} 10,0.865412
    {10} 11,0.887843
    {11} 12,0.906536
    {12} 13,0.922113
    {13} 14,0.935095
    {14} 15,0.945912
    {15} 16,0.954927
    {16} 17,0.962439
    {17} 18,0.968699
    {18} 19,0.973916
    {19} 20,0.978263
  4. Remove the example array:

    AFL% remove(toss_array);

Inverse

igeomcdf: Inverse geometric CDF.