IBM Support

Computing Complete Gamma Function

Troubleshooting


Problem

Can SPSS/PASW Statistics compute the complete gamma function?

Resolving The Problem

SPSS 6.0 and above can compute the gamma function for positive values of the variable A. The CDF.GAMMA(X,A,1) function, which calculates the cumulative distribution function for variable X under a gamma distribution with shape=A and scale=1, is an incomplete gamma function ratio (or simply an incomplete gamma function) (see Johnson, Kotz, & Balakrishnan, "Continuous Univariate Distributions", 2nd Ed., 1994, Chap. 3). You can use a recursive relationship between the incomplete gamma functions for A and A+1, i.e. Gi(X,A) and Gi(X,A+1), to find the complete gamma function for A, Gc(A). The recursive relationship is

Gi(X,A) = X**A * EXP[-X]/Gc(A+1) + Gi(X,A+1).

Now set X to 1, giving Gi(1,A) = EXP[-1]/Gc(A+1) + Gi(1,A+1).

which gives Gc(A+1) = EXP[-1]/(Gi(1,A) - Gi(1,A+1)).

Since Gc(A) = Gc(A+1)/A for A>0

Gc(A) = EXP[-1]/A/(Gi(1,A) - Gi(1,A+1)).

The SPSS command to implement this assignment is

COMPUTE GAMA = EXP(-1)/A/(CDF.GAMMA(1,A,1) - CDF.GAMMA(1,A+1,1)).

where A is a variable in the SPSS active file. GAMA will be defined for positive values of A

[{"Product":{"code":"SSLVMB","label":"IBM SPSS Statistics"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Not Applicable","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"Not Applicable","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Historical Number

12789

Document Information

Modified date:
16 April 2020

UID

swg21476013