Tutorials › VEE Mathematical Statistics › Profiling A Gamma Shape Parameter

VEE Mathematical Statistics · Likelihood Ratio Tests · Tutorial 651 of 880

Profiling A Gamma Shape Parameter

You will learn how to profile the unknown gamma scale and use the sample sum and log observations to construct a likelihood-ratio test for the shape.

Advanced 11 min read

What You'll Learn

  • State the gamma shape-scale model and the likelihood-ratio hypotheses
  • Profile the unknown scale under both the null and unrestricted models
  • Calculate the shape estimate from the sample sum and sum of log observations
  • Evaluate the likelihood-ratio statistic with its required sample-size factor
  • Recognize when the unrestricted shape estimate is not finite
  • Interpret the chi-square calibration as an asymptotic result

Why Profile the Scale?

A gamma model has two parameters: shape and scale. In many applications, the question concerns the shape—for example, whether hypothetical claim severities have a specified degree of right-skewness—while the scale is not known in advance. A likelihood-ratio test can address the shape question without pretending that the scale is known: maximize the likelihood over the scale under each shape constraint, then compare the resulting maximized likelihoods.

The key calculation is to express the profiled likelihood using two summaries: the sample sum and the sum of the logarithms. The scale affects the overall magnitude of observations, while the shape information in this test is captured by how the arithmetic and geometric means compare.

Model and hypotheses: Let \(X_1,\ldots,X_n\) be independent observations from a gamma distribution with shape \(\alpha>0\) and scale \(\theta>0\), using density \(f(x;\alpha,\theta)=x^{\alpha-1}e^{-x/\theta}/\{\Gamma(\alpha)\theta^\alpha\}\) for \(x>0\). For a specified \(\alpha_0>0\), test \(H_0:\alpha=\alpha_0\) against \(H_1:\alpha\ne\alpha_0\), with \(\theta\) unknown under both hypotheses.

Here \(\theta\) is a scale, not a rate: the mean is \(\alpha\theta\) and the variance is \(\alpha\theta^2\). The observations must be positive and the model assumes they are independent and identically distributed. This is a continuous-data model; zero observations or dependence require a different model or additional treatment.

Profile the Scale Parameter

Write \(S=\sum_{i=1}^n x_i\) and \(L=\sum_{i=1}^n\log x_i\). For observed positive values \(x_1,\ldots,x_n\), the log-likelihood is

$$ \ell(\alpha,\theta) =(\alpha-1)L-\frac{S}{\theta}-n\alpha\log\theta-n\log\Gamma(\alpha). $$

For a fixed \(\alpha\), differentiate with respect to \(\theta\):

$$ \frac{\partial\ell}{\partial\theta} =\frac{S}{\theta^2}-\frac{n\alpha}{\theta}. $$

Setting this derivative equal to zero gives \(\widehat{\theta}(\alpha)=S/(n\alpha)=\bar{x}/\alpha\), where \(\bar{x}=S/n\). The second derivative is \(-2S/\theta^3+n\alpha/\theta^2\); at \(\theta=S/(n\alpha)\), it equals \(-n\alpha/\theta^2<0\). Thus this is the maximizing scale for each fixed positive shape.

Profile likelihood: Define the per-observation quantity \(r=\log\bar{x}-L/n=\log\bar{x}-(1/n)\sum_{i=1}^n\log x_i\), and define \(q(\alpha)=\alpha\log\alpha-\alpha-\log\Gamma(\alpha)-\alpha r\). After substituting \(\widehat{\theta}(\alpha)=\bar{x}/\alpha\), the profile log-likelihood is \(nq(\alpha)\) plus a term that does not depend on \(\alpha\). The full profile log-likelihood therefore contains the factor \(n\).

The quantity \(r\) is the log of the arithmetic mean divided by the geometric mean. By the arithmetic-geometric mean inequality, \(r\ge 0\), with equality exactly when all observations are equal. For nonidentical observations, \(r>0\). The unrestricted shape estimate is the positive solution of

$$ \log\widehat{\alpha}-\psi(\widehat{\alpha})=r, $$

where \(\psi(\alpha)=\frac{d}{d\alpha}\log\Gamma(\alpha)\) is the digamma function. This equation is generally solved numerically.

Likelihood-Ratio Statistic and Its Justification

The likelihood-ratio statistic compares the largest likelihood permitted by the null with the largest likelihood in the full model. Under the null, the shape is fixed at \(\alpha_0\), and the maximizing scale is \(\widehat{\theta}_0=\bar{x}/\alpha_0\). In the unrestricted model, both parameters are maximized, giving \(\widehat{\alpha}\) from the equation above and \(\widehat{\theta}=\bar{x}/\widehat{\alpha}\).

