# GeometricDistribution

represents a geometric distribution with probability parameter p.

# Details

- The probability for value in a geometric distribution is for non-negative integers, and is zero otherwise. »
- GeometricDistribution[p] is the distribution of the number of failures in a sequence of trials with success probability p before a success occurs.
- GeometricDistribution allows p to be a dimensionless quantity. »
- GeometricDistribution can be used with such functions as Mean, CDF, and RandomVariate. »

# Background & Context

- GeometricDistribution[p] represents a discrete statistical distribution defined at integer values and parametrized by a non-negative real number . The geometric distribution has a discrete probability density function (PDF) that is monotonically decreasing, with the parameter p determining the height and steepness of the PDF. The geometric distribution is sometimes referred to as the Furry distribution.
- The geometric distribution is sometimes said to be the discrete analog of the exponential distribution (ExponentialDistribution). It can be defined as the distribution that models the number of Bernoulli trials (i.e. number of trials of a variate having a BernoulliDistribution) needed to obtain a single success. The geometric distribution has been used to model a number of different phenomena across many fields, including the behavior of competing plant populations, dynamics of ticket control, particulars of congenital malformations, and estimation of animal abundance. Moreover, the geometric distribution has been used widely in reliability theory and is a staple in Markov chain models for meteorology, queueing theory, and applied stochastics.
- RandomVariate can be used to give one or more machine- or arbitrary-precision (the latter via the WorkingPrecision option) pseudorandom variates from a geometric distribution. Distributed[x,GeometricDistribution[p]], written more concisely as xGeometricDistribution[p], can be used to assert that a random variable x is distributed according to a geometric distribution. Such an assertion can then be used in functions such as Probability, NProbability, Expectation, and NExpectation.
- The probability density and cumulative distribution functions may be given using PDF[GeometricDistribution[p],x] and CDF[GeometricDistribution[p],x]. The mean, median, variance, raw moments, and central moments may be computed using Mean, Median, Variance, Moment, and CentralMoment, respectively. These quantities can be visualized using DiscretePlot.
- DistributionFitTest can be used to test if a given dataset is consistent with a geometric distribution, EstimatedDistribution to estimate a geometric parametric distribution from given data, and FindDistributionParameters to fit data to a geometric distribution. ProbabilityPlot can be used to generate a plot of the CDF of given data against the CDF of a symbolic geometric distribution and QuantilePlot to generate a plot of the quantiles of given data against the quantiles of a symbolic geometric distribution.
- TransformedDistribution can be used to represent a transformed geometric distribution, CensoredDistribution to represent the distribution of values censored between upper and lower values, and TruncatedDistribution to represent the distribution of values truncated between upper and lower values. CopulaDistribution can be used to build higher-dimensional distributions that contain a geometric distribution, and ProductDistribution can be used to compute a joint distribution with independent component distributions involving geometric distributions.
- GeometricDistribution is related to a number of other statistical distributions. For example, GeometricDistribution is a special case of the more general NegativeBinomialDistribution, in the sense that NegativeBinomialDistribution[1,p] has precisely the same PDF as GeometricDistribution[p] and that the sum of is distributed according to NegativeBinomialDistribution[n,p], provided that X
_{i}GeometricDistribution[p] for all . GeometricDistribution is also a transformation of PascalDistribution and can be viewed as a parameter mixture of PoissonDistribution with either GammaDistribution or ExponentialDistribution, in the sense that both ParameterMixtureDistribution[PoissonDistribution[μ],μGammaDistribution[1,(1-p)/p]] and ParameterMixtureDistribution[PoissonDistribution[μ],μ ExponentialDistribution[p/(1-p)]] are the same as GeometricDistribution[p]. GeometricDistribution is also related to WaringYuleDistribution, BinomialDistribution, PascalDistribution, and HypergeometricDistribution.

# Examples

open allclose all## Basic Examples (3)

## Scope (8)

Generate a sample of pseudorandom numbers from a geometric distribution:

Compare its histogram to the PDF:

Distribution parameters estimation:

Estimate the distribution parameters from sample data:

