igeomcdf
The igeomcdf function calculates the inverse geometric cumulative distribution function (CDF).
Synopsis
igeomcdf(x,p)
Summary
The inverse geometric CDF returns the smallest positive integer x such that the geometric CDF evaluated for cumulative probability p is equal to or greater than x.
Example
Â
Given the value of the inverse geometric function, and the probability of getting a particular number from the roll of a fair die (1/6), calculate the smallest number of failures – rolling anything but a 6 for example – before rolling a success – a 6 in this case.
Â
Create a 5-by-5 matrix to hold the cumulative probabilities:
AFL% CREATE ARRAY probabilities<prob:double>[i=0:4; j=0:4];
Put numerical values of 1/26 to 25/26 into the cells of the matrix:
AFL% store(build(probabilities, (i*5+j+1)/26.0), probabilities);
Apply the igeomcdf function to the values in the attribute prob:
AFL% apply(probabilities, result, igeomcdf(prob, 0.1667));
The output is:{i,j} prob,result {0,0} 0.0384615,0 {0,1} 0.0769231,0 {0,2} 0.115385,0 {0,3} 0.153846,0 {0,4} 0.192308,1 {1,0} 0.230769,1 {1,1} 0.269231,1 {1,2} 0.307692,2 {1,3} 0.346154,2 {1,4} 0.384615,2 {2,0} 0.423077,3 {2,1} 0.461538,3 {2,2} 0.5,3 {2,3} 0.538462,4 {2,4} 0.576923,4 {3,0} 0.615385,5 {3,1} 0.653846,5 {3,2} 0.692308,6 {3,3} 0.730769,7 {3,4} 0.769231,8 {4,0} 0.807692,9 {4,1} 0.846154,10 {4,2} 0.884615,11 {4,3} 0.923077,14 {4,4} 0.961538,17
So, for example, there is a 96.1538% chance that you will roll 17 or fewer non-6s before rolling a 6.
Remove the example array:
AFL% remove(probabilities);
Â
Â