Tutorials › Exam SRM - Statistics for Risk Modeling › Worked Gamma Model With Multiplicative Effects

Exam SRM · Poisson and Gamma Models · Tutorial 353 of 926

Worked Gamma Model With Multiplicative Effects

Learn to calculate and compare conditional Gamma means by exponentiating main effects, continuous-predictor contrasts, and interactions.

Advanced 9 min read

What You'll Learn

  • Specify a Gamma response model with a log link and identify its conditional mean and variance.
  • Interpret exponentiated coefficients as multiplicative changes in the mean.
  • Calculate conditional means for profiles with several predictor values.
  • Compare profiles using coefficient contrasts, including an interaction.
  • Convert a model mean and dispersion into Gamma shape and scale parameters.
  • Avoid common errors when combining effects or comparing cases.

Why Multiplicative Effects Matter

A Gamma regression model is useful when the response is a positive, continuous amount and its variability increases with its mean. Examples might include the cost of a completed repair or the amount paid for a covered service. For these outcomes, a change in a predictor is often naturally described as a percentage or proportional change in the expected amount.

With the log link, a change in a predictor adds to the logarithm of the conditional mean. Exponentiating that change gives a multiplier on the mean itself. This makes a model with several predictors particularly practical: each predictor contributes a factor, and the factors combine by multiplication. The calculations below focus on conditional means and comparisons; they do not imply that a modeled association is causal.

Definition: In a Gamma regression model with a log link, the response \(Y_i\), conditional on predictors \(x_i\), has a Gamma distribution with conditional mean \(\mu_i=E[Y_i\mid x_i]>0\) and variance \(\operatorname{Var}(Y_i\mid x_i)=\phi\mu_i^2\), where \(\phi>0\) is the dispersion parameter. The linear predictor satisfies \(\log(\mu_i)=\eta_i=x_i^\mathsf{T}\beta\), so \(\mu_i=\exp(x_i^\mathsf{T}\beta)\). Conditional responses are typically assumed independent.

One convenient parameterization of a Gamma distribution uses shape \(k\) and scale \(\theta\). Its mean is \(k\theta\), and its variance is \(k\theta^2\). Under the model above, the corresponding conditional parameters are \(k=1/\phi\) and \(\theta=\phi\mu_i\). Thus, a specified mean and dispersion determine both the full conditional distribution and its variance.

The Gamma model requires positive responses. It is not appropriate as stated for observations that can be zero or negative. The model also assumes that the variance is proportional to the square of the mean; a positive outcome by itself does not establish that this variance assumption is suitable.

From Coefficients to Multipliers

For a binary predictor \(A\), suppose the model contains the term \(\beta_A A\), with \(A=0\) for the reference case and \(A=1\) otherwise. Holding all other predictors fixed, changing \(A\) from zero to one changes the linear predictor by \(\beta_A\). The conditional mean is therefore multiplied by \(\exp(\beta_A)\). A multiplier of 1.25 means the mean is 25% higher; a multiplier of 0.80 means it is 20% lower.

For a continuous predictor \(x\), increasing it by \(\Delta\) changes the mean by the factor \(\exp(\beta_x\Delta)\), not necessarily by \(\exp(\beta_x)\). The latter is the factor for a one-unit increase. When interpreting a coefficient, the unit in which the predictor was recorded is essential.

$$ \frac{\mu(x+\Delta)}{\mu(x)}=\exp(\beta_x\Delta) $$

The formula follows directly by taking the ratio of the two conditional means. If the other predictors are held fixed, their terms appear in both means and cancel. The difference between the two log means is \(\beta_x\Delta\); exponentiating that difference gives the ratio above. This also explains why coefficient contrasts, rather than the individual coefficients alone, are needed when comparing two profiles.

Result: For profiles \(x_a\) and \(x_b\), the ratio of conditional means is \(\mu(x_b)/\mu(x_a)=\exp\{(x_b-x_a)^\mathsf{T}\beta\}\). Compute the difference in each predictor, include every relevant model term, and exponentiate the resulting difference in linear predictors.

Worked Examples

Each example states the model parameters before using them. Coefficients written as logarithms of simple factors make the multiplicative interpretation exact and keep the arithmetic transparent.

Worked Example: Combining Two Binary Effects

A hypothetical repair-payment model has response \(Y\), measured in dollars, and predictors \(A\) and \(B\). Predictor \(A\) indicates a particular repair channel, and \(B\) indicates a specified surface type. Suppose \(\log(\mu)=\log(240)+\log(1.25)A+\log(0.80)B\), with \(A,B\in\{0,1\}\). Assume \(Y\), conditional on \(A,B\), is Gamma with dispersion \(\phi=0.25\). Calculate the means for all four profiles, compare the two single-effect profiles, and give the Gamma parameters for the profile with both indicators equal to one.