Compare the density histogram of the sample with the PDF of the estimated distribution:

Different moments with closed forms as functions of parameters:

Closed form for symbolic order:

Closed form for symbolic order:

Closed form for symbolic order:

Use dimensionless Quantity to define GeometricDistribution:

## Applications (11)

CDF of GeometricDistribution is an example of a right-continuous function:

A coin-tossing experiment consists of tossing a fair coin repeatedly until a tail results. Simulate the process:

Compute the probability that at least 4 coin tosses will be necessary:

Compute the expected number of coin tosses:

A person is standing by a road counting cars until he sees a red one, at which point he restarts the count. Simulate the counting process, assuming that 20% of the cars are red:

Find the expected number of cars to come by before the count starts over:

Find the probability of counting 10 or more cars before a red one:

A student will take a test repeatedly until he or she passes it, each time succeeding with probability p. Find the probability that the student succeeds in attempts or less:

Given that the student passes the test in attempts or less, find the PDF:

A budget-priced lighter has 90% probability of lighting on any given attempt. Simulate the lighting process; the result indicates the number of failures before successful lighting:

Find the probability that the lighter lights in 3 trials or less:

A cereal box contains one out of a set of different plastic animals. The animals are equally likely to occur, independently of what animals are in other boxes. Simulate the animal collection process, assuming there are 10 animals for 25 boxes:

After unique animals have been collected, the number of boxes needed to find a new unique animal among the remaining follows a geometric distribution with parameter . Find the expected number of boxes needed to get a new unique animal:

Number of boxes before next unique animal:

Find the expected number of boxes needed to collect 6 unique animals:

When a computer accesses memory, the desired data is in the cache with probability p. A cache miss occurs if the desired data is not in the cache. Find the probability of a cache miss on the memory access:

Find the probability that the first cache miss occurs after the 4 memory access:

Find the average number of memory accesses before the first cache miss:

Simulate the number of cache hits before a cache miss occurs, assuming 20% of your data is in the cache:

Assuming that access time is 10 ns for cache and 1000 ns for RAM, find the average access time:

A data stream containing data packets is repeatedly sent without order information. Find the distribution of the number of tries until the data stream arrives with all the packets in the right order for the first time:

Find the probability that the packets will arrive in the correct order on the 20 try or sooner:

Simulate the number of tries until the first ordered data stream:

Find the average number of tries until the first ordered data stream:

A player bets amount in a casino with no betting limit in a game with chance of winning . If he loses he doubles the bet, and if he wins he quits, hence the number of games played follows a geometric distribution, with expected number of games played represented as follows:

The cash reserve needed to win the game:

The player always leaves the casino collecting the amount of the initial bet:

The cash reserve needed to execute the above strategy is finite only for strictly favorable games, where :

In an optical communication system, transmitted light generates current at the receiver. The number of electrons follows the parametric mixture of Poisson distribution and other distributions, depending on the type of light. If the source uses coherent laser light of intensity , then the electron count distribution is Poisson:

Which is PoissonDistribution:

If the source uses thermal illumination, then the Poisson parameter follows ExponentialDistribution with parameter , and the electron count distribution is:

These two distributions are distinguishable and allow you to determine the type of source:

Find the sampling population expectation of the method of moment estimator for p:

Find sampling population expectations for a few small sample sizes:

## Properties & Relations (8)

The geometric distribution has the memoryless property:

The family of GeometricDistribution is closed under Min:

And for identically distributed variables:

Relationships to other distributions:

NegativeBinomialDistribution simplifies to geometric distribution:

Sum of independent geometric variables has NegativeBinomialDistribution:

Geometric distribution is a transformation of PascalDistribution:

WaringYuleDistribution is a parameter mixture of geometric distribution and UniformDistribution:

Geometric distribution is a parameter mixture of PoissonDistribution and GammaDistribution:

It is the same as the mixture with an ExponentialDistribution:

## Possible Issues (2)

GeometricDistribution is not defined when p is not between zero and one:

Substitution of invalid parameters into symbolic outputs gives results that are not meaningful: