Tutorials › Generalized Linear Models › Log-Link Tweedie Regression

Power Variance Functions · Tutorial 626 of 981

Log-Link Tweedie Regression

Learn how log-link Tweedie coefficients translate into mean ratios, and how the power index shapes variance growth and regression working weights.

Advanced 9 min read

What You'll Learn

  • Write a Tweedie regression model with a log link and an optional exposure offset
  • Interpret regression coefficients as multiplicative changes in the conditional mean
  • Calculate response variances and coefficients of variation from the power variance function
  • Derive log-link working weights by locally linearizing the mean
  • Explain how the power index changes variance and relative observation weights
  • Distinguish a log link for the mean from taking logarithms of observed responses

Why Use a Log Link for a Tweedie Mean?

A Tweedie regression combines a power variance function with a model for how the mean changes with covariates. With a log link, the model describes covariate effects as multiplicative changes in the conditional mean. This is useful when the mean must be positive and effects are naturally expressed as relative rather than absolute changes.

The log link does not require every observed response to be positive. It applies to the conditional mean, which is positive in the model; an individual response can still be zero when the Tweedie distribution allows zero outcomes. The power index \(p\), meanwhile, determines how quickly the response variance grows as the mean increases.

Definition: For independent responses \(Y_1,\ldots,Y_n\), a log-link Tweedie regression specifies $$ E[Y_i]=\mu_i,\qquad \operatorname{Var}(Y_i)=\phi\mu_i^p,\qquad \log(\mu_i)=\eta_i=\mathbf{x}_i^\mathsf{T}\boldsymbol{\beta}+o_i. $$ Here \(\phi>0\) is the dispersion parameter, \(p\) is the power index, \(\mathbf{x}_i\) is the covariate vector, \(\boldsymbol{\beta}\) is the regression coefficient vector, and \(o_i\) is a known offset (zero if none is needed). The power \(p\) is treated as fixed when specifying this regression. The Tweedie distribution must be chosen from its admissible parameter range and with response support appropriate to the application.

The exponential link transformation guarantees \(\mu_i=\exp(\eta_i)>0\). In the common compound Poisson–Gamma case, \(1<p<2\), the response is nonnegative and can have an atom at zero as well as positive continuous values. This makes the family suitable for some semicontinuous outcomes, such as total costs with some zero observations. The regression formula itself is not a model for the probability of zero; it specifies the conditional mean and variance.

Interpreting Coefficients on the Mean Scale

For a one-unit increase in a covariate, the linear predictor changes additively. Exponentiating that change gives the corresponding multiplicative change in the mean. This interpretation concerns conditional means, holding the other covariates and any offset fixed.

Result: If \(x_{ij}\) enters the linear predictor with coefficient \(\beta_j\) and no interaction involving \(x_{ij}\), increasing \(x_{ij}\) by \(\Delta\) while holding other terms fixed multiplies \(\mu_i\) by \(\exp(\beta_j\Delta)\). For a one-unit increase, the exact percentage change is \(100\{\exp(\beta_j)-1\}\%\).

To verify this, write the linear predictor before the change as \(\eta_i\). After increasing \(x_{ij}\) by \(\Delta\), it is \(\eta_i+\beta_j\Delta\). Therefore,

$$ \frac{\mu_i^{\mathrm{new}}}{\mu_i^{\mathrm{old}}} =\frac{\exp(\eta_i+\beta_j\Delta)}{\exp(\eta_i)} =\exp(\beta_j\Delta). $$

Subtracting 1 from this ratio and multiplying by 100 gives the exact percentage change. For small \(\beta_j\), \(100\beta_j\%\) is an approximation, not the exact percentage change.

Worked Example: Converting a Coefficient to a Mean Ratio

Suppose a model for expected daily cost has \(\log(\mu_i)=\beta_0+\beta_1x_i\), with \(\hat{\beta}_0=\log(10)\) and \(\hat{\beta}_1=\log(1.5)\). Compare the fitted means at \(x=0\) and \(x=1\).

At \(x=0\), the fitted mean is \(\exp\{\log(10)\}=10\). At \(x=1\), it is \(\exp\{\log(10)+\log(1.5)\}=10(1.5)=15\).

The mean ratio is \(15/10=1.5\). Thus the one-unit increase in \(x\) multiplies the expected cost by 1.5, an exact increase of \(100(1.5-1)=50\%\). This statement is about the fitted conditional mean, not a guarantee that every observed cost increases by 50%.

