Tutorials › Generalized Linear Models › A Worked Aggregate-Cost Modeling Example

Power Variance Functions · Tutorial 630 of 981

A Worked Aggregate-Cost Modeling Example

Work through a Tweedie aggregate-cost fit and interpret both its predicted average costs and its probabilities of zero and positive costs.

Advanced 13 min read

What You'll Learn

  • Translate Tweedie mean, dispersion, and power into compound Poisson and gamma parameters.
  • Fit a saturated two-group log-link model when power and dispersion are fixed.
  • Interpret log-link coefficients as multiplicative changes in expected aggregate cost.
  • Calculate fitted probabilities of zero cost and conditional means among positive costs.
  • Distinguish a positive-cost conditional mean from the mean severity of one event.
  • Identify why a fitted mean alone does not determine an aggregate-cost prediction.

From a Fitted Mean to an Aggregate-Cost Distribution

An aggregate cost over a fixed period can be zero for some policyholders and positive, often highly variable, for others. A compound Poisson-gamma Tweedie model represents both features in one distribution: the number of cost-generating events is random, and each event has a positive gamma-distributed cost. Regression then allows the expected aggregate cost to vary with covariates.

The model has several quantities with distinct interpretations. Its regression mean is the expected total cost, not the average cost given that cost is positive and not the mean cost of one event. The compound representation connects these quantities and makes the predicted zero probability available directly.

Definition: For \(1<p<2\), a compound Poisson-gamma Tweedie variable \(Y\) with mean \(\mu>0\), dispersion \(\phi>0\), and power \(p\) can be represented as \(Y=\sum_{j=1}^{N}Z_j\), where \(N\sim\operatorname{Poisson}(\lambda)\), the \(Z_j\) are independent gamma random variables independent of \(N\), and $$ \lambda=\frac{\mu^{2-p}}{\phi(2-p)},\qquad Z_j\sim\operatorname{Gamma}\left(\frac{2-p}{p-1},\ \text{scale } \phi(p-1)\mu^{p-1}\right). $$ The sum is defined to be zero when \(N=0\). In this parameterization, \(E[Y]=\mu\) and \(\operatorname{Var}(Y)=\phi\mu^p\).

In a log-link regression, observation \(i\) has mean \(\mu_i=\exp(x_i^\mathsf{T}\beta)\), where \(x_i\) is its covariate vector and \(\beta\) is the coefficient vector. In this tutorial, the power \(p\) and dispersion \(\phi\) are treated as fixed when fitting the regression. This keeps the focus on fitting means and interpreting aggregate costs.

Worked Example: Translating a Fitted Mean into Cost Components

Worked Example: Translating a Fitted Mean into Cost Components

Suppose a fitted model gives mean aggregate cost \(\mu=6\) thousand dollars, with \(p=1.5\) and \(\phi=\sqrt{2}\). Find the event-count rate, the event-cost distribution, the probability of zero cost, and the expected cost conditional on positive cost.

The compound Poisson rate is $$ \lambda=\frac{6^{2-1.5}}{\sqrt{2}(2-1.5)} =\frac{\sqrt{6}}{\sqrt{2}/2} =2\sqrt{3}\approx3.4641. $$ The gamma shape is \((2-1.5)/(1.5-1)=1\), and its scale is $$ \phi(p-1)\mu^{p-1} =\sqrt{2}\left(\frac12\right)\sqrt{6} =\sqrt{3}. $$ Thus an individual event has an exponential cost distribution with mean \(\sqrt{3}\) thousand dollars. The expected total cost checks: \(E[N]E[Z_j]=(2\sqrt{3})(\sqrt{3})=6\) thousand dollars.

The total is zero exactly when there are no events, so $$ P(Y=0)=P(N=0)=\exp(-2\sqrt{3})\approx0.0313. $$ Consequently, \(P(Y>0)=1-\exp(-2\sqrt{3})\approx0.9686989\). Since \(E[Y]=6\) and \(Y=0\) whenever it is not positive, $$ E[Y\mid Y>0]=\frac{6}{1-\exp(-2\sqrt{3})}\approx6.194 $$ thousand dollars. This is the expected total cost among positive-cost cases; it is not the mean cost of one event, which is \(\sqrt{3}\) thousand dollars.

Fitting a Log-Linked Model to Grouped Aggregate Costs

A small example makes the regression fit explicit. Suppose the response is aggregate cost in thousands of dollars for a fixed period, and \(x\) indicates whether a policyholder belongs to group B. The observed costs are:

