Common Probability Distributions

Bayesian statistics uses probability distributions as the inference "engine" for the estimation of the parameter values along with their uncertainties.

Imagine that probability distributions are small pieces of "Lego". We can build whatever we want with these little pieces. We can make a castle, a house, a city; literally anything we want. The same is true for probabilistic models in Bayesian statistics. We can build models from the simplest to the most complex using probability distributions and their relationships to each other. In this tutorial we will give a brief overview of the main probabilistic distributions, their mathematical notation and their main uses in Bayesian statistics.

A probability distribution is the mathematical function that gives the probabilities of occurrence of different possible outcomes for an experiment. It is a mathematical description of a random phenomenon in terms of its sample space and the probabilities of events (subsets of the sample space).

We generally use the notation X ~ Dist (par1, par2, ...). Where X is the variable,Dist is the name of the distribution, and par are the parameters that define how the distribution behaves. Any probabilistic distribution can be "parameterized" by specifying parameters that allow us to shape some aspects of the distribution for some specific purpose.

Let's start with discrete distributions and then we'll address the continuous ones.

Discrete

Discrete probability distributions are those where the results are discrete numbers (also called whole numbers): ,2,1,0,1,2,,N\dots, -2, 1, 0, 1, 2, \dots, N and NZN \in \mathbb{Z}. In discrete distributions we say the probability that a distribution takes certain values as "mass". The probability mass function PMF\text {PMF} is the function that specifies the probability of the random variable XX taking the value xx:

PMF(x)=P(X=x) \text{PMF}(x) = P(X = x)

Discrete Uniform

The discrete uniform distribution is a symmetric probability distribution in which a finite number of values are equally likely to be observed. Each of the nn values has an equal probability 1n\frac{1}{n}. Another way of saying "discrete uniform distribution" would be "a known and finite number of results equally likely to happen".

The discrete uniform distribution has two parameters and its notation is Unif(a,b)\text{Unif} (a, b):

  • Lower Bound (aa)

  • Upper Bound (bb)

Example: a 6-sided dice.

using CairoMakie
using Distributions

f, ax, b = barplot(
    DiscreteUniform(1, 6);
    axis=(;
        title="6-sided Dice",
        xlabel=L"\theta",
        ylabel="Mass",
        xticks=1:6,
        limits=(nothing, nothing, 0, 0.3),
    ),
)

Discrete Uniform between 1 and 6

Bernoulli

Bernoulli's distribution describes a binary event of a successful experiment. We usually represent 00 as failure and 11 as success, so the result of a Bernoulli distribution is a binary variable Y{0,1}Y \in \{ 0, 1 \}.

The Bernoulli distribution is widely used to model discrete binary outcomes in which there are only two possible results.

Bernoulli's distribution has only a single parameter and its notation is Bernoulli(p)\text{Bernoulli}(p):

  • Success Probability (pp)

Example: Whether the patient survived or died or whether the customer completes their purchase or not.

f, ax1, b = barplot(
    Bernoulli(0.5);
    width=0.3,
    axis=(;
        title=L"p=0.5",
        xlabel=L"\theta",
        ylabel="Mass",
        xticks=0:1,
        limits=(nothing, nothing, 0, 1),
    ),
)
ax2 = Axis(
    f[1, 2]; title=L"p=0.2", xlabel=L"\theta", xticks=0:1, limits=(nothing, nothing, 0, 1)
)
barplot!(ax2, Bernoulli(0.2); width=0.3)
linkaxes!(ax1, ax2)

Bernoulli with p={0.5,0.2}p = \{ 0.5, 0.2 \}

Binomial

The binomial distribution describes an event of the number of successes in a sequence of nnindependent experiment(s), each asking a yes-no question with a probability of success pp. Note that the Bernoulli distribution is a special case of the binomial distribution where the number of experiments is 11.

The binomial distribution has two parameters and its notation is Bin(n,p)\text{Bin} (n, p) or Binomial(n,p) \text{Binomial} (n, p):

  • Number of Experiment(s) (nn)

  • Probability of Success (pp)

Example: number of heads in 5 coin flips.

f, ax1, b = barplot(
    Binomial(5, 0.5); axis=(; title=L"p=0.5", xlabel=L"\theta", ylabel="Mass")
)
ax2 = Axis(f[1, 2]; title=L"p=0.2", xlabel=L"\theta")
barplot!(ax2, Binomial(5, 0.2))
linkaxes!(ax1, ax2)

Binomial with n=5n=5 and p={0.5,0.2}p = \{ 0.5, 0.2 \}

Poisson

The Poisson distribution expresses the probability that a given number of events will occur in a fixed interval of time or space if those events occur with a known constant average rate and regardless of the time since the last event. The Poisson distribution can also be used for the number of events at other specified intervals, such as distance, area or volume.