Theorem: For nonidentical positive observations, the likelihood-ratio statistic is \(G=-2\log\lambda=2n\{q(\widehat{\alpha})-q(\alpha_0)\}\). The factor \(n\) is required because \(q\) is the profile log-likelihood per observation, apart from a common additive term.

To see why the formula holds, let \(\ell_p(\alpha)\) denote the full profile log-likelihood. Substitution of the maximizing scale gives \(\ell_p(\alpha)=nq(\alpha)+C\), where \(C\) is independent of \(\alpha\). The likelihood ratio is the null maximized likelihood divided by the unrestricted maximized likelihood, so

$$ -2\log\lambda =2\{\ell_p(\widehat{\alpha})-\ell_p(\alpha_0)\} =2\{nq(\widehat{\alpha})+C-nq(\alpha_0)-C\} =2n\{q(\widehat{\alpha})-q(\alpha_0)\}. $$

This also explains why the statistic is nonnegative: \(\widehat{\alpha}\) maximizes the unrestricted profile, so \(q(\widehat{\alpha})\ge q(\alpha_0)\). Under the null, with a true interior shape and the usual regularity conditions, \(G\) has an asymptotic chi-square distribution with one degree of freedom. This is an approximation for large samples, not an exact finite-sample distribution. The model has two parameters in the unrestricted fit and one free nuisance parameter under the null, leaving one restriction.

Worked Calculations

Worked Example: Test a Unit Shape Against an Unknown Scale

A hypothetical analyst observes two positive claim amounts, measured in thousands of dollars: \(x_1=1\) and \(x_2=4\). Assume independent gamma observations with unknown shape and scale. Test \(H_0:\alpha=1\) against a two-sided alternative using the likelihood-ratio statistic. No interest rate or mortality assumption applies to this statistical model.

Method and summaries. Here \(n=2\), \(S=1+4=5\), and \(\bar{x}=5/2=2.5\). Also \(L=\log1+\log4=\log4=1.386294\), so \(L/n=0.693147\). Therefore \(r=\log2.5-0.693147=\log1.25\approx0.22314355\).

Unrestricted fit. Solve \(\log\alpha-\psi(\alpha)=0.22314355\) numerically. The solution is \(\widehat{\alpha}\approx2.394\). Thus the unrestricted scale estimate is \(\widehat{\theta}=2.5/2.394\approx1.044\) thousand dollars. Under the null, \(\widehat{\theta}_0=2.5/1=2.5\) thousand dollars.

Statistic. Omitting the same additive constant from both profile values, \(q(1)=-1-0.22314355=-1.22314355\), and \(q(2.394)\approx-1.05128\). Hence the profile difference is approximately \(0.17186\), and \(G=2n\{q(\widehat{\alpha})-q(1)\}=4(0.17186)\approx0.687\), to three decimals.

Check and common mistake. The unrestricted profile value exceeds the null value, so \(G\) is positive as required. The common error is to use \(2\{q(\widehat{\alpha})-q(\alpha_0)\}\), forgetting that \(q\) is per observation. That would give about \(0.344\), half the correct statistic.

Worked Example: Compare a Different Specified Shape

Use the same hypothetical observations \(1\) and \(4\) thousand dollars, but now test \(H_0:\alpha=2\) against \(H_1:\alpha\ne2\), with \(\theta\) unknown. The independent gamma shape-scale model remains in force; interest and mortality assumptions are not applicable.

Method. The sample summaries and unrestricted estimate are unchanged: \(n=2\), \(r=0.22314355\), and \(\widehat{\alpha}\approx2.394\). Under the null, the scale estimate is \(\widehat{\theta}_0=2.5/2=1.25\) thousand dollars.

The null profile value is \(q(2)=2\log2-2-2(0.22314355)\). Using \(2\log2=1.38629436\), this gives \(q(2)=1.38629436-2-0.44628710\approx-1.059993\). With \(q(\widehat{\alpha})\approx-1.05128\), the difference is approximately \(0.00871\).

Therefore \(G=2(2)(-1.05128-(-1.059993))\approx0.0349\), to four decimals. The result is small because the specified shape \(2\) is close to the unrestricted estimate \(2.394\). The common error to avoid is omitting the factor \(n=2\); the statistic is \(4\) times the profile difference, not \(2\) times that difference.

Worked Example: Replication Changes the Statistic, Not the Shape Fit

Suppose a second hypothetical study records four independent gamma claim amounts, in thousands of dollars: \(1,1,4,4\). Test \(H_0:\alpha=2\) against a two-sided alternative with unknown scale. No interest or mortality assumption is relevant.