Method and baseline. The intercept gives the mean for \(A=B=0\): \(\mu(0,0)=\exp\{\log(240)\}=240\) dollars. The multiplier for \(A=1\) is 1.25, and the multiplier for \(B=1\) is 0.80.

Calculate each profile. For \(A=1,B=0\), \(\mu=240(1.25)=300\) dollars. For \(A=0,B=1\), \(\mu=240(0.80)=192\) dollars. For \(A=1,B=1\), both factors apply, so \(\mu=240(1.25)(0.80)=240\) dollars.

Compare the single-effect profiles. The ratio of the \(A\)-only mean to the \(B\)-only mean is \(300/192=1.5625\). Equivalently, the contrast is \(1.25/0.80=1.5625\). The \(A\)-only conditional mean is 56.25% greater than the \(B\)-only conditional mean.

Find the distribution parameters. At \(A=B=1\), the mean is 240 and \(\phi=0.25\). Thus the shape is \(k=1/0.25=4\), and the scale is \(\theta=0.25(240)=60\). The variance is \(k\theta^2=4(60^2)=14{,}400\) dollars squared, also \(0.25(240^2)=14{,}400\). The two variance calculations agree.

Common mistake avoided. Adding 1.25 and 0.80 as though they were changes in dollars is incorrect. They are multipliers, so their effects combine with multiplication; here their product is exactly 1.

Worked Example: An Interaction Changes the Joint Effect

A hypothetical positive service-cost response \(Y\), measured in dollars, is modeled using binary indicators \(C\) and \(D\) and their interaction: \(\log(\mu)=\log(400)+\log(1.20)C+\log(1.50)D+\log(0.90)CD\). Assume a Gamma conditional distribution with \(\phi=0.20\). Calculate all four conditional means and compare the joint multiplier with the multiplier that would result if there were no interaction.

Method. The intercept gives the baseline mean, 400 dollars. For \(C=1,D=0\), the interaction \(CD=0\), so the mean is \(400(1.20)=480\) dollars. For \(C=0,D=1\), the mean is \(400(1.50)=600\) dollars.

Calculate the joint profile. When \(C=D=1\), the interaction indicator is also one. All three factors apply: \(\mu(1,1)=400(1.20)(1.50)(0.90)=648\) dollars. The four means are therefore 400, 480, 600, and 648 dollars for profiles \((0,0),(1,0),(0,1),(1,1)\), respectively.

Interpret the interaction. The joint multiplier relative to baseline is \(1.20(1.50)(0.90)=1.62\). Without an interaction term, the joint multiplier would be \(1.20(1.50)=1.80\), producing a mean of \(400(1.80)=720\) dollars. The interaction factor of 0.90 reduces that no-interaction joint mean by 10%, from 720 to 648 dollars.

Check the Gamma parameters. For the joint profile, \(k=1/0.20=5\) and \(\theta=0.20(648)=129.6\) dollars. The variance is \(5(129.6^2)=83{,}980.8\) dollars squared. The mean from these parameters is \(5(129.6)=648\) dollars, as required.

Common mistake avoided. Omitting the interaction would incorrectly give a joint mean of 720 dollars. An interaction is a separate model term and must be included when both of its indicators are active.

Worked Example: A Continuous Predictor and a Group Effect

A hypothetical model for positive service payments uses age and a group indicator \(R\). Let \(z=(\text{age}-50)/10\), so one unit of \(z\) represents ten years. Suppose \(\log(\mu)=\log(500)+\log(1.10)z+\log(1.20)R\). Assume a Gamma conditional distribution with \(\phi=0.25\). Compare a person aged 40 in group \(R=0\) with a person aged 60 in group \(R=1\). Report the conditional means to the nearest cent and the ratio of the second mean to the first.

Method. At age 40, \(z=(40-50)/10=-1\); at age 60, \(z=(60-50)/10=1\). The first profile has \(R=0\), giving \(\mu_1=500(1.10)^{-1}=500/1.10=454.54545\ldots\) dollars, or 454.55 dollars to the nearest cent.

Calculate the second mean. For age 60 and \(R=1\), both \(z=1\) and \(R=1\), so \(\mu_2=500(1.10)(1.20)=660\) dollars. The ratio is \(660/(500/1.10)=660(1.10)/500=1.452\). Thus the second conditional mean is 1.452 times the first, or 45.2% higher.