The Poisson distribution has one parameter and its notation is Poisson(λ)\text{Poisson} (\lambda):

  • Rate (λ\lambda)

Example: Number of emails you receive daily. Number of holes you find on the street.

f, ax1, b = barplot(
    Poisson(1); axis=(; title=L"\lambda=1", xlabel=L"\theta", ylabel="Mass")
)
ax2 = Axis(f[1, 2]; title=L"\lambda=4", xlabel=L"\theta")
barplot!(ax2, Poisson(4))
linkaxes!(ax1, ax2)

Poisson with λ={1,4}\lambda = \{ 1, 4 \}

Negative Binomial

The negative binomial distribution describes an event of the number of failures before the kkth success in a sequence of nn independent experiment(s), each asking a yes-no question with probability pp. Note that it becomes identical to the Poisson distribution at the limit of kk \to \infty. This makes the negative binomial a robust option to replace a Poisson distribution to model phenomena with a overdispersion* (excess expected variation in data).

The negative binomial distribution has two parameters and its notation is NB(k,p)\text{NB} (k, p) or Negative-Binomial(k,p)\text{Negative-Binomial} (k, p):

  • Number of Success(es) (kk)

  • Probability of Success (pp)

Any phenomenon that can be modeled with a Poisson distribution, can be modeled with a negative binomial distribution (Gelman et al., 2013; 2020).

Example: Annual count of tropical cyclones.

f, ax1, b = barplot(
    NegativeBinomial(1, 0.5); axis=(; title=L"k=1", xlabel=L"\theta", ylabel="Mass")
)
ax2 = Axis(f[1, 2]; title=L"k=2", xlabel=L"\theta")
barplot!(ax2, NegativeBinomial(2, 0.5))
linkaxes!(ax1, ax2)

Negative Binomial with p=0.5p=0.5 and r={1,2}r = \{ 1, 2 \}

Continuous

Continuous probability distributions are those where the results are values in a continuous range (also called real numbers): (,+)R(-\infty, +\infty) \in \mathbb{R}. In continuous distributions we call the probability that a distribution takes certain values as "density". As we are talking about real numbers we are not able to obtain the probability that a random variable XX takes the value of xx. This will always be 00, as there is no way to specify an exact value of xx. xx lives in the real numbers line, so we need to specify the probability that XX takes values in a range [a,b][a,b]. The probability density function PDF\text {PDF} is defined as:

PDF(x)=P(aXb)=abf(x)dx \text{PDF}(x) = P(a \leq X \leq b) = \int_a^b f(x) dx

Normal / Gaussian

This distribution is generally used in the social and natural sciences to represent continuous variables in which its distributions are not known. This assumption is due to the central limit theorem. The central limit theorem states that, in some conditions, the average of many samples (observations) of a random variable with finite mean and variance is itself a random variable whose distribution converges to a normal distribution as the number of samples increases. Therefore, physical quantities that are expected to be the sum of many independent processes (such as measurement errors) often have distributions that are expected to be nearly normal.

The normal distribution has two parameters and its notation is Normal(μ,σ2)\text{Normal} (\mu, \sigma^2) or N(μ,σ2)\text{N}(\mu, \sigma^2):

  • Mean (μ\mu): distribution mean which is also both the mode and the median of the distribution

  • Standard Deviation (σ\sigma): the variance of the distribution (σ2\sigma^2) is a measure of the dispersion of the observations in relation to the mean

Example: Height, Weight, etc.

f, ax, l = lines(
    Normal(0, 1);
    label=L"\sigma=1",
    linewidth=5,
    axis=(; xlabel=L"\theta", ylabel="Density", limits=(-4, 4, nothing, nothing)),
)
lines!(ax, Normal(0, 0.5); label=L"\sigma=0.5", linewidth=5)
lines!(ax, Normal(0, 2); label=L"\sigma=2", linewidth=5)
axislegend(ax)

Normal with μ=0\mu=0 and σ={1,0.5,2}\sigma = \{ 1, 0.5, 2 \}

Log-normal

The Log-normal distribution is a continuous probability distribution of a random variable whose logarithm is normally distributed. Thus, if a random variable XX is normally distributed by its natural log, then Y=log(X)Y =\log(X) will have a normal distribution.

A random variable with logarithmic distribution accepts only positive real values. It is a convenient and useful model for measurements in the physical sciences and engineering, as well as medicine, economics and other fields, eg. for energies, concentrations, lengths, financial returns and other values.

A log-normal process is the statistical realization of the multiplicative product of many independent random variables, each one being positive.

