distribution is the continuous analogue of the geometric distribution. If X is an exponentially distributed random variable with parameter λ, then where is the floor (or greatest integer) function, is a geometrically distributed random variable with parameter p = 1 − e−λ (thus λ = −ln(1 − p)) 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 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. 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 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 The posterior mean E[p] approaches the maximum likelihood estimate 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 The posterior distribution of p given a Beta(α, β) prior is Again the posterior mean E[p] approaches the maximum likelihood estimate as α and β approach zero. For either estimate of using Maximum Likelihood, the bias is equal to which yields the bias-corrected maximum likelihood estimator 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) =