Statistics Toolbox | ![]() ![]() |
Inverse of the geometric cumulative distribution function (cdf).
Syntax
X = geoinv(Y,P)
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).
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
See Also
geocdf
, geopdf
, geornd
, geostat
, icdf
![]() | geocdf | geomean | ![]() |