The Geometric Distribution

Author

Dr Andrew Dalby

The geometric distribution depends again on a Bernoulli trial, that means some event being true. In this case we want to calculate the probability of how many trials you need to carry out before you are successful. For example How many rolls of a die will it take to get a six?

For the first roll the probability is 1/6.

For two rolls it is 5/6 x 1/6. That is the probability of getting a six multiplied by the probability of not getting a six the first roll.

This series then continues multiplying by 5/6 each time.

\[ P(X=x) = \left( \frac{5}{6} \right)^{x-1} \left( \frac{1}{6} \right) \]

Formal Mathematical Definition

The geometric distribution gives the probability of success in x trials for a process where the probability of success is constant.

\[f(x)= P(X=x) = p(1-p)^{x-1} \]

A classic example of this is any birth/death process or radioactive decay. There the probability is defined for a specific time increment and you can calculate the probability of the event occurring in multiples of this increment. For humans we usually specify the increment in years. This allows actuaries to calculate life expectancies.

The discrete geometric distribution is built into R which makes it easier to calculate the probabilities. The convention used by the R function is that you have k failures before a success. The function is defined by two arguments k and the probability of a success.

library(ggplot2)

x <- c(0:20)
y <- dgeom(x,1/6)
data <- data.frame(x,y)
plot <- ggplot(data=data, aes(x=x, y=y))+
  geom_bar(stat="identity", fill="steelblue") +
  labs(title="Probability of rolling your first six after n failures", x="Number of failures before success", y="Probability")
plot

If you roll the die 20 times and you still have not seen a six you might be right to start thinking that it isn’t a fair dice (my son once rolled a die 42 times and got no sixes and that is very unlucky).

In this case it is more revealing to plot the cumulative distribution function (ogive) which is the probability of getting a six in up to n rolls.

library(ggplot2)

x <- c(0:20)
y <- pgeom(x,1/6)
data <- data.frame(x,y)
plot <- ggplot(data=data, aes(x=x, y=y))+
  geom_bar(stat="identity", fill="steelblue") +
  labs(title="Probability of rolling your first six after n failures or less", x="Number of failures before success", y="Probability")
plot

For my son’s unlucky dice throwing I can calculate the probability using the cumulative distribution function. I can calculate the cumulative probability of having a six with 41 or less failures and subtract this from one to give the probability of at least 42 failures.

1-pgeom(41,1/6)
[1] 0.0004724846

Alternatively I could have calculated the probability from the binomial distribution with 42 trials and no successes.

pbinom(0,42,1/6)
[1] 0.0004724846

The three discrete random distributions that we have encountered so far are all related to one another depending on the question that you want to ask.

  1. Uniform random distribution - distribution of the events in a single trial.

  2. Binomial distribution - number of successes in n trials.

  3. Geometric distribution - probability of having a success after n failures.

There is one more related discrete probability distribution that has two different “origins” that cause arguments amongst the statistics community.

For some birth/death processes the probability of an individual event is very small, but there is a large population in which the event can happen. One such example is radioactive decay where the probability of an individual atom decaying in a time interval is small but given the large number of equivalent atoms the probability of one of them decaying in that time period is much larger. Another example is rare causes of death (such as horse kicks) amongst a large population.

This can be considered as either an example of the binomial with very small probabilities (how it was originally derived) or as the number of events in a given time described by a geometrically increasing or decreasing population (This gives it a more rigorous derivation and it fits with how it is used in biology). This is the Poisson distribution.

Before going on the Poisson it is useful to look at how to calculate the expected value (mean), variance and other functions of the discrete random variables as the Poisson distribution is summarised by a single parameter which is not the probability of an event.