If the linear predictor includes interactions, a coefficient by itself need not be the same mean ratio at every value of the interacting covariate. The relevant change must then be calculated from the full difference in linear predictors before exponentiation.

Offsets and Exposure

An offset is a known term whose coefficient is fixed at one. For example, if \(t_i>0\) is exposure time and the mean is proportional to exposure, use \(o_i=\log(t_i)\). Then \(\mu_i=t_i\exp(\mathbf{x}_i^\mathsf{T}\boldsymbol{\beta})\), so the regression coefficients describe multiplicative changes in the mean per unit of exposure. The offset is not an additional coefficient to estimate.

Worked Example: Interpreting a Model With an Exposure Offset

Suppose \(\log(\mu_i)=\log(t_i)+\beta_0+\beta_1x_i\), where \(t_i\) is observed exposure, \(\hat{\beta}_0=\log(3)\), and \(\hat{\beta}_1=\log(1.4)\). Calculate fitted means for \(x=0\) and \(x=1\) at exposures \(t=2\) and \(t=5\).

At \(x=0\), the fitted mean is \(t\exp\{\log(3)\}=3t\). It is \(3(2)=6\) when \(t=2\), and \(3(5)=15\) when \(t=5\).

At \(x=1\), the fitted mean is \(t\exp\{\log(3)+\log(1.4)\}=4.2t\). It is \(4.2(2)=8.4\) when \(t=2\), and \(4.2(5)=21\) when \(t=5\).

At either exposure, changing \(x\) from 0 to 1 multiplies the mean by \(4.2/3=1.4\), a 40% increase. The offset makes the mean proportional to exposure: increasing \(t\) from 2 to 5 multiplies each fitted mean by \(5/2=2.5\).

How the Power Controls Variance

The Tweedie variance function gives \(\operatorname{Var}(Y_i)=\phi\mu_i^p\). Since the log link gives \(\mu_i=\exp(\eta_i)\), the same variance can be written directly in terms of the linear predictor. This makes the joint roles of the link and power explicit.

Result: Under the log-link Tweedie model, $$ \operatorname{Var}(Y_i)=\phi\exp(p\eta_i),\qquad \operatorname{SD}(Y_i)=\sqrt{\phi}\exp(p\eta_i/2). $$ For positive \(\mu_i\), the coefficient of variation is $$ \frac{\operatorname{SD}(Y_i)}{\mu_i} =\sqrt{\phi}\,\mu_i^{(p-2)/2}. $$

These formulas follow by substituting \(\mu_i=\exp(\eta_i)\) into the variance function and taking its positive square root. Dividing that square root by \(\mu_i\) gives the coefficient of variation. In particular, multiplying the mean by a factor \(c>0\) multiplies the variance by \(c^p\), when \(\phi\) and \(p\) stay fixed.

Worked Example: Comparing Variance at Two Mean Levels

Take \(p=1.5\), \(\phi=0.4\), and compare observations whose means are \(\mu=4\) and \(\mu=16\). Calculate the variance, standard deviation, and coefficient of variation for each.

For \(\mu=4\), \(4^{1.5}=4\sqrt{4}=8\), so the variance is \(0.4(8)=3.2\). The standard deviation is \(\sqrt{3.2}\approx1.789\), and the coefficient of variation is \(1.789/4\approx0.447\).

For \(\mu=16\), \(16^{1.5}=16(4)=64\), so the variance is \(0.4(64)=25.6\). The standard deviation is \(\sqrt{25.6}\approx5.060\), and the coefficient of variation is \(5.060/16\approx0.316\).

The mean increased by a factor of 4, and the variance increased by \(25.6/3.2=8=4^{1.5}\), as the power function requires. The coefficient of variation decreased because \(p<2\), even though the standard deviation increased.

Deriving the Working Weights

The GLM working weights describe how the variance function and link combine in a local weighted least-squares step. They are not extra model parameters. To derive them, approximate the mean near the current linear predictor and express the resulting local fit in terms of the linear predictor.

Result: For a Tweedie model with variance \(\phi\mu_i^p\) and log link, the working weight for observation \(i\), without additional prior weights, is $$ W_i=\frac{1}{\phi}\mu_i^{2-p} =\frac{1}{\phi}\exp\{(2-p)\eta_i\}. $$

