| Statistics Toolbox | Search  Help Desk |
| geoinv | Examples |
Inverse of the geometric cumulative distribution function (cdf).
Syntax
X = geoinv(Y,P)
Description
geoinv(Y,P) returns the smallest integer X such that the geometric cdf evaluated at X is equal to or exceeds Y. You can think of Y as the probability of observing X successes in a row in independent trials where P is the probability of success in each trial. The arguments P and Y must lie on the interval [0 1]. Each X is a positive integer.Examples
The probability of correctly guessing the result of 10 coin tosses in a row is less than 0.001 (unless the coin is not fair.)psychic = geoinv(0.999,0.5)
psychic =
9
The example below shows the inverse method for generating random numbers from the geometric distribution.
rndgeo = geoinv(rand(2,5),0.5)
rndgeo =
0 1 3 1 0
0 1 0 2 0