Check the units and distribution. The age difference is 20 years, which is two units of \(z\), so the age multiplier in the comparison is \(1.10^2=1.21\), not 1.10. Including the group multiplier gives \(1.21(1.20)=1.452\), matching the calculated ratio. For the second profile, shape \(k=1/0.25=4\) and scale \(\theta=0.25(660)=165\) dollars; its variance is \(4(165^2)=108{,}900\) dollars squared.

Common mistake avoided. Applying the 1.10 age multiplier only once ignores that the profiles differ by two ten-year units. The model uses \(z\), not age in single-year units.

How to Compare Profiles Reliably

A consistent calculation separates the linear predictor from its interpretation. First substitute the predictor values into every model term. Next calculate the resulting conditional mean by exponentiating the linear predictor, or calculate a comparison by subtracting the two linear predictors and exponentiating. Finally, check that the direction and size of the result agree with the signs and magnitudes of the included effects.

1
Identify the reference profile.
Record the predictor values that define the baseline, including the units of continuous predictors.
2
Substitute into every term.
Include indicator terms and any interaction terms that are nonzero for the profile.
3
Exponentiate or take a contrast.
Exponentiate the linear predictor for a mean, or exponentiate its difference between profiles for a ratio.
4
Check the interpretation.
Confirm that a factor above one increases the mean, a factor below one decreases it, and a continuous-predictor change uses the correct number of units.

The ratio approach is especially useful when an intercept or other shared model terms are complicated: shared terms cancel in a contrast. It is also a useful arithmetic check. If the same two means are calculated separately, their ratio must agree with the exponentiated difference in their linear predictors.

Common Traps and Practical Checks

  • Calling a coefficient a percentage. The coefficient \(\beta\) is on the log-mean scale. The exact multiplier is \(\exp(\beta)\), and the exact percentage change is \(100\{\exp(\beta)-1\}\%\), not \(100\beta\%\) except as a small-coefficient approximation.
  • Using the wrong predictor unit. If a predictor is measured in decades, a two-decade contrast uses \(\exp(2\beta)\). If it is standardized or rescaled, interpret the coefficient in that model's units.
  • Leaving out an interaction. When the component predictors are both active, an interaction term generally contributes as well. Check its value for each profile rather than assuming the main effects alone determine the joint change.
  • Confusing a mean with an individual outcome. The exponentiated linear predictor is the conditional mean, not a guaranteed payment or a full prediction interval. The Gamma dispersion describes conditional variability around that mean.
  • Using the variance formula with the wrong mean. Once the profile-specific mean is found, use \(\phi\mu^2\) for that profile. The variance changes with the mean even when \(\phi\) is constant.
Key takeaway: In a Gamma regression with a log link, predictor effects act multiplicatively on the conditional mean. Calculate profile means by exponentiating the full linear predictor; calculate comparisons by exponentiating the difference in linear predictors. Include correct units, active interactions, and the profile-specific mean when computing the Gamma variance.

Check Your Understanding

For each problem, use the stated log-link Gamma model and retain the stated predictor units. Answers are given after each question for checking.

  1. A hypothetical model has \(\log(\mu)=\log(300)+\log(1.40)A\), where \(A\) is a binary indicator. At \(A=1\), the conditional distribution is Gamma with \(\phi=0.10\). Find the mean, shape, scale, and variance. (Answer: mean \(420\); shape \(10\); scale \(42\); variance \(17{,}640\).)
  2. A model gives multiplier 1.15 for one group and multiplier 0.92 for another, relative to the same baseline. What is the ratio of the first group's conditional mean to the second group's? (Answer: \(1.15/0.92=1.25\).)
  3. Suppose \(\log(\mu)=\log(800)+\log(1.30)C+\log(0.90)D+\log(1.10)CD\). Find the conditional mean when \(C=D=1\), and the ratio to the baseline mean. (Answer: mean \(1{,}029.60\); ratio \(1.287\).)
  4. A continuous predictor has coefficient \(\log(1.04)\) per one unit. If the predictor increases by five units from a profile with mean 250 dollars, find the new conditional mean to the nearest cent. (Answer: \(250(1.04)^5=304.16\) dollars.)
  5. A Gamma log-link model has mean 360 dollars for a specified profile and dispersion \(\phi=1/3\). Give its shape, scale, and variance. (Answer: shape \(3\); scale \(120\) dollars; variance \(43{,}200\) dollars squared.)
Clinical Biostats