Method and summaries. The sample size is \(n=4\), the sum is \(S=10\), and \(\bar{x}=2.5\). The log sum is \(L=2\log4=2.772589\), so \(L/n=0.693147\). Thus \(r=\log2.5-0.693147=\log1.25\approx0.22314355\), the same value as in the preceding examples. It follows that \(\widehat{\alpha}\approx2.394\) and \(\widehat{\theta}=2.5/2.394\approx1.044\) thousand dollars.

For the null shape, \(q(2)\approx-1.059993\); the unrestricted value is \(q(\widehat{\alpha})\approx-1.05128\). The difference is about \(0.00871\), so \(G=2(4)(0.00871)\approx0.0697\), to four decimals.

Check and common mistake. The statistic is twice the value from the two-observation sample because the per-observation profile difference is unchanged while \(n\) doubles. The shape estimate stays the same, but the statistic does not. Treating the repeated observations as if \(n=2\) would understate \(G\) by a factor of two.

What the Summaries Tell You—and What They Do Not

The equation for \(\widehat{\alpha}\) depends on the data through \(r\), and the scale estimate then uses \(\bar{x}\). If every observation is multiplied by a positive constant \(c\), the arithmetic mean and geometric mean are both multiplied by \(c\), so their ratio and \(r\) are unchanged. The shape estimate and the likelihood-ratio statistic are therefore unchanged; the scale estimate is multiplied by \(c\). This is useful when observations are expressed in dollars rather than thousands of dollars.

The sample sum and log sum are the relevant summaries for calculating the profile likelihood. The sum alone cannot determine the shape estimate: samples with the same sum can have different values of \(L\), and hence different \(r\). In practice, retain sufficient numerical precision in both summaries and in solving the digamma equation. Rounding early can noticeably affect a small likelihood-ratio statistic.

If all observations are exactly equal, then \(r=0\). For every finite \(\alpha>0\), \(\log\alpha-\psi(\alpha)>0\), decreasing toward zero as \(\alpha\) grows. Consequently, the unrestricted profile has no finite maximizing shape in this case; one must not report a finite root of the estimating equation. This is a special data configuration in a continuous model, and the ordinary regular likelihood-ratio calibration does not apply to it.

Common Exam Traps

  • Confusing scale and rate. The density here uses \(e^{-x/\theta}\), so \(\theta\) is the scale and the conditional maximum-likelihood estimate is \(\bar{x}/\alpha\). A rate parameter would have a different formula.
  • Dropping the sample-size factor. Since \(q\) is per observation, the statistic is \(2n\) times its profile difference.
  • Using only the sample sum. The shape equation also uses the sum of log observations through \(r\).
  • Calling the calibration exact. The chi-square distribution with one degree of freedom is an asymptotic reference under the null, not an exact finite-sample law.
  • Ignoring the direction of maximization. The unrestricted profile is at least as high as the null profile, so a negative computed statistic signals an arithmetic or sign error.
Key takeaway: For an independent gamma sample with unknown scale, estimate the scale at each fixed shape by \(\bar{x}/\alpha\), solve \(\log\widehat{\alpha}-\psi(\widehat{\alpha})=r\), and calculate \(G=2n\{q(\widehat{\alpha})-q(\alpha_0)\}\). Use the chi-square-one reference only as an asymptotic calibration under regular conditions.

Check Your Understanding

For each problem, use the gamma shape-scale parameterization and retain enough precision until the final answer.

  1. A hypothetical sample consists of independent gamma observations \(2\) and \(8\), measured in thousands of dollars. Find \(r\), the unrestricted shape estimate, and the unrestricted scale estimate. No interest or mortality assumption applies. (Answer: \(r=\log1.25\approx0.2231\), \(\widehat{\alpha}\approx2.394\), \(\widehat{\theta}\approx2.089\) thousand dollars.)
  2. For the observations \(3\) and \(12\), test \(H_0:\alpha=1\) against a two-sided alternative with unknown scale. (Answer: \(G\approx0.687\); the scale change from \(1,4\) does not change the statistic.)
  3. For the independent observations \(1,1,4,4\), test \(H_0:\alpha=2\). Use the profile difference from the worked calculation, \(0.00871\), and identify the sample-size factor. (Answer: \(G=2(4)(0.00871)\approx0.0697\).)
  4. For observations \(2,2,8,8\), test \(H_0:\alpha=1\). These are twice the observations in the preceding four-observation sample. (Answer: \(G\approx1.3749\); doubling the values leaves \(r\) unchanged, and doubling the sample size relative to the two-observation case gives twice its statistic \(0.68745\).)
  5. Using the asymptotic chi-square-one reference at significance level \(0.05\), should the null be rejected for the statistic \(G=0.687\)? State the calibration caveat. (Answer: No; \(0.687<3.841\), the approximate 5% upper-tail critical value. This is an asymptotic, not exact, decision rule.)
Clinical Biostats