In probability theory and statistics, the gamma distribution is a continuous probability distribution with the probability density function defined for x > 0 that can be expressed in terms of the gamma function as follows:

where k >0 is the shape parameter and θ > 0 is the scale parameter of the gamma distribution.

The expected value and standard deviation of a gamma random variable X are:

E(X) = kθ and

Var(X) = kθ2.

In case k is an integer, the gamma distribution is an Erlang distribution (so named in honor of A.K. Erlang) and is the probability distribution of the waiting time of the kth "arrival" in a one-dimensional Poisson process with intensity 1/θ. If k is a half-integer and θ = 2, then the gamma distribution is a chi-square distribution with 2k degrees of freedom.