How to Use the Method of Moments for a Gamma Distribution
At a glance
- 1. Choose a parameterization
Write the gamma model using shape and scale, or convert the scale to a rate at the end.
- 2. Calculate sample moments
Find the sample mean and the variance with denominator n, matching the first two raw moments.
- 3. Solve for the parameters
Estimate shape as mean squared divided by variance, then estimate scale as variance divided by mean.
- 4. Check the result
Verify that the fitted gamma mean and variance match the sample moments you used.
The method of moments estimates a distribution’s parameters by matching theoretical moments to moments calculated from the data. For a two-parameter gamma distribution, matching the first two moments gives estimates of the shape and scale. The main convention to watch is whether the gamma model uses a scale or a rate, and whether the sample variance uses denominator or .
Define the gamma parameterization
Use the shape–scale form , where is the shape and is the scale. Its density is
The population mean and variance are
Some references instead use the shape–rate form, with rate . In that notation, the density contains , and the mean and variance are and .
Derive the method-of-moments estimates
Suppose are observations from the gamma distribution. Let the sample mean be
For the second moment, the method of moments uses the empirical raw moment . Equivalently, after subtracting the squared sample mean, it uses the variance with denominator :
Match these quantities to the gamma mean and variance:
Dividing the variance equation by the mean equation gives . Substituting this into the mean equation gives the estimates
For the shape–rate parameterization, take the reciprocal of the scale estimate:
These formulas require a positive sample mean and positive sample variance. If all observations are identical, then and the formulas do not give a finite, positive gamma shape and scale.
Worked example
Suppose the observed data are . The sample mean is
The variance using denominator is
Therefore,
The fitted model is in the shape–scale convention. In the shape–rate convention, it is , since the rate is the reciprocal of the scale. Checking the fitted moments confirms the result: the mean is , and the variance is .
Which sample variance should you use?
The strict method-of-moments calculation matches the first two empirical raw moments, so it uses , with denominator . Do not automatically substitute the usual unbiased sample variance
Some applied discussions or software may use when matching a theoretical mean and variance. That convention gives for shape and for scale; it is a different finite-sample calculation. Since , its estimates differ from the raw-moment method. Check which convention a problem or implementation specifies.
Common mistakes
- Mixing up scale and rate: The rate is the reciprocal of the scale. A scale estimate of corresponds to a rate estimate of , not .
- Using the wrong variance denominator: For the usual raw-moment method, use denominator . Using changes the estimates.
- Treating the gamma shape as the mean: The mean is the product ; the shape alone is not generally the mean.
- Ignoring the data assumptions: A gamma random variable is positive. If observations include zeros because of censoring, rounding, or a separate probability mass at zero, the ordinary two-parameter gamma model may not describe the data appropriately.
References
- Statistical Inference, Second Edition — George Casella and Roger L. Berger
- Continuous Univariate Distributions, Volume 1, Second Edition — Norman L. Johnson, Samuel Kotz, and N. Balakrishnan
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.