|
Brighton Webs Ltd.
Statistics for Energy and the Environment
|
||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||
|
Digamma Function The digamma function appears in several statistical applications, for example the maximum likelihood equations for the shape and scale factors of the gamma distribution. It is defined as: This is the gradient of: The the gamma and digamma functions are shown in the plot below: the digamma function is not always present in maths libraries (e.g. math.net) and spreadsheets such as Excel and it is a complex calculation. It is suggested that an approximation for real numbers greater than zero can be derived using numerical differentiation of the log(gamma) function. In Excel the the ln(gamma) function is available as gammaln(x). The basic numerical differentiation formula is: The choice of value of delta x will depend on the application, the precision of calculation (e.g. single, double etc.) and the nature of the gammaln function being called. In the author's experience, a value of 0.0001 has provided acceptable results for the application to which it was being applied. The value of psi(1) is -1 * Euler–Mascheroni constant, the values of this and the result of the approximation to six decimal places are shown below:
The results from the approximation follow th recurrence relationship: Selected values to 3 d.p. are shown in the table below:
It is not clear what the limitations or generality of this approach are, only that it has facilitated the use of the digamma functions within Excel and in-house software. Related material Digamma function |
|||||||||||||||||||||||||
| Page update: 02-Jun-2012 | |||||||||||||||||||||||||