## Gamma Distribution

Here is the Gamma function. When you browse various statistics books you will find that the probability density function for the Gamma distribution is defined in different ways. However, this is one of the most common definitions of the density. Furthermore, I choose to define the density this way because the SAS PDF Function also does so.

To the right, I have plotted densities and their corresponding cumulative Densities for three different Gamma distributions with different shape and scale parameters. You can download the program creating the plots here and insert into your own editor.

The Exponential Distribution is a special case of the Gamma distribution with shape parameter and scale parameter .

Another special case of the Gamma distribution is the Chi-Squared Distribution with shape parameter and scale parameter . That means that we can interpret a distribution with degrees of freedom as a distribution.

Finally, I have previously written about how to Fit Continuous Distributions in SAS. Here, I write about fitting the Normal, Weibull and Lognormal distribution to univariate data. Needless to say, this method is also applicable for the Gamma distribution.

##### SAS Code Gamma Example

Below, I have written a small SAS program that lets you set the shape parameter and scale parameter and plot the corresponding Gamma probability density function. Consequently, I encourage you to copy/paste this code into your editor and familiarize yourself with how the shape and scale parameters affect the distribution. What happens when both parameters are small? And what happens when one is much bigger than the other?

%let a=2; %let lambda=2; data PDF; do x=0 to 15 by 0.01; pdf=pdf('Gamma', x, &a, &lambda); output; end; run; title "Gamma Probability Densities."; title2 "For Different Values of a=&a and (*ESC*){unicode lambda}=&lambda."; proc sgplot data = PDF noautolegend; series x=x y=pdf/ lineattrs=(thickness=3) legendlabel="a = 1 (*ESC*){unicode lambda} = 3"; yaxis label="PDF" labelattrs=(size=12 weight=Bold); xaxis label='x' labelattrs=(size=12 weight=Bold); run; title; |