| Statistics Toolbox | ![]() |
Inverse of the geometric cumulative distribution function (cdf)
Syntax
Description
X = geoinv(Y,P)
returns the smallest positive 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.
Vector or matrix inputs for P and Y must have the same size, which is also the size of X. A scalar input for P and Y is expanded to a constant matrix with the same dimensions as the other input. The values in P and Y must lie on the interval [0 1].
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).
The example below shows the inverse method for generating random numbers from the geometric distribution.
See Also
geocdf, geopdf, geornd, geostat, icdf
| geocdf | geomean | ![]() |