What This Calculator Does
The Gamma Distribution Calculator computes the probability density function (PDF) and cumulative distribution function (CDF) of a gamma distribution at a chosen point X, using a shape parameter k and a scale parameter θ. Alongside the PDF and CDF, it also reports the distribution's mean, variance, mode, skewness and kurtosis, giving you a full statistical picture from three simple inputs. The gamma distribution is widely used to model waiting times, rainfall amounts, insurance claim sizes and other continuous, positive-valued quantities.
The Three Inputs
- Shape parameter (k): Controls the form of the curve. Small k gives a steeply decaying shape; larger k makes it more bell-like.
- Scale parameter (θ): Stretches the distribution along the x-axis. Larger θ spreads probability over higher values.
- X value: The point at which the density and cumulative probability are evaluated.
The Formula
The PDF used by the calculator is:
$$f(x) = \frac{x^{\,k-1}\,e^{-x/\theta}}{\theta^{k}\,\Gamma(k)}$$Here \(\Gamma(k)\) is the gamma function. The CDF is the integral of this density from 0 to X, computed via the regularised lower incomplete gamma function. The calculator also derives summary statistics directly from the parameters:
- Mean = \(k\cdot\theta\)
- Variance = \(k\cdot\theta^{2}\)
- Mode = \((k-1)\cdot\theta\) when \(k > 1\), otherwise 0
- Skewness = \(2/\sqrt{k}\)
- Kurtosis (excess) = \(6/k\)
Worked Example
Suppose k = 2, θ = 3 and X = 4. The PDF is $$f(4) = \frac{4^{1}\cdot e^{-4/3}}{3^{2}\cdot \Gamma(2)} = \frac{4 \cdot 0.2636}{9} \approx 0.117.$$ The CDF at X = 4 is about 0.385, meaning roughly a 38.5% chance the variable falls at or below 4. The mean is \(2 \times 3 = 6\), the variance is \(2 \times 3^{2} = 18\), the mode is \((2-1) \times 3 = 3\), the skewness is \(2/\sqrt{2} \approx 1.414\) and the excess kurtosis is \(6/2 = 3\).
Key Terms and Related Distributions
- PDF (probability density function): the density \(f(x)\). Areas under it give probabilities. For the gamma distribution, \(f(x)=\dfrac{x^{k-1}e^{-x/\theta}}{\theta^{k}\,\Gamma(k)}\) for \(x>0\).
- CDF (cumulative distribution function): \(F(x)=P(X\le x)\), the probability that the variable is at most x.
- Shape (k): controls the form of the curve. It is also written α.
- Scale (θ): stretches the distribution along the x-axis, and it has the same units as X.
- Rate (β): the reciprocal of the scale, \(\beta = 1/\theta\), so \(\theta = 1/\beta\). Some software and textbooks parametrise the gamma by rate rather than scale. Check which one you have before entering values.
- Gamma function \(\Gamma(k)\): \(\Gamma(k)=\int_0^\infty t^{k-1}e^{-t}\,dt\). For positive integers, \(\Gamma(n)=(n-1)!\), and \(\Gamma(1/2)=\sqrt{\pi}\).
- Regularised incomplete gamma function: \(P(k,z)=\dfrac{\gamma(k,z)}{\Gamma(k)}\), where \(\gamma(k,z)=\int_0^z t^{k-1}e^{-t}\,dt\). The gamma CDF is \(F(x)=P(k,\,x/\theta)\).
- Excess kurtosis: the tail heaviness relative to a normal distribution, which has excess kurtosis 0. For the gamma distribution it equals \(6/k\).
Special cases
- Exponential: \(k=1\) gives an exponential distribution with mean θ.
- Chi-squared: \(k=\nu/2\) and \(\theta=2\) give a chi-squared distribution with ν degrees of freedom.
- Erlang: integer k gives an Erlang distribution, the sum of k independent exponentials with mean θ. Its CDF is \(1-e^{-x/\theta}\sum_{n=0}^{k-1}\dfrac{(x/\theta)^n}{n!}\).
- Rate to scale: \(\theta=1/\beta\). For example, a rate of 0.5 per unit corresponds to a scale of 2.
Interpreting the PDF and CDF Output
The PDF value is a density, not a probability. For a continuous variable, the probability of any single exact value is 0. The density can exceed 1 when the distribution is concentrated in a narrow range. For example, with k=2 and a very small scale such as θ=0.1, the density near the peak is well above 1. What must equal 1 is the total area under the curve.
CDF
- The CDF is \(F(x)=P(X\le x)\), and it always lies between 0 and 1.
- Upper tail: \(P(X>x)=1-F(x)\).
- Interval: \(P(a<X\le b)=F(b)-F(a)\). For k=2, θ=2, \(P(2<X\le 4)=0.593994-F(2)\), where \(F(2)=1-2e^{-1}=0.264241\), giving 0.329753.
Reading the shape
- k < 1: the density is unbounded as x approaches 0 and decreases steadily. There is no interior peak.
- k = 1: the distribution is exponential, with its highest density \(1/\theta\) at x=0.
- k > 1: the distribution is unimodal, with its peak at \((k-1)\theta\) and a long right tail.
Approach to normality
Skewness \(2/\sqrt{k}\) and excess kurtosis \(6/k\) both shrink as k grows. For k=100 they are 0.2 and 0.06, so the curve is close to a normal distribution with mean \(k\theta\) and variance \(k\theta^2\). For small k, a normal approximation is poor, especially in the tails and near zero.
Frequently Asked Questions
Is this scale or rate parameterisation? The calculator uses the scale form (θ). If you have a rate parameter β, convert it with \(\theta = 1/\beta\) before entering it.
What values are valid? Both k and θ must be positive, and X should be 0 or greater since the gamma distribution is defined only for non-negative values.
How does the gamma relate to the exponential and chi-squared? When k = 1 the gamma reduces to an exponential distribution with mean θ. A chi-squared distribution with v degrees of freedom is a gamma with \(k = v/2\) and \(\theta = 2\).