Gamma Distribution, Explained
After reading this you will know when a gamma distribution fits your data, how its shape and scale controls change the curve, and how to compute densities, cumulative probabilities and quantiles by hand and with the calculator.
What the gamma distribution describes
The gamma distribution models a positive, right-skewed quantity: a total waiting time, an accumulated amount, a rainfall depth, an insurance loss. It lives on the interval from 0 to infinity and never goes negative. Its most common story is a waiting time built from several smaller waits.
Suppose calls arrive at a help desk at a steady average rate, and each call takes on average 2 minutes of processing that varies at random. If you wait for the 2nd call to finish, the total time you wait is not a single exponential wait but the sum of two of them. That sum follows a gamma distribution with shape k = 2 and scale \theta = 2 minutes. On average you wait k\theta = 4 minutes, but the distribution is skewed: short waits are common, long waits happen and stretch the right tail.
Two numbers set the shape of the curve. The shape parameter k (also written \alpha) counts how many exponential pieces stack up. The scale parameter \theta stretches the axis. Some books use the rate \beta = 1/\theta instead of the scale, so always check which convention a formula uses.
When to use it, and when not
Reach for the gamma when your quantity is continuous, strictly positive and skewed to the right, and when it plausibly arises as a sum or accumulation. Total service time across several jobs, time until the k-th event in a Poisson process, and aggregate claim amounts all fit.
The gamma sits at the center of a small family. Set k = 1 and it becomes the exponential distribution, the waiting time for a single event. The number of events itself, rather than the time, is Poisson. Set k = \nu/2 and \theta = 2 and you get the chi-square distribution with \nu degrees of freedom.
Do not use the gamma for data that can be negative or that is roughly symmetric; use the normal distribution there. For multiplicative, heavy-tailed data such as incomes or file sizes, the log-normal often fits better. For failure times where the hazard rate changes with age, the Weibull is more flexible. For proportions on [0, 1], use the beta distribution.
The density and its intuition
The probability density function for shape k and scale \theta is
Here x is the value you are asking about, e is the base of the natural log, and \Gamma(k) is the gamma function, the piece that generalizes the factorial. For a whole number, \Gamma(k) = (k-1)!, so \Gamma(2) = 1 and \Gamma(5) = 24.
The two factors pull in opposite directions. The term x^{k-1} rises as x grows, while e^{-x/\theta} falls. Their product peaks at the mode (k-1)\theta for k \ge 1, then decays. The mean and variance are
So with k = 2 and \theta = 2, the mean is 4, the variance is 8, and the standard deviation is \sqrt{8} \approx 2.828. Skewness is 2/\sqrt{k}, which equals 1.414 here. As k grows the skewness shrinks and the curve approaches a normal shape.
The cumulative probability uses the regularized lower incomplete gamma function P(k, x/\theta). There is no simple closed form for general k, so the calculator evaluates it numerically. For whole-number k it reduces to a finite Poisson sum, shown in the worked example.
Shape and scale in a picture
The scale only stretches the horizontal axis; it does not change the shape of the curve. The shape parameter does change the shape. At k = 1 the density starts at its highest value and only decays. At k = 2 it rises from zero, peaks, then falls. Larger k makes the hump taller, narrower relative to its mean, and more symmetric.
Worked example: the demo values
Probability of finishing within 4 minutes
Use the demo settings: shape k = 2, scale \theta = 2, value x = 4, in probability mode. You want P(X \le 4), the chance the total wait is at most 4 minutes.
- Form the standardized argument x/\theta = 4/2 = 2.
- Because k = 2 is a whole number, the CDF is a short Poisson sum: P(X \le x) = 1 - e^{-x/\theta}\sum_{n=0}^{k-1} \frac{(x/\theta)^n}{n!}.
- With k = 2 the sum has two terms: e^{-2}(1 + 2) = 3e^{-2}.
- Compute e^{-2} \approx 0.1353, so 3 \times 0.1353 = 0.4060.
- Therefore P(X \le 4) = 1 - 0.4060 = 0.5940.
So there is about a 59.4% chance the wait is 4 minutes or less. The density at x = 4, from the formula, is f(4) = \frac{4^{1} e^{-2}}{2^{2}\,\Gamma(2)} = \frac{4 \times 0.1353}{4} = 0.1353. The upper tail probability, the chance of waiting more than 4 minutes, is 1 - 0.5940 = 0.4060.
The quantile at p = 0.95
Switch to critical mode with p = 0.95, keeping k = 2 and \theta = 2. You want the value x with P(X \le x) = 0.95. There is no clean algebra here, so the calculator inverts the CDF numerically. The answer is x \approx 9.4877. You can check it: plug 9.4877 back into the Poisson-sum CDF and you recover 0.95 to four places. In words, 95% of waits finish within about 9.49 minutes, well past the mean of 4.
Reading and interpreting the output
The calculator reports three things depending on your mode. In probability mode it gives the density f(x) and the cumulative probability P(X \le x). In critical mode it gives the quantile x_p for the cumulative probability you enter.
- Density f(x)
- Height of the curve, not a probability. For continuous variables the probability at a single point is zero. Use the density to compare relative likelihoods or to plot the shape.
- Cumulative probability P(X \le x)
- Area under the curve to the left of x. This is the number you usually want.
- Upper tail P(X \gt x)
- Equal to 1 - P(X \le x). For a service-level target such as "finish 95% of jobs on time", the tail is the failure fraction.
- Quantile x_p
- The value with a given fraction of probability below it. The 0.5 quantile is the median, which for the demo is about
3.36, below the mean of4because of the right skew.
9.49, the quantile from the second example.Common mistakes
The biggest trap is the scale-versus-rate mix-up. Software and textbooks disagree: some parameterize by scale \theta, others by rate \beta = 1/\theta. This calculator uses scale. If a formula gives a rate of 0.5, enter a scale of 2, not 0.5. Getting this backward flips the mean from k\theta = 4 to k/\theta = 1.
Two more errors are common. First, treating the density as a probability: f(2) = 0.1839 is a height, not a 18.39% chance of the value being exactly 2. Second, expecting symmetry. The mean, median and mode are all different for the gamma. For the demo the mode is 2, the median is about 3.36, and the mean is 4. Do not assume the mean splits the probability in half; here 59.4% of the area lies below the mean.
Finally, watch non-integer shapes. If k = 2.5, the Poisson-sum shortcut no longer applies and you must use the incomplete gamma function directly. The calculator handles this, but hand calculations that assume integer k will be wrong.
Related calculators
If your shape is exactly 1, the exponential calculator is the direct tool. To count events rather than time them, use the Poisson calculator. For the chi-square special case in hypothesis testing, see the chi-square calculator. When your data is symmetric, the normal calculator and the z-score calculator apply. For discrete waiting-time cousins, compare the geometric and negative binomial calculators. For skewed data of a different flavor, try the Weibull or log-normal calculators.
Frequently asked questions
What is the difference between shape and scale?
Shape k controls the form of the curve and its skewness, which is 2/\sqrt{k}. Scale \theta stretches the horizontal axis without changing the shape. Doubling the scale doubles the mean and the standard deviation but leaves the skewness unchanged.
How is the gamma related to the exponential and chi-square?
An exponential with mean \theta is a gamma with k = 1. A chi-square with \nu degrees of freedom is a gamma with k = \nu/2 and \theta = 2. Summing k independent exponentials with the same mean gives a gamma with that shape k.
Why is the mean larger than the median?
The gamma is right-skewed for finite k. The long right tail pulls the mean above the median. For the demo the mean is 4 and the median is about 3.36. As k grows, the gap closes because the distribution becomes more symmetric.
Can the shape parameter be a fraction?
Yes. Any positive real value works, for example k = 0.5 or k = 2.7. Fractional shapes appear naturally in fitted models. The density and CDF are still defined through the gamma function; only the tidy factorial shortcuts require whole numbers.
What does a cumulative probability of 0.95 give me?
In critical mode with p = 0.95, the calculator returns the value below which 95% of the probability lies. For the demo that is about 9.49. Read it as a service target: 95% of waits finish within 9.49 minutes.