The log-normal distribution has two parameters and its notation is Log-Normal(μ,σ2)\text{Log-Normal} (\mu, \sigma^2):

  • Mean (μ\mu): natural logarithm of the mean the distribution

  • Standard Deviation (σ\sigma): natural logarithm of the variance of the distribution (σ2\sigma^2) is a measure of the dispersion of the observations in relation to the mean

f, ax, l = lines(
    LogNormal(0, 1);
    label=L"\sigma=1",
    linewidth=5,
    axis=(; xlabel=L"\theta", ylabel="Density", limits=(0, 3, nothing, nothing)),
)
lines!(ax, LogNormal(0, 0.25); label=L"\sigma=0.25", linewidth=5)
lines!(ax, LogNormal(0, 0.5); label=L"\sigma=0.5", linewidth=5)
axislegend(ax)

Log-Normal with μ=0\mu=0 and σ={1,0.25,0.5}\sigma = \{ 1, 0.25, 0.5 \}

Exponential

The exponential distribution is the probability distribution of time between events that occur continuously and independently at a constant average rate.

The exponential distribution has one parameter and its notation is Exp(λ)\text{Exp} (\lambda):

  • Rate (λ\lambda)

Example: How long until the next earthquake. How long until the next bus arrives.

f, ax, l = lines(
    Exponential(1);
    label=L"\lambda=1",
    linewidth=5,
    axis=(; xlabel=L"\theta", ylabel="Density", limits=(0, 4.5, nothing, nothing)),
)
lines!(ax, Exponential(0.5); label=L"\lambda=0.5", linewidth=5)
lines!(ax, Exponential(1.5); label=L"\lambda=2", linewidth=5)
axislegend(ax)

Exponential with λ={1,0.5,1.5}\lambda = \{ 1, 0.5, 1.5 \}

Student-tt distribution

Student-tt distribution appears when estimating the average of a population normally distributed in situations where the sample size is small and the population standard deviation is unknown.

If we take a sample of nn observations from a normal distribution, then the distribution Student-tt with ν=n1\nu = n-1 degrees of freedom can be defined as the distribution of the location of the sample mean relative to the true mean, divided by the standard deviation of the sample, after multiplying by the standardizing term n\sqrt{n}.

The Student-tt distribution is symmetrical and bell-shaped, like the normal distribution, but has longer tails, which means that it is more likely to produce values ​​that are far from its mean.

The Student-tt distribution has one parameter and its notation is Student-t(ν)\text{Student-$t$} (\nu):

  • Degrees of Freedom (ν\nu): controls how much it resembles a normal distribution

Example: A database full of outliers.

f, ax, l = lines(
    TDist(2);
    label=L"\nu=2",
    linewidth=5,
    axis=(; xlabel=L"\theta", ylabel="Density", limits=(-4, 4, nothing, nothing)),
)
lines!(ax, TDist(8); label=L"\nu=8", linewidth=5)
lines!(ax, TDist(30); label=L"\nu=30", linewidth=5)
axislegend(ax)

Student-tt with ν={2,8,30}\nu = \{ 2, 8, 30 \}

Beta Distribution

The beta distributions is a natural choice to model anything that is constrained to take values between 0 and 1. So it is a good candidate for probabilities and proportions.

The beta distribution has two parameters and its notation is Beta(a,b)\text{Beta} (a, b):

  • Shape parameter (aa or sometimes α\alpha): controls how much the shape is shifted towards 1

  • Shape parameter (bb or sometimes β\beta): controls how much the shape is shifted towards 0

Example: A basketball player has made already scored 5 free throws while missing 3 in a total of 8 attempts – Beta(3,5)\text{Beta}(3, 5).

f, ax, l = lines(
    Beta(1, 1);
    label=L"a=b=1",
    linewidth=5,
    axis=(; xlabel=L"\theta", ylabel="Density", limits=(0, 1, nothing, nothing)),
)
lines!(ax, Beta(3, 2); label=L"a=3, b=2", linewidth=5)
lines!(ax, Beta(2, 3); label=L"a=2, b=3", linewidth=5)
axislegend(ax)

Beta with different values of aa and bb

Distribution Zoo

I did not cover all existing distributions. There is a whole plethora of probabilistic distributions.

To access the entire "distribution zoo" use this tool from Ben Lambert (statistician from Imperial College of London): https://ben18785.shinyapps.io/distribution-zoo/

References

Gelman, A., Carlin, J. B., Stern, H. S., Dunson, D. B., Vehtari, A., & Rubin, D. B. (2013). Bayesian Data Analysis. Chapman and Hall/CRC.

Gelman, A., Hill, J., & Vehtari, A. (2020). Regression and other stories. Cambridge University Press.