Please note javascript is required for full website functionality.

Blog

A to Z of Excel Functions: The GAMMADIST Function

23 December 2019

Welcome back to our regular A to Z of Excel Functions blog.  Today we look at the GAMMADIST function.

 

The GAMMADIST function

The Gamma distribution is widely used in engineering, science and business, to model continuous variables that are always positive and have skewed distributions.  The Gamma distribution can be useful for any variable which is always positive, such as cohesion or shear strength for example. 

It is a distribution that arises naturally in processes for which the waiting times between events are relevant, and is often thought of as a waiting time between Poisson distributed events (the Poisson distribution is a discrete probability distribution that expresses the probability of a given number of events occurring in a fixed interval).  This is what is known as “queueing analysis”.

To understand it, first think of factorials, e.g. 5! = 5 x 4 x 3 x 2 x 1 = 120.  So far, so good, but how do you calculate if the factorial number you want to evaluate isn’t an integer?  The Gamma function is used to calculate this:

Г(N+1) = N * Г(N)

That’s great (if a little recursive), so can be expressed better (!) mathematically as follows:  

Clear as mud?  Well, it gets better.  The Gamma distribution just referred to has the following probability density function:

where Г(α) is the Gamma function, and the parameters α and β are both positive, i.e. α> 0 and β > 0:

  • α is known as the shape parameter, while β is referred to as the scale parameter
  • β has the effect of stretching or compressing the range of the Gamma distribution.  A Gamma distribution with β = 1 is known as the standard Gamma distribution.

The Gamma distribution represents a family of shapes.  As suggested by its name, α controls the shape of the family of distributions.  The fundamental shapes are characterized by the following values of α:

  • Case I (α < 1): when α < 1, the Gamma distribution is exponentially shaped and asymptotic to both the vertical and horizontal axes
  • Case II (α = 1): the Gamma distribution with shape parameter α = 1 and scale parameter β is the same as an exponential distribution of scale parameter (or mean) β
  • Case III (α > 1): when α is greater than one, the Gamma distribution assumes a mounded (unimodal), but skewed shape.  The skewness reduces as the value of α increases.

The GAMMADIST function has the following syntax

GAMMADIST(x, alpha, beta, cumulative)

It’s important to note that this function has been replaced with a new function (GAMMA.DIST) that may provide improved accuracy and whose name better reflects its usage and consistency with other programming languages.  Although this function is still available for backward compatibility, you should consider using the new functions from now on, because this function may not be available in future versions of Excel.

The GAMMADIST function has the following arguments:

  • x: this is required and this represents the value at which you want to evaluate the distribution
  • alpha: this is also required.  This is a parameter (the shape parameter) to the distribution
  • beta: this too is  required and is another parameter (the scale parameter) to the distribution.  If beta = 1, GAMMADIST returns the standard gamma distribution
  • cumulative: this final argument is required and is a logical value that determines the form of the function.  If cumulative is TRUE, GAMMADIST returns the cumulative distribution function; if FALSE, it returns the probability density function.

It should be noted that:

  • if x, alpha or beta is nonnumeric, GAMMADIST returns the #VALUE! error value
  • if x < 0, if alpha ≤ 0 or if beta ≤ 0, GAMMADIST returns the #NUM! error value
  • the equation for the gamma probability density function is:
  • the standard gamma probability density function is:
  • when alpha = 1, GAMMADIST returns the exponential distribution with:
  • for a positive integer n, when alpha = n/2, beta = 2, and cumulative = TRUE, GAMMADIST returns (1 - CHIDIST(x)) with n degrees of freedom
  • when alpha is a positive integer, GAMMADIST is also known as the Erlang distribution.

Please see my example below: 


We’ll continue our A to Z of Excel Functions soon.  Keep checking back – there’s a new blog post every business day.

A full page of the function articles can be found here


Newsletter