GroupObserved aggregate costs (thousands of dollars)Number observedSample mean
A (\(x=0\))0, 1, 3, 442
B (\(x=1\))0, 2, 5, 9, 1456

Consider \(\log(\mu_i)=\beta_0+\beta_1x_i\), with \(p=1.5\) and \(\phi=0.5\) fixed. The model gives one separate mean for each group. In this saturated two-group setting, the maximum-likelihood estimates are the two sample means. The score calculation below shows why; it is not a general claim that every log-link Tweedie fit equals a sample mean.

Result: For independent Tweedie observations with fixed \(p\) and \(\phi\), if a group shares one fitted mean \(\mu\), its log-likelihood score with respect to \(\eta=\log(\mu)\) is proportional to \(\sum_i(y_i-\mu)\), with positive proportionality factor \(\mu^{1-p}/\phi\). If the group mean is unrestricted and its sample mean is positive, the unique likelihood maximum is therefore at the sample mean.

To justify the score, write the Tweedie exponential-dispersion log density as \(\ell(y;\theta,\phi)=[y\theta-\kappa(\theta)]/\phi+c(y,\phi)\), where \(\mu=\kappa'(\theta)\) and \(d\mu/d\theta=V(\mu)=\mu^p\). Differentiation gives $$ \frac{\partial\ell}{\partial\mu} =\frac{y-\mu}{\phi V(\mu)} =\frac{y-\mu}{\phi\mu^p}. $$ Because \(d\mu/d\eta=\mu\), the derivative with respect to \(\eta\) is \((y-\mu)\mu^{1-p}/\phi\). Summing over a group gives the stated score. Its sign is the sign of \(\bar y-\mu\): it is positive below the sample mean and negative above it. Thus the likelihood increases up to \(\bar y\) and decreases thereafter, establishing the unique maximum when \(\bar y>0\). \(\square\)

Worked Example: Fitting the Two-Group Regression

For group A, the total observed cost is \(0+1+3+4=8\), so its sample mean is \(8/4=2\). For group B, the total is \(0+2+5+9+14=30\), so its sample mean is \(30/5=6\). By the score result, the fitted means are \(\hat\mu_A=2\) and \(\hat\mu_B=6\).

The coefficient estimates solve \(\exp(\hat\beta_0)=2\) and \(\exp(\hat\beta_0+\hat\beta_1)=6\). Therefore $$ \hat\beta_0=\log(2)\approx0.6931,\qquad \hat\beta_1=\log(6)-\log(2)=\log(3)\approx1.0986. $$ At fixed dispersion and power, group B’s fitted expected aggregate cost is three times group A’s. This is a comparison of expected total costs, not a claim that every group B policyholder incurs three times the cost of a group A policyholder.

The fitted compound Poisson rate for group A is \(4\sqrt{2}\approx5.6569\), giving \(P(Y=0\mid x=0)=\exp(-4\sqrt{2})\approx0.00349\). For group B the rate is \(4\sqrt{6}\approx9.7980\), giving \(P(Y=0\mid x=1)=\exp(-4\sqrt{6})\approx0.0000556\). The corresponding positive-cost probabilities are about \(0.99651\) and \(0.9999444\). Using the fitted means, the conditional expected costs given positive cost are \(2/[1-\exp(-4\sqrt{2})]\approx2.0070\) and \(6/[1-\exp(-4\sqrt{6})]\approx6.0003\) thousand dollars.

How Covariates Change Zero Probabilities

With the log link, a coefficient has a direct multiplicative interpretation for the mean. But the probability of zero cost depends on the fitted mean through the compound Poisson rate, and so it does not change by the same multiplicative factor. For fixed \(p\) and \(\phi\), the rate is proportional to \(\mu^{2-p}\). A higher fitted mean therefore increases the event rate when \(1<p<2\), reducing the probability of no events.

Theorem: Under the compound Poisson-gamma representation, \(P(Y=0)=\exp[-\mu^{2-p}/\{\phi(2-p)\}]\). If \(\mu>0\), then \(E[Y\mid Y>0]=\mu/\{1-P(Y=0)\}\).

For the first identity, every gamma event cost is positive, so the aggregate is zero if and only if \(N=0\). A Poisson random variable with rate \(\lambda\) has \(P(N=0)=e^{-\lambda}\). Substituting the representation’s value of \(\lambda\) proves the zero-probability formula. For the second identity, \(Y\mathbf{1}_{\{Y>0\}}=Y\), so \(E[Y\mid Y>0]P(Y>0)=E[Y]=\mu\). The zero probability is strictly less than one because \(\lambda>0\); division by \(P(Y>0)\) gives the stated conditional mean. \(\square\)

Worked Example: Interpreting a One-Unit Covariate Change

Suppose a fitted model has \(p=1.5\), \(\phi=0.5\), and \(\log(\mu)=\log(2)+0.4x\), where \(x\) is a covariate measured in one-unit increments. Compare predictions at \(x=0\) and \(x=1\).

The fitted means are \(\hat\mu(0)=2\) and \(\hat\mu(1)=2e^{0.4}\approx2.98365\) thousand dollars. The one-unit increase multiplies the mean by \(e^{0.4}\approx1.49182\), an increase of about 49.2%.

Here \(\lambda=4\sqrt{\mu}\). Thus the rates are \(4\sqrt{2}\approx5.65685\) and \(4\sqrt{2.98365}\approx6.90930\). The predicted zero probabilities are approximately \(0.00349\) and \(0.000998\), respectively. At \(x=1\), the positive-cost probability is about \(0.999002\), so the expected aggregate cost given positive cost is approximately \(2.98365/0.999002\approx2.98663\) thousand dollars. The coefficient’s multiplicative effect on \(\mu\) is not the multiplicative effect on the zero probability.

A Practical Interpretation Sequence

For a fitted aggregate-cost model, keep the mean, event count, and event cost distinct. A reliable interpretation proceeds from the regression mean to the compound representation, then to the probability and scale summaries relevant to the question.

1
Calculate the fitted mean.
Use the fitted linear predictor and inverse log link to obtain \(\hat\mu_i\) in the response’s cost units.
2
Translate the mean to an event rate.
At the specified \(p\) and \(\phi\), calculate \(\hat\lambda_i=\hat\mu_i^{2-p}/\{\phi(2-p)\}\).
3
Calculate zero and positive probabilities.
Use \(P(Y_i=0)=e^{-\hat\lambda_i}\) and \(P(Y_i>0)=1-e^{-\hat\lambda_i}\).
4
Report the relevant cost summary.
For positive cases, use \(\hat\mu_i/(1-e^{-\hat\lambda_i})\). For a single event, use the gamma severity mean instead.

These predictions are conditional on the fitted model and its chosen power and dispersion. In particular, the mean regression alone does not determine a zero probability: the formula also uses \(\phi\) and \(p\). Interpret fitted probabilities and costs in the data’s response units and over the same period as the modeled aggregate.

Common Mistakes

  • Calling the fitted mean a positive-case mean. The regression mean includes zeros. The conditional positive-cost mean is \(\mu/[1-P(Y=0)]\), which is generally larger.
  • Confusing event severity with aggregate cost given positive cost. The gamma mean describes one event. A positive aggregate can contain multiple events.
  • Reading a log-link coefficient as an additive cost change. A coefficient \(\beta\) gives a mean ratio of \(e^\beta\) for a one-unit covariate increase, holding other covariates fixed.
  • Applying that same ratio to the zero probability. The zero probability is an exponential function of the event rate, which depends on the mean, power, and dispersion.
  • Rounding intermediate probabilities too early. For example, \(\exp(-2\sqrt{3})\approx0.0313\), and \(6/[1-\exp(-2\sqrt{3})]\approx6.194\). Use the unrounded expression in subsequent calculations.
Key takeaway: A compound Poisson-gamma Tweedie fit links a covariate-dependent expected aggregate cost to an event rate and a positive event-cost distribution. Report which quantity is being interpreted: expected total cost, probability of zero cost, conditional positive aggregate cost, or mean cost per event.

Check Your Understanding

Use the model formulas and distinguish aggregate outcomes from individual event costs.

  1. For \(p=1.5\), \(\phi=1\), and \(\mu=4\), calculate the compound Poisson rate and probability of zero cost.
  2. A fitted log-link coefficient is \(\log(1.2)\). What is the corresponding mean ratio for a one-unit increase in its covariate?
  3. Explain why the expected cost given positive aggregate cost is not generally the same as the gamma mean cost of one event.
  4. For a group of observations sharing one fitted mean, why does the fixed-\(p\), fixed-\(\phi\) likelihood score imply that the saturated group estimate equals the sample mean?
  5. If a covariate increases the fitted mean while \(p\) and \(\phi\) remain fixed, describe the direction of change in the predicted zero probability and justify it using the event rate.
Clinical Biostats