Parameters of the gamma distribution

By Sam Berens (
Aim: To understand how parameters of the gamma distribution relate to the mean and variance of a gamma distributed random variable.
There are two common parameterisations of the gamma distribution (see Wikipedia for details). Here, we will discuss the shape (k) and scale (θ) parameterisation which is native to MATLAB. Note that in the MATLAB documentation, each parameter is denoted with a non-standard symbol: and .
To start with, lets define a random variable,X, that is drawn from a gamma distribution with parameters k and θ.
Both k and θ must be greater than 0.
Let x be the domain from which samples in X are drawn. The gamma distribution supports values of x ranging between 0 and positive infinity:
The density of samples across x is given by the gamma probability density function (PDF):
Where Γ refers to the gamma function. If we were to integrate over values of PDF, we would find that the first moment of X (i.e. the mean or expected value) is given by the following:
The second moment then turns out to be:
And the variance is given by subtracting the mean squared from the second moment:
Now we can substitute the equation for the mean of X into the equation for the variance of X to get that:
This leads to a simple expression for the parameter θ in terms of the mean and variance:
Again, with more substitution, we get that: