Why the Gamma MGF Needs Careful Parameterization
The gamma distribution is used to model positive quantities such as waiting times, service durations, and claim amounts under specified models. Its moment generating function (MGF) has a compact form, but two parameterizations are common: one uses a rate, and the other uses a scale. Confusing these parameters changes both the formula and the MGF's domain.
This tutorial derives the MGF for both conventions, explains why its domain has a finite upper endpoint, and shows how to recover the mean and variance by differentiation. The focus is on one gamma random variable; no result about sums of gamma variables is needed here.
A rate has units inverse to those of \(X\), whereas a scale has the same units as \(X\). Thus a waiting time measured in hours might have a rate measured per hour or a scale measured in hours. Before substituting into a formula, identify which parameterization is being used.
Deriving the Shape-Rate MGF
The MGF of \(X\) is \(M_X(t)=E[e^{tX}]\), for those real values of \(t\) for which this expectation is finite. For a gamma variable with shape \(\alpha\) and rate \(\beta\), substitute the density into the expectation:
This integral converges exactly when \(\beta-t>0\), or \(t<\beta\). In that case, set \(u=(\beta-t)x\). Then \(x=u/(\beta-t)\) and \(dx=du/(\beta-t)\), so
Substitution gives the MGF. The same integral also explains why the endpoint is excluded: at \(t=\beta\), the exponential factor in the integrand is \(1\), and \(\int_0^\infty x^{\alpha-1}\,dx\) diverges. For \(t>\beta\), the exponential factor grows as \(x\) increases, so the integral diverges as well.
For shape \(\alpha\) and scale \(\theta\), use \(\beta=1/\theta\). The equivalent expression is
Both formulas have \(M_X(0)=1\), as every MGF must: in the rate form, \((\beta/\beta)^\alpha=1\); in the scale form, \((1-0)^{-\alpha}=1\). The domain includes every negative \(t\) and all positive \(t\) below the stated upper endpoint.
Recovering the Mean and Variance
When the MGF exists in an interval containing zero, its first derivative at zero is the mean and its second derivative at zero is the second raw moment. The variance is the second raw moment minus the square of the mean. Differentiate the shape-rate expression:
Evaluating at zero gives \(E[X]=\alpha/\beta\) and \(E[X^2]=\alpha(\alpha+1)/\beta^2\). Therefore,
For the shape-scale form, the equivalent moments are \(E[X]=\alpha\theta\) and \(\operatorname{Var}(X)=\alpha\theta^2\). These are useful checks, but the derivative calculation also makes clear which derivative gives which quantity: \(M_X''(0)\) is not the variance.
Worked Example: A Shape-Rate MGF and Its Derivatives
A hypothetical equipment-repair duration \(X\), measured in days, has a gamma distribution with shape \(\alpha=3\) and rate \(\beta=2\) per day. Find its MGF and domain, evaluate it at \(t=1\) per day, and calculate its mean and variance using derivatives. There is no interest-rate or mortality assumption in this duration model.
Method and parameter check. This is the shape-rate convention, so the rate is \(\beta=2\) per day. The density is \(f_X(x)=2^3x^2e^{-2x}/\Gamma(3)\) for \(x>0\).
The MGF formula gives
The requested value is within the domain. Substituting \(t=1\) per day,
To find the moments by differentiation, write \(M_X(t)=8(2-t)^{-3}\). Then
At zero, \(M_X'(0)=24/16=3/2\) days and \(M_X''(0)=96/32=3\) days squared. Hence
Check and common mistake. The parameter formulas give mean \(3/2\) days and variance \(3/2^2=3/4\) days squared, matching the derivatives. Also, \(M_X(0)=(2/2)^3=1\). The value \(8\) belongs to \(t=1\), not \(t=0\); substituting zero must always return one.
Using the Shape-Scale Convention
The scale form is convenient when a problem states a characteristic time or amount in the same units as the random variable. Its MGF has the same structure, but the domain endpoint is the reciprocal of the scale. The following example checks the domain, an MGF value, and both moments.
Worked Example: A Shape-Scale Service-Time Model
A hypothetical service time \(X\) has a gamma distribution with shape \(\alpha=3\) and scale \(\theta=4\) hours. State its MGF and domain, evaluate it at \(t=0.1\) per hour, and find the mean and variance. No interest or mortality assumption applies.
Method and parameter check. The scale is \(4\) hours, not a rate of \(4\) per hour. The reciprocal rate is \(\beta=1/4\) per hour. Using the scale form directly,
Since \(0.1<0.25\), the requested input is in the domain. Substituting,
For the derivatives, \(M_X'(t)=12(1-4t)^{-4}\) and \(M_X''(t)=192(1-4t)^{-5}\). Thus \(E[X]=M_X'(0)=12\) hours and \(E[X^2]=M_X''(0)=192\) hours squared. The variance is
Check and common mistake. The shape-scale formulas confirm \(E[X]=3(4)=12\) hours and \(\operatorname{Var}(X)=3(4^2)=48\) hours squared. The upper endpoint is \(1/4=0.25\) per hour, not \(4\) per hour. The reciprocal is required because \(t\) has units inverse to \(X\).
Domain Checks and Units
A finite MGF value can be used only at an input strictly below the rate, or strictly below the reciprocal scale. This is not merely an algebraic restriction: outside the domain, the defining expectation is infinite. Always compare \(t\) with the endpoint before evaluating the formula.
Worked Example: Testing Inputs Against a Rate Domain
A hypothetical processing time \(X\), measured in days, has a gamma distribution with shape \(\alpha=4\) and rate \(\beta=0.5\) per day. Determine whether \(t=-0.2\), \(t=0.1\), and \(t=0.6\), each measured per day, are in the MGF domain. Evaluate the MGF at \(t=0.1\) and obtain the mean and variance. There is no interest or mortality assumption.
Method. The rate form gives
The domain test is a strict inequality. Since \(-0.2<0.5\), the first input is allowed. Since \(0.1<0.5\), the second is allowed. Since \(0.6\not<0.5\), the third is not allowed, and the MGF is infinite there.
At \(t=0.1\),
The mean is \(\alpha/\beta=4/0.5=8\) days, and the variance is \(\alpha/\beta^2=4/(0.5)^2=4/0.25=16\) days squared. Equivalently, \(M_X''(0)=\alpha(\alpha+1)/\beta^2=4(5)/0.25=80\), and \(80-8^2=16\).
Check and common mistake. \(M_X(0)=(0.5/0.5)^4=1\), and the derivative-based second-moment calculation agrees with the parameter variance. Do not replace the domain endpoint \(0.5\) by its reciprocal: the stated parameter is already the rate, so the condition is \(t<0.5\) per day.
Common Errors to Avoid
- Swapping rate and scale. Under shape-rate, \(M_X(t)=(\beta/(\beta-t))^\alpha\) and \(t<\beta\). Under shape-scale, \(M_X(t)=(1-\theta t)^{-\alpha}\) and \(t<1/\theta\).
- Allowing the endpoint. The condition is strict. At \(t=\beta\), or \(t=1/\theta\), the defining integral diverges.
- Reporting the second raw moment as the variance. First calculate \(M_X''(0)=E[X^2]\), then subtract \((M_X'(0))^2\).
- Ignoring units. If \(X\) is measured in hours, the input \(t\) and rate \(\beta\) are per hour; a scale \(\theta\) is in hours.
- Failing the normalization check. Substitution at \(t=0\) must give \(M_X(0)=1\). A different result usually signals an algebra or parameterization error.
Check Your Understanding
For each problem, identify the parameterization before using a formula. Answers are given at the end of each item.
- A hypothetical call-center resolution time has a gamma distribution with shape \(2\) and rate \(3\) per hour. State the MGF and its domain, then give the mean and variance. (Answer: \(M_X(t)=(3/(3-t))^2\) for \(t<3\) per hour; mean \(2/3\) hour; variance \(2/9\) hour squared.)
- A hypothetical inspection duration has shape \(5\) and scale \(2\) minutes. Find the MGF domain, evaluate \(M_X(0.25)\), and calculate the mean and variance. (Answer: \(t<0.5\) per minute; \(M_X(0.25)=32\); mean \(10\) minutes; variance \(20\) minutes squared.)
- A positive laboratory processing time has shape \(3\) and rate \(4\) per hour. State its domain, evaluate \(M_X(1)\), and find \(E[X]\) and \(\operatorname{Var}(X)\). (Answer: \(t<4\) per hour; \(M_X(1)=64/27\); mean \(3/4\) hour; variance \(3/16\) hour squared.)
- A hypothetical loss amount follows a gamma distribution with shape \(4\) and scale \(3\) thousand dollars. Is \(t=0.4\) per thousand dollars in the MGF domain? Regardless of that input, give the mean and variance. (Answer: No, because the domain is \(t<1/3\) per thousand dollars; mean \(12\) thousand dollars; variance \(36\) thousand-dollars squared.)
- A gamma variable has mean \(6\) hours and variance \(18\) hours squared. Determine its shape and rate, then state its MGF and domain. (Answer: shape \(\alpha=2\), rate \(\beta=1/3\) per hour; \(M_X(t)=(1-3t)^{-2}\) for \(t<1/3\) per hour.)