IBM Support

Computing Complete Gamma Function

Technote (troubleshooting)


Problem(Abstract)

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

Related information

Need more help? Our Statistics forum is Live!

Historical Number

12789

Document information

More support for: SPSS Statistics

Software version: Not Applicable

Operating system(s): Platform Independent

Reference #: 1476013

Modified date: 07 September 2016


Translate this page: