GAMMALN


Returns the natural logarithm of the gamma function.

Syntax:

GAMMALN(x)


returns the natural logarithm of , the gamma function.

x must be greater than 0.

Example:

GAMMALN(4)

returns approximately 1.79.


Application:

Calculating the Log-Likelihood of a Gamma Distribution


A common application is calculating the log-likelihood of a set of data points assuming they follow a Gamma distribution. The probability density function (PDF) for a Gamma distribution is:



where α is the shape parameter, β is the rate parameter, and (α) is the Gamma function.


The log-likelihood for a single data point xi​ is ln(f(xi​)), which is:




The last term, −ln((α)), is precisely where the GAMMALN function is used to avoid calculating the massive value of (α).


Let's imagine we are a scientist studying the waiting times between major earthquakes in a particular region. Based on historical data, we hypothesize that these waiting times follow a Gamma distribution. We have a set of data points and want to calculate the log-likelihood of these parameters (α=5.5 and β=0.2) to see how well they fit the data.


Here is a table showing the calculation for three historical waiting times, demonstrating the use of the GAMMALN function.


Data and Parameters:


  • Shape parameter (α): 5.5
  • Rate parameter (β): 0.2
  • Log-Gamma of α: GAMMALN(5.5) = 3.9578


Table of Calculations:

Waiting Time (Years) (xi)

αln(β)

(α−1)ln(xi​)

−βxi​

-GAMMALN(α)

Log-Likelihood (for one xi​)

A
B
C
D
E
F
1
15
-8.8519
12.1862
-3
-3.9578
-3.6235
2
28
-8.8519
14.9949
-5.6
-3.9578
-3.4148
3
35
-8.8519
15.9991
-7
-3.9578
-3.8106

Result for GAMMALN(5.5):

3.9578

Explanation of the Table Columns:


  • Column A: The historical waiting time data points (xi​).
  • Column B: The term αln(β)=5.5⋅ln(0.2)=−8.8519. This value is constant for all data points.
  • Column C: The term (α−1)ln(xi​). This term depends on each specific waiting time xi​.
  • Column D: The term −βxi​. This term also depends on each specific waiting time xi​.
  • Column E: The crucial term −ln((α)). This is calculated using GAMMALN(5.5), which gives approximately 3.9578. The negative sign is applied in the formula. This value is also constant for all data points.
  • Column F: The final log-likelihood for each data point.


The key takeaway is that the GAMMALN function was a direct and necessary step in this calculation, allowing us to perform a complex statistical analysis without encountering numerical overflow errors.





This page is protected by Google reCAPTCHA. Privacy - Terms.
 
Built using Zapof