Here is the derivation. At a current value \(\eta_i\), the log link has derivative \(d\mu_i/d\eta_i=\mu_i\). A first-order Taylor approximation gives \(\mu_i^{\mathrm{new}}\approx\mu_i+\mu_i(\eta_i^{\mathrm{new}}-\eta_i)\). To match the observed response \(Y_i\), the corresponding working response on the linear-predictor scale is

$$ z_i=\eta_i+\frac{Y_i-\mu_i}{\mu_i}. $$

The response-scale variance is \(\phi\mu_i^p\). Dividing by the squared derivative \((d\mu_i/d\eta_i)^2=\mu_i^2\) gives the local variance on the linear-predictor scale:

$$ \operatorname{Var}(z_i\mid\mathbf{x}_i) \approx\frac{\phi\mu_i^p}{\mu_i^2} =\phi\mu_i^{p-2}. $$

A weighted least-squares fit uses the reciprocal of this variance as its weight, yielding \(W_i=\mu_i^{2-p}/\phi\). This calculation is a local approximation: it describes the weights at the current fitted means, which are updated during fitting. With a prior weight \(a_i\), the corresponding working weight is \(a_iW_i\).

Worked Example: Calculating Working Weights

Let \(p=1.5\) and \(\phi=0.4\). Compare the working weights at fitted means \(\mu=4\) and \(\mu=16\).

Since \(2-p=0.5\), the weight is \(W_i=\sqrt{\mu_i}/0.4\). At \(\mu=4\), this is \(2/0.4=5\). At \(\mu=16\), it is \(4/0.4=10\).

The mean increased fourfold, but the working weight doubled. In general, multiplying the mean by \(c\) multiplies the working weight by \(c^{2-p}\). For \(p=1.5\), that factor is \(c^{0.5}\), so \(c=4\) produces a factor of 2. These are local fitting weights, not probabilities that the observations are correct.

Reading Variance and Weights Together

The power index affects variance and working weights in opposite directions: a larger mean raises the variance by a factor \(c^p\), but changes the working weight by a factor \(c^{2-p}\). The inverse relationship between local variance and weight is built into the derivation. Some useful cases are:

Power \(p\)Variance as a function of \(\mu\)Working weight as a function of \(\mu\)
1\(\phi\mu\)\(\mu/\phi\)
1.5\(\phi\mu^{1.5}\)\(\mu^{0.5}/\phi\)
2\(\phi\mu^2\)\(1/\phi\)

For \(1<p<2\), variance grows faster than linearly with the mean, while the working weight still increases with the mean, but less than proportionally. At \(p=2\), the weight does not depend on the mean. These patterns are consequences of the specified variance function and link; they do not by themselves tell us whether a chosen model fits the data well.

Common Mistakes and Practical Checks

  • Reading a coefficient as an additive change in the mean. The coefficient is additive on the log-mean scale. Exponentiating the coefficient gives a one-unit mean ratio; subtract 1 to obtain the exact proportional change.
  • Taking the logarithm of the observed responses. A log link specifies \(\log E[Y_i\mid\mathbf{x}_i]\), not \(E[\log Y_i\mid\mathbf{x}_i]\). These are different quantities, and the former does not require every \(Y_i\) to be positive.
  • Ignoring the offset. With \(o_i=\log(t_i)\), the model mean includes the exposure factor \(t_i\). Omitting it changes the specified mean structure.
  • Assuming larger means must have smaller weights. For a log link, \(W_i=\mu_i^{2-p}/\phi\). In the common range \(1<p<2\), weights increase with the mean, although variance increases faster.
  • Treating the power as irrelevant once a link is chosen. The link controls how the mean depends on covariates; the power controls variance growth and therefore also changes the local fitting weights.

When specifying a model, check that the mean is positive, the offset has the intended interpretation, the power is admissible for the response support, and coefficient statements are made on the mean-ratio scale. Then examine the implied variance and working weights across the range of fitted means rather than assuming they are constant.

Check Your Understanding

Use the model definitions and derivations above to answer these questions.

  1. In a log-link model, what mean ratio corresponds to a one-unit increase in a covariate with coefficient \(\beta=0.3\), and what is the exact percentage change?
  2. With \(p=1.2\), by what factor does the variance change when the mean is multiplied by 3, holding dispersion fixed?
  3. Derive the working-weight exponent \(2-p\) from the variance function and the derivative of the log link.
  4. If \(p=2\), does the working weight depend on the fitted mean? What is its value in terms of \(\phi\)?
  5. Explain why a log link can be used when some observed responses are zero.
Clinical Biostats