Gamma Distribution Calculator
- The gamma distribution with shape k = 2 and scale theta = 2 has mean k x theta = 4.00 and standard deviation sqrt(k) x theta = 2.83.
- Its CDF at x = 5 is the regularised lower incomplete gamma function P(k, x / theta) = P(2, 2.500) = 0.7127.
- The PDF at the same point is x^(k-1) e^(-x/theta) / (Gamma(k) theta^k) = 0.1026 - a density, not a probability, so it may exceed the CDF or even 1 for narrow distributions.
- Shape is what bends this family from the exponential (k = 1) through the chi-square (k = df/2, theta = 2) to near-normal humps at large k.
This gamma distribution calculator turns a shape and a scale into the probabilities you actually need: the mean, the standard deviation, and the chance of landing at or below a value you choose. For example, a gamma distribution with shape 2 and scale 2 has a mean of 4.00 and a standard deviation of 2.83, and the probability of a value at or below 5 is 0.7127. Enter your own parameters and the same figures come back for your case, so you can compare scenarios side by side instead of estimating from a curve.
The method behind the page is the regularised lower incomplete gamma function, the standard way to compute gamma probabilities. It is the same special function behind chi-square probabilities, since a chi-square is a gamma with shape df/2 and scale 2, which is why the results here line up with established statistical practice. The function also captures cases that resist intuition: with shape 5 and scale 1, only 0.1847 of the probability lies at or below 3, and shape 1 is simply the exponential distribution in disguise, where a scale of 3 gives a CDF at 2 of 0.4866. This page shows the formula, the step-by-step workings, worked examples and sources so you can check every number.
Worked examples
Shape 2, scale 2, at x = 5
(2 · 2 · 5)
| CDF P(X <= x) | 0.7127 |
| PDF at x | 0.1026 |
| Mean | 4.00 |
| Standard deviation | 2.83 |
| Variance | 8.00 |
Shape 5, scale 1, at x = 3
(5 · 1 · 3)
| CDF P(X <= x) | 0.1847 |
| PDF at x | 0.1680 |
| Mean | 5.00 |
| Standard deviation | 2.24 |
| Variance | 5.00 |
Shape 1 (the exponential case), scale 3, at x = 2
(1 · 3 · 2)
| CDF P(X <= x) | 0.4866 |
| PDF at x | 0.1711 |
| Mean | 3.00 |
| Standard deviation | 3.00 |
| Variance | 9.00 |
How the gamma distribution is calculated
A gamma distribution is described by two parameters, and everything else follows from them. The shape parameter, usually written k, controls the general form of the curve — whether probability piles up near zero or spreads into a hump further out. The scale parameter, usually written theta, sets the units on the horizontal axis, stretching or compressing the same underlying shape. A gamma distribution calculator takes these two numbers and returns the mean, the spread, and the probability of landing at or below any value you choose.
Two formulas connect the parameters to the distribution's center and spread. The mean is k times theta, and the variance is also k times theta, this time multiplied by theta again — that is, k theta squared. The standard deviation is the square root of that variance. Take shape 2 and scale 2: the mean is 2 times 2, or 4.00, and the standard deviation comes out to 2.83. Those two figures tell you where the distribution sits and how widely it scatters before you compute a single probability.
The probability that a value falls at or below some point x is given by the cumulative distribution function, written as P(k, x/theta) — the regularised lower incomplete gamma function evaluated at the shape k and at x divided by the scale. That special function is the engine inside a gamma distribution calculator, and it is the same one behind chi-square probabilities, because a chi-square distribution is simply a gamma with shape equal to the degrees of freedom divided by 2 and scale 2.
Working the shape 2, scale 2 example through: with a mean of 4.00 and a standard deviation of 2.83, the probability of a value at or below 5 is 0.7127. Roughly seven values in ten fall at or under 5, which fits a distribution centered at 4 with a spread of about 2.83. The numbers are not always so intuitive. With shape 5 and scale 1, only 0.1847 of the probability lies at or below 3, even though the mean is 5.00 — the mass has already moved past that mean, and it does so more slowly than intuition suggests.
The shape parameter can also collapse the gamma into a familiar special case. Shape 1 is the exponential distribution in disguise: with scale 3, the CDF at 2 is 0.4866. Seeing the parameters and the resulting probabilities side by side is what makes the shape-and-scale pair meaningful rather than abstract.
Shape and scale: what each knob does
A gamma distribution has two parameters, and each one changes the curve in a different way. The shape parameter controls the form of the distribution: at low values it looks like a curve that starts high and falls away, and as the shape grows the curve develops a hump and becomes more bell-like. The scale parameter stretches or compresses the horizontal axis without changing the basic form. A gamma distribution calculator lets you change both and watch the mean, standard deviation and probabilities respond, but the two knobs do different jobs, and the three examples below show how.
Start with shape 2 and scale 2. Here the mean is 4.00 and the standard deviation is 2.83, and the probability of a value at or below 5 is 0.7127. The shape of 2 gives a curve that rises from zero at the origin to a single peak and then tails off to the right. Because the scale is 2, that form is stretched along the axis, so the spread is wide relative to the mean and a good share of the probability sits above 5.
Now hold the scale at 1 and raise the shape to 5. With shape 5 and scale 1, only 0.1847 of the probability lies at or below 3. This is the shape parameter bending the curve toward a bell: the peak has moved out to the right, and the mass has shifted with it. The result is that a value as low as 3 is now in the lower tail, even though the mean sits at 5.00. The distribution has moved its mass past the mean more slowly than intuition suggests, which is exactly what a higher shape does.
Shape 1 is the other extreme, and it is the exponential distribution in disguise. With shape 1 and scale 3, the CDF at 2 is 0.4866. There is no hump at all here: the curve starts at its highest point at the origin and falls steadily. Turning the shape knob from 1 upward is what takes you from this exponential-like form to the bell-like form seen at shape 5, while the scale knob decides how far along the axis that form is stretched.
One more fact ties these ideas together. The gamma CDF is the regularised lower incomplete gamma function, the same special function behind chi-square probabilities, since a chi-square is a gamma with shape df/2 and scale 2. That is why changing the shape and scale in a gamma distribution calculator is not just a visual exercise: those two numbers feed directly into the same machinery used for chi-square work.
The gamma family tree
The gamma distribution is not one distribution so much as a family, and most of the named distributions you meet elsewhere are members of it wearing different labels. Changing the shape and scale parameters slides you along a spectrum: at one end sits the simple exponential, in the middle the Erlang, and off to the side the chi-square. A good gamma distribution calculator lets you dial in any shape and scale, so you can see these relationships for yourself rather than taking them on faith.
Shape 1 is the exponential distribution in disguise. Set the shape parameter to 1 and the gamma collapses exactly onto the exponential, with the scale playing the role of the exponential's mean. With a scale of 3, the probability of a value at or below 2 is 0.4866 — a little under half the mass, which is what you would expect when the mean wait is 3. Raise the shape to a whole number greater than 1 and you have the Erlang distribution, the classic model for the time until a fixed number of events have occurred in a Poisson process. Shape k counts the events; the scale sets the average gap between them.
That waiting-time reading is the most intuitive way into the family. If events arrive independently at a steady average rate, the time until the first one is exponential, and the time until the k-th one is gamma with shape k. As k grows, the distribution becomes more bell-like and less skewed, and its mass shifts rightward. With shape 5 and scale 1, only 0.1847 of the probability lies at or below 3 — the distribution has already moved its mass past its mean of 5.00 territory more slowly than intuition suggests. Compare that with shape 2 and scale 2, where the mean is 4.00, the standard deviation is 2.83, and the probability of a value at or below 5 is 0.7127. Same family, very different shapes.
The chi-square is the third familiar relative. A chi-square distribution with df degrees of freedom is simply a gamma with shape df/2 and scale 2. This is why the gamma CDF is the regularised lower incomplete gamma function — the same special function behind chi-square probabilities. So when you compute a chi-square p-value, you are really evaluating a gamma CDF in disguise. That single underlying function is what makes a gamma distribution calculator so broadly useful: it covers exponential waits, Erlang sums, and chi-square tests without switching tools.
Keep the mapping in mind as you work: shape 1 gives exponential, integer shape gives Erlang, shape df/2 with scale 2 gives chi-square, and any shape at all gives the general waiting time until k events. The parameters are the whole story — change them and the family member changes with them.
- Exponential: shape = 1, scale = mean waiting time
- Erlang: shape = a whole number k of events
- Chi-square: shape = df/2 and scale = 2
- Waiting time: the time until k events occur in a Poisson process
Where the gamma distribution is used
The gamma distribution is a workhorse for quantities that are positive and skewed right — values that pile up near zero and trail off in a long tail. Rainfall totals over a fixed period are a classic example: many locations record little or no rain, while a few record a great deal. Insurance claim sizes follow a similar pattern, with many modest claims and a small number of very large ones. Reliability lifetimes are another common fit, since a component often fails early or survives for a long time. In Bayesian statistics, the gamma is a standard prior for a rate parameter, partly because it is defined only on positive values, which is where rates must live.
The shape and scale parameters control how the mass is arranged, and the results are not always what intuition expects. Take a gamma distribution with shape 2 and scale 2. Its mean is 4.00 and its standard deviation is 2.83, and the probability of a value at or below 5 is 0.7127. Now take shape 5 and scale 1: only 0.1847 of the probability lies at or below 3, so the distribution has already moved its mass past its mean of 5.00 territory more slowly than intuition suggests. A gamma distribution calculator lets you set these parameters and read the probability you need without working the integral by hand.
One special case is worth knowing. Shape 1 is the exponential distribution in disguise: with scale 3, the CDF at 2 is 0.4866. That gives you a quick sanity check on any gamma tool — set the shape to 1 and the results should match an exponential calculation with the same scale.
A word on reading the output. The probability density function returns a density, not a probability. A PDF value like 0.1026 is a density, not a probability, so it is not the chance of seeing exactly that value — for a continuous variable, that chance is zero. To get probabilities, use the cumulative distribution function, which reports the probability of a value at or below your point. The gamma CDF is the regularised lower incomplete gamma function — the same special function behind chi-square probabilities, since a chi-square is a gamma with shape df/2 and scale 2. That connection means a gamma distribution calculator can double as a check on chi-square results when you convert the parameters correctly.
- Rainfall totals over a fixed period
- Insurance claim sizes
- Reliability lifetimes of components
- Bayesian priors for rate parameters
FAQs
What is the CDF of a gamma distribution at x?
The CDF is the regularised lower incomplete gamma function P(k, x/theta). For a gamma with shape 2 and scale 2 at x = 5, the CDF is 0.7127. That means about 71.27% of the distribution's probability falls at or below 5, and the remaining probability lies above it.
What are the mean and variance of a gamma distribution?
The mean is k theta and the variance is k theta squared, where k is the shape and theta is the scale. For shape 2 and scale 2, the mean is 4.00 and the variance is 8.00. The standard deviation would be the square root of the variance.
Is the exponential distribution a gamma distribution?
Yes, the exponential distribution is the shape 1 special case of the gamma distribution. With a scale of 3, its CDF at x = 2 is 0.4866. So when the shape parameter equals 1, the gamma calculator reproduces exponential results, and larger shape values give a more flexible family of curves.
How is the gamma distribution related to chi-square?
A chi-square distribution with df degrees of freedom is a gamma distribution with shape df/2 and scale 2. This means you can use gamma formulas to get chi-square probabilities, and a gamma calculator can handle chi-square questions by setting the shape to half the degrees of freedom and the scale to 2.
Can a gamma PDF be bigger than 1?
Yes. A PDF is a density, not a probability, so it is not limited to the range from 0 to 1. Narrow gamma distributions routinely exceed 1 near their peak. Only probabilities, found by integrating the density over an interval, must stay between 0 and 1.
What does the shape parameter do?
The shape parameter controls the form of the curve. Near 1, the distribution is a steep exponential decay. As the shape grows, the distribution becomes a symmetric bell centred near k theta, the mean. So the shape value tells you whether the curve is sharply decaying or roughly bell-shaped.