The probability distribution of the number of Bernoulli trials needed to get one success, supported on the set ;
The probability distribution of the number of failures before the first success, supported on the set .
Which of these is called the geometric distribution is a matter of convention and convenience.
These two different geometric distributions should not be confused with each other. Often, the name shifted geometric distribution is adopted for the former one (distribution of ); however, to avoid ambiguity, it is considered wise to indicate which is intended, by mentioning the support explicitly.
The geometric distribution gives the probability that the first occurrence of success requires independent trials, each with success probability . If the probability of success on each trial is , then the probability that the -th trial is the first success is
for
The above form of the geometric distribution is used for modeling the number of trials up to and including the first success. By contrast, the following form of the geometric distribution is used for modeling the number of failures until the first success:
where is the number of trials and is the probability of success in each trial.[1]: 260–261
Alternatively, some texts define the distribution where and call the former the zero-truncated geometric distribution. This alters the probability mass function into:[2]: 66
An example of a geometric distribution arises from rolling a six-sided die until a "1" appears. Each roll is independent with a chance of success. The number of rolls needed follows a geometric distribution with .
The cumulants of the probability distribution of Y satisfy the recursion
where , the expected value of a geometrically distributed random variable defined over .
Proof of expected value
Consider the expected value of X as above, i.e. the average number of trials until a success.
On the first trial, we either succeed with probability , or we fail with probability .
If we fail the remaining mean number of trials until a success is identical to the original mean.
This follows from the fact that all trials are independent.
From this we get the formula:
which, if solved for , gives:
The expected value of can be found from the linearity of expectation, . It can also be shown in the following way:
The interchange of summation and differentiation is justified by the fact that convergent power seriesconverge uniformly on compact subsets of the set of points where they converge.
where and are natural numbers. The equality is still true when ≥ is substituted.[2]: 71
Among all discrete probability distributions supported on {1, 2, 3, ... } with given expected value μ, the geometric distribution X with parameter p = 1/μ is the one with the largest entropy.[4]
The geometric distribution of the number Y of failures before the first success is infinitely divisible, i.e., for any positive integer n, there exist independent identically distributed random variables Y1, ..., Yn whose sum has the same distribution that Y has. These will not be geometrically distributed unless n = 1; they follow a negative binomial distribution.
The decimal digits of the geometrically distributed random variable Y are a sequence of independent (and not identically distributed) random variables.[citation needed] For example, the hundreds digit D has this probability distribution:
where q = 1 − p, and similarly for the other digits, and, more generally, similarly for numeral systems with other bases than 10. When the base is 2, this shows that a geometrically distributed random variable can be written as a sum of independent random variables whose probability distributions are indecomposable.
The sum of independent geometric random variables with parameter is a negative binomial random variable with parameters and .[6] The geometric distribution is a special case of the negative binomial distribution, with .
The minimum of geometric random variables with parameters is also geometrically distributed with parameter .[7]
Suppose 0 < r < 1, and for k = 1, 2, 3, ... the random variable Xk has a Poisson distribution with expected value rk/k. Then
has a geometric distribution taking values in the set {0, 1, 2, ...}, with expected value r/(1 − r).[citation needed]
The exponential distribution is the continuous analogue of the geometric distribution. Applying the floor function to the exponential distribution with parameter creates a geometric distribution with parameter defined over .[2]: 74 This can be used to generate geometrically distributed pseudorandom numbers by first generating exponentially distributed pseudorandom numbers from a uniform pseudorandom number generator: then is geometrically distributed with parameter , if is uniformly distributed in [0,1].
If p = 1/n and X is geometrically distributed with parameter p, then the distribution of X/n approaches an exponential distribution with expected value 1 as n → ∞, since
More generally, if p = λ/n, where λ is a parameter, then as n→ ∞ the distribution of X/n approaches an exponential distribution with rate λ:
therefore the distribution function of X/n converges to , which is that of an exponential random variable.
Statistical inference
Parameter estimation
For both variants of the geometric distribution, the parameter p can be estimated by equating the expected value with the sample mean. This is the method of moments, which in this case happens to yield maximum likelihood estimates of p.[8][9]
Specifically, for the first variant let k = k1, ..., kn be a sample where ki ≥ 1 for i = 1, ..., n. Then p can be estimated as
In the programming language R, the function dgeom(k, prob) calculates the probability of k failures before a success with a success probability prob for each trial.
In Microsoft Excel, the function NEGBINOMDIST(number_f, number_s, probability_s) can be used to calculate the number of failures, number_f, before a number of successes, number_s, with a success probability, probability_s, for each trial. Setting number_s to 1, gives the geometric distribution.[11]