Documentation Center

  • Trial Software
  • Product Updates

geocdf

Geometric cumulative distribution function

Syntax

y = geocdf(x,P)
y = geocdf(x,P,'upper')

Description

y = geocdf(x,P) computes the geometric cdf at each of the values in x using the corresponding probabilities in P. x and P can be vectors, matrices, or multidimensional arrays that all have the same size. A scalar input is expanded to a constant array with the same dimensions as the other input. The parameters in P must lie on the interval [0 1].

y = geocdf(x,P,'upper') returns the complement of the geometric cdf at each value in x, using an algorithm that more accurately computes the extreme upper tail probabilities.

The geometric cdf is

where .

The result, y, is the probability of observing up to x trials before a success, when the probability of success in any given trial is p.

Examples

expand all

Compute Geometric Distribution CDF

Suppose you toss a fair coin repeatedly. If the coin lands face up (heads), that is a success. What is the probability of observing three or fewer tails before getting a heads?

p = geocdf(3,0.5)
p =
  0.9375

See Also

| | | | |

Was this topic helpful?