Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

geoinv

Geometric inverse cumulative distribution function

Syntax

x = geoinv(y,p)

Description

x = geoinv(y,p) returns the inverse cumulative distribution function (icdf) of the geometric distribution at each value in y using the corresponding probabilities in p.

geoinv 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.

y and p can be vectors, matrices, or multidimensional arrays that all have the same size. A scalar input for p or y is expanded to a constant array with the same dimensions as the other input. The values in p and y must lie on the interval [0,1].

Examples

collapse all

Suppose the probability of a five-year-old car battery not starting in cold weather is 0.03. If we want no more than a ten percent chance that the car does not start, what is the maximum number of days in a row that we should try to start the car?

To solve, compute the inverse cdf of the geometric distribution. In this example, a "success" means the car does not start, while a "failure" means the car does start. The probability of success for each trial p equals 0.03, while the probability of observing x failures in a row before observing a success y equals 0.1.

y = 0.1;
p = 0.03;
x = geoinv(y,p)
x =

     3

The returned result indicates that if we start the car three times, there is at least a ten percent chance that it will not start on one of those tries. Therefore, if we want no greater than a ten percent chance that the car will not start, we should only attempt to start it for a maximum of two days in a row.

We can confirm this result by evaluating the cdf at values of x equal to 2 and 3, given the probability of success for each trial p equal to 0.03.

y2 = geocdf(2,p)  % cdf for x = 2
y3 = geocdf(3,p)  % cdf for x = 3
y2 =

    0.0873


y3 =

    0.1147

The returned results indicate an 8.7% chance of the car not starting if we try two days in a row, and an 11.5% chance of not starting if we try three days in a row.

See Also

| | | |

Introduced before R2006a

Was this topic helpful?