Английская Википедия:Geometric distribution
Шаблон:Short description
Шаблон:Distinguish
Шаблон:More footnotes neededШаблон:Infobox probability distribution 2</math>
| kurtosis = <math>6+\frac{p^2}{1-p}</math>
| entropy = <math>\tfrac{-(1-p)\log (1-p) - p \log p}{p}</math>
| mgf = <math>\frac{pe^t}{1-(1-p) e^t},</math>
for <math>t<-\ln(1-p)</math>
| char = <math>\frac{pe^{it}}{1-(1-p)e^{it}}</math>
| pgf = <math>\frac{pz}{1-(1-p)z}</math>
| parameters2 = <math>0 < p \leq 1</math> success probability (real)
| support2 = k failures where <math>k \in \{0,1,2,3,\dots\}</math>
| pdf2 = <math>(1 - p)^k p</math>
| cdf2 = <math>1-(1 - p)^{\lfloor x\rfloor+1}</math> for <math>x\geq 0</math>,
<math>0</math> for <math>x<0</math>
| mean2 = <math>\frac{1-p}{p}</math>
| median2 = <math>\left\lceil \frac{-1}{\log_2(1-p)} \right\rceil - 1</math>
(not unique if <math>-1/\log_2(1-p)</math> is an integer)
| mode2 = <math>0</math>
| variance2 = <math>\frac{1-p}{p^2}</math>
| skewness2 = <math>\frac{2-p}{\sqrt{1-p}}</math>
| kurtosis2 = <math>6+\frac{p^2}{1-p}</math>
| entropy2 = <math>\tfrac{-(1-p)\log (1-p) - p \log p}{p}</math>
| mgf2 = <math>\frac{p}{1-(1-p)e^t},</math>
for <math>t<-\ln(1-p)</math>
| char2 = <math>\frac{p}{1-(1-p)e^{it}}</math>
| pgf2 = <math>\frac{p}{1-(1-p)z}</math>
}}
In probability theory and statistics, the geometric distribution is either one of two discrete probability distributions:
- The probability distribution of the number <math>X</math> of Bernoulli trials needed to get one success, supported on the set <math>\{1,2,3,\ldots\}</math>;
- The probability distribution of the number <math>Y=X-1</math> of failures before the first success, supported on the set <math>\{0, 1, 2, \ldots \}</math>.
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 <math>X</math>); 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 <math>k</math> independent trials, each with success probability <math>p</math>. If the probability of success on each trial is <math>p</math>, then the probability that the <math>k</math>-th trial is the first success is
- <math>\Pr(X = k) = (1-p)^{k-1}p</math>
for <math>k=1,2,3,4,\dots</math>
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:
- <math>\Pr(Y=k) =\Pr(X=k+1)= (1 - p)^k p</math>
for <math>k=0,1,2,3,\dots</math>
In either case, the sequence of probabilities is a geometric sequence.
For example, suppose an ordinary die is thrown repeatedly until the first time a "1" appears. The probability distribution of the number of times it is thrown is supported on the infinite set <math>\{1,2,3,\dots\}</math> and is a geometric distribution with <math>p=1/6</math>.
The geometric distribution is denoted by Geo(p) where <math>0<p\leq 1</math>.[1]
Definitions
Consider a sequence of trials, where each trial has only two possible outcomes (designated failure and success). The probability of success is assumed to be the same for each trial. In such a sequence of trials, the geometric distribution is useful to model the number of failures before the first success since the experiment can have an indefinite number of trials until success, unlike the binomial distribution which has a set number of trials. The distribution gives the probability that there are zero failures before the first success, one failure before the first success, two failures before the first success, and so on.[2]
Assumptions: When is the geometric distribution an appropriate model?
The geometric distribution is an appropriate model if the following assumptions are true.[3]
- The phenomenon being modelled is a sequence of independent trials.
- There are only two possible outcomes for each trial, often designated success or failure.
- The probability of success, p, is the same for every trial.
If these conditions are true, then the geometric random variable Y is the count of the number of failures before the first success. The possible number of failures before the first success is 0, 1, 2, 3, and so on. In the graphs above, this formulation is shown on the right.
An alternative formulation is that the geometric random variable X is the total number of trials up to and including the first success, and the number of failures is X − 1. In the graphs above, this formulation is shown on the left.
Probability outcomes examples
The general formula to calculate the probability of k failures before the first success, where the probability of success is p and the probability of failure is q = 1 − p, is
- <math>\Pr(Y=k) = q^k\,p.</math>
for k = 0, 1, 2, 3, ...
E1) A doctor is seeking an antidepressant for a newly diagnosed patient. Suppose that, of the available anti-depressant drugs, the probability that any particular drug will be effective for a particular patient is p = 0.6. What is the probability that the first drug found to be effective for this patient is the first drug tried, the second drug tried, and so on? What is the expected number of drugs that will be tried to find one that is effective?
The probability that the first drug works. There are zero failures before the first success. Y = 0 failures. The probability Pr(zero failures before first success) is simply the probability that the first drug works.
- <math>\Pr(Y=0) = q^0\,p\ = 0.4^0 \times 0.6 = 1 \times 0.6 = 0.6.</math>
The probability that the first drug fails, but the second drug works. There is one failure before the first success. Y = 1 failure. The probability for this sequence of events is Pr(first drug fails) <math>\times</math> p(second drug succeeds), which is given by
- <math>\Pr(Y=1) = q^1\,p\ = 0.4^1 \times 0.6 = 0.4 \times 0.6 = 0.24.</math>
The probability that the first drug fails, the second drug fails, but the third drug works. There are two failures before the first success. Y = 2 failures. The probability for this sequence of events is Pr(first drug fails) <math>\times</math> p(second drug fails) <math>\times</math> Pr(third drug is success)
- <math>\Pr(Y=2) = q^2\,p, = 0.4^2 \times 0.6 = 0.096.</math>
E2) A newlywed couple plans to have children and will continue until the first girl. What is the probability that there are zero boys before the first girl, one boy before the first girl, two boys before the first girl, and so on?
The probability of having a girl (success) is p= 0.5 and the probability of having a boy (failure) is q = 1 − p = 0.5.
The probability of no boys before the first girl is
- <math>\Pr(Y=0) = q^0\,p\ = 0.5^0 \times 0.5 = 1 \times 0.5 = 0.5.</math>
The probability of one boy before the first girl is
- <math>\Pr(Y=1) = q^1\,p\ = 0.5^1 \times 0.5 = 0.5 \times 0.5 = 0.25.</math>
The probability of two boys before the first girl is
- <math>\Pr(Y=2) = q^2\,p\ = 0.5^2 \times 0.5 = 0.125.</math>
and so on.
Properties
Moments and cumulants
The expected value for the number of independent trials to get the first success, and the variance of a geometrically distributed random variable X is:
- <math>\operatorname{E}(X) = \frac{1}{p},
\qquad\operatorname{var}(X) = \frac{1-p}{p^2}.</math>
Similarly, the expected value and variance of the geometrically distributed random variable Y = X - 1 (See definition of distribution <math>\Pr(Y=k)</math>) is:
- <math>\operatorname{E}(Y) = \operatorname{E}(X-1) = \operatorname{E}(X)-1 = \frac{1-p} p,
\qquad\operatorname{var}(Y) = \frac{1-p}{p^2}.</math>
Proof
Expected value of X
Consider the expected value <math>\mathrm{E}(X)</math> of X as above, i.e. the average number of trials until a success. On the first trial we either succeed with probability <math>p</math>, or we fail with probability <math>1-p</math>. 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:
<math> \mathrm{E}(X) = p \cdot 1 + (1-p) \cdot (1 + \mathrm{E}(X)), </math>
which if solved for <math> \mathrm{E}(X) </math> gives:
<math> \mathrm{E}(X) = \frac{1}{p}. </math>
Expected value of Y
That the expected value of Y as above is (1 − p)/p can be trivially seen from <math>\mathrm{E}(Y) = \mathrm{E}(X-1) = \mathrm{E}(X) - 1 = \frac 1 p - 1 = \frac{1-p}{p}</math> or can be shown in the following way:
<math> \begin{align} \mathrm{E}(Y) & {} =\sum_{k=0}^\infty (1-p)^k p\cdot k \\ & {} =p\sum_{k=0}^\infty(1-p)^k k \\ & {} = p (1-p) \sum_{k=0}^\infty (1-p)^{k-1}\cdot k\\ & {} = p (1-p) \left[\frac{d}{dp}\left(-\sum_{k=0}^\infty (1-p)^k\right)\right] \\ & {} =p(1-p)\frac{d}{dp}\left(-\frac{1}{p}\right)=\frac{1-p}{p}. \end{align} </math>
The interchange of summation and differentiation is justified by the fact that convergent power series converge uniformly on compact subsets of the set of points where they converge.
Let μ = (1 − p)/p be the expected value of Y. Then the cumulants <math>\kappa_n</math> of the probability distribution of Y satisfy the recursion
- <math>\kappa_{n+1} = \mu(\mu+1) \frac{d\kappa_n}{d\mu}.</math>
Expected value examples
E3) A patient is waiting for a suitable matching kidney donor for a transplant. If the probability that a randomly selected donor is a suitable match is p = 0.1, what is the expected number of donors who will be tested before a matching donor is found?
With p = 0.1, the mean number of failures before the first success is E(Y) = (1 − p)/p =(1 − 0.1)/0.1 = 9.
For the alternative formulation, where X is the number of trials up to and including the first success, the expected value is E(X) = 1/p = 1/0.1 = 10.
For example 1 above, with p = 0.6, the mean number of failures before the first success is E(Y) = (1 − p)/p = (1 − 0.6)/0.6 = 0.67.
Higher-order moments
The moments for the number of failures before the first success are given by
- <math>
\begin{align} \mathrm{E}(Y^n) & {} =\sum_{k=0}^\infty (1-p)^k p\cdot k^n \\ & {} =p \operatorname{Li}_{-n}(1-p) & (\text{for }n \neq 0) \end{align} </math>
where <math> \operatorname{Li}_{-n}(1-p) </math> is the polylogarithm function.
General properties
- The probability-generating functions of X and Y are, respectively,
- <math>
\begin{align} G_X(s) & = \frac{s\,p}{1-s\,(1-p)}, \\[10pt] G_Y(s) & = \frac{p}{1-s\,(1-p)}, \quad |s| < (1-p)^{-1}. \end{align} </math>
- Like its continuous analogue (the exponential distribution), the geometric distribution is memoryless. That is, the following holds for every m and n.
- <math>\Pr\{X>m+n|X>n\}=\Pr\{X>m\}</math>
- The geometric distribution supported on {0, 1, 2, 3, ... } is the only memoryless discrete distribution. Note that the geometric distribution supported on {1, 2, ... } is not memoryless.
- 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:
- <math>\Pr(D=d) = {q^{100d} \over 1 + q^{100} + q^{200} + \cdots + q^{900}},</math>
- 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.
- Golomb coding is the optimal prefix codeШаблон:Clarify for the geometric discrete distribution.[5]
- The sum of two independent Geo(p) distributed random variables is not a geometric distribution.[1]
Related distributions
- The geometric distribution Y is a special case of the negative binomial distribution, with r = 1. More generally, if Y1, ..., Yr are independent geometrically distributed variables with parameter p, then the sum
- <math>Z = \sum_{m=1}^r Y_m</math>
- follows a negative binomial distribution with parameters r and p.[6]
- The geometric distribution is a special case of discrete compound Poisson distribution.
- If Y1, ..., Yr are independent geometrically distributed variables (with possibly different success parameters pm), then their minimum
- <math>W = \min_{m \in 1, \ldots, r} Y_m\,</math>
- is also geometrically distributed, with parameter <math>p = 1-\prod_m(1-p_{m}).</math> [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
- <math>\sum_{k=1}^\infty k\,X_k</math>
- 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. If X is an exponentially distributed random variable with parameter λ, then
- <math>Y = \lfloor X \rfloor,</math>
- where <math>\lfloor \quad \rfloor</math> is the floor (or greatest integer) function, is a geometrically distributed random variable with parameter p = 1 − e−λ (thus λ = −ln(1 − p)[8]) and taking values in the set {0, 1, 2, ...}. This can be used to generate geometrically distributed pseudorandom numbers by first generating exponentially distributed pseudorandom numbers from a uniform pseudorandom number generator: then <math>\lfloor \ln(U) / \ln(1-p)\rfloor</math> is geometrically distributed with parameter <math>p</math>, if <math>U</math> 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
- <math>
\begin{align} \Pr(X/n>a)=\Pr(X>na) & = (1-p)^{na} = \left(1-\frac 1 n \right)^{na} = \left[ \left( 1-\frac 1 n \right)^n \right]^{a} \\ & \to [e^{-1}]^{a} = e^{-a} \text{ as } n\to\infty. \end{align} </math>
More generally, if p = λ/n, where λ is a parameter, then as n→ ∞ the distribution of X/n approaches an exponential distribution with rate λ:
- <math>\Pr(X>nx)=\lim_{n \to \infty}(1-\lambda /n)^{nx}=e^{-\lambda x}</math>
therefore the distribution function of X/n converges to <math>1-e^{-\lambda x}</math>, 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.[9][10]
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
- <math>\widehat{p} = \left(\frac1n \sum_{i=1}^n k_i\right)^{-1} = \frac{n}{\sum_{i=1}^n k_i }. \!</math>
In Bayesian inference, the Beta distribution is the conjugate prior distribution for the parameter p. If this parameter is given a Beta(α, β) prior, then the posterior distribution is
- <math>p \sim \mathrm{Beta}\left(\alpha+n,\ \beta+\sum_{i=1}^n (k_i-1)\right). \!</math>
The posterior mean E[p] approaches the maximum likelihood estimate <math>\widehat{p}</math> as α and β approach zero.
In the alternative case, let k1, ..., kn be a sample where ki ≥ 0 for i = 1, ..., n. Then p can be estimated as
- <math>\widehat{p} = \left(1 + \frac1n \sum_{i=1}^n k_i\right)^{-1} = \frac{n}{\sum_{i=1}^n k_i + n}. \!</math>
The posterior distribution of p given a Beta(α, β) prior is[11]
- <math>p \sim \mathrm{Beta}\left(\alpha+n,\ \beta+\sum_{i=1}^n k_i\right). \!</math>
Again the posterior mean E[p] approaches the maximum likelihood estimate <math>\widehat{p}</math> as α and β approach zero.
For either estimate of <math>\widehat{p}</math> using Maximum Likelihood, the bias is equal to
- <math>
b \equiv \operatorname{E}\bigg[\;(\hat p_\mathrm{mle} - p)\;\bigg] = \frac{p\,(1-p)}{n} </math>
which yields the bias-corrected maximum likelihood estimator
- <math>
\hat{p\,}^*_\text{mle} = \hat{p\,}_\text{mle} - \hat{b\,} </math>
Computational methods
Geometric distribution using R
The R function dgeom(k, prob)
calculates the probability that there are k failures before the first success, where the argument "prob" is the probability of success on each trial.
For example,
dgeom(0,0.6) = 0.6
dgeom(1,0.6) = 0.24
R uses the convention that k is the number of failures, so that the number of trials up to and including the first success is k + 1.
The following R code creates a graph of the geometric distribution from Y = 0 to 10, with p = 0.6.
Y=0:10
plot(Y, dgeom(Y,0.6), type="h", ylim=c(0,1), main="Geometric distribution for p=0.6", ylab="Pr(Y=Y)", xlab="Y=Number of failures before first success")
Geometric distribution using Excel
The geometric distribution, for the number of failures before the first success, is a special case of the negative binomial distribution, for the number of failures before s successes.
The Excel function NEGBINOMDIST(number_f, number_s, probability_s)
calculates the probability of k = number_f failures before s = number_s successes where p = probability_s is the probability of success on each trial. For the geometric distribution, let number_s = 1 success.[12]
For example,
=NEGBINOMDIST(0, 1, 0.6)
= 0.6
=NEGBINOMDIST(1, 1, 0.6)
= 0.24
Like R, Excel uses the convention that k is the number of failures, so that the number of trials up to and including the first success is k + 1.
See also
- Hypergeometric distribution
- Coupon collector's problem
- Compound Poisson distribution
- Negative binomial distribution
References
External links
- ↑ 1,0 1,1 Шаблон:Cite book
- ↑ Шаблон:Cite book
- ↑ Шаблон:Cite web
- ↑ Шаблон:Cite journal
- ↑ Шаблон:Cite journal
- ↑ Pitman, Jim. Probability (1993 edition). Springer Publishers. pp 372.
- ↑ Шаблон:Cite journal
- ↑ Шаблон:Cite web
- ↑ Шаблон:Cite book
- ↑ Шаблон:Cite web
- ↑ Шаблон:Cite web
- ↑ Шаблон:Cite web