Tutorials › Generalized Linear Models › Tweedie Unit Deviance

Power Variance Functions · Tutorial 620 of 981

Tweedie Unit Deviance

Derive the unit deviance for a Tweedie power variance function, interpret its likelihood role, and check how it approaches the Poisson and Gamma forms.

Advanced 11 min read

What You'll Learn

  • Derive the unit deviance for powers other than one and two.
  • Interpret the unit deviance through a saturated-versus-fitted log-likelihood difference.
  • Distinguish total deviance from scaled deviance.
  • Evaluate the deviance at a zero observation when the support permits it.
  • Obtain the Poisson and Gamma deviance expressions as limiting cases.

Why the Unit Deviance Is Useful

The Tweedie power variance function describes how conditional variance changes with the mean. The unit deviance translates that variance structure into a measure of discrepancy between an observed response and a proposed mean. It is especially useful because it gives a likelihood contrast without requiring the normalizing or carrier term of the density to be written out.

Here the response is \(Y\), its mean is \(\mu>0\), and the power variance function is \(V(\mu)=\mu^p\). The dispersion parameter is \(\phi>0\), so the variance is \(\phi\mu^p\). The formulas below first treat positive observations; boundary cases such as \(Y=0\) are handled separately when the response support allows them.

Definition: For a Tweedie exponential-dispersion model, the unit deviance \(d(y,\mu)\) is twice the difference between the saturated log-likelihood contribution and the log-likelihood contribution at mean \(\mu\), after removing the common dispersion factor. Thus the one-observation log-likelihood difference is \(d(y,\mu)/(2\phi)\). The total deviance for observations \(y_1,\ldots,y_n\) and fitted means \(\mu_1,\ldots,\mu_n\) is \(D=\sum_{i=1}^n d(y_i,\mu_i)\); the log-likelihood difference is \(D/(2\phi)\), and the scaled deviance is \(D/\phi\).

Deriving the Formula for \(p\ne 1,2\)

An exponential-dispersion model has log-likelihood contribution \(\ell(y;\theta,\phi)=[y\theta-b(\theta)]/\phi+\log a(y,\phi)\), where \(\theta\) is the natural parameter, \(b\) is the cumulant function, and \(a\) is the carrier term. Its mean is \(b'(\theta)\), and its variance is \(\phi b''(\theta)\). For the power variance function, \(b''(\theta)=\mu^p\), with \(\mu=b'(\theta)\).

For \(p\ne1\), integrating \(d\theta/d\mu=1/V(\mu)=\mu^{-p}\) gives \(\theta(\mu)=\mu^{1-p}/(1-p)\), up to an additive constant. For \(p\ne2\), integrating \(db/d\mu=\mu/V(\mu)=\mu^{1-p}\) gives \(b(\theta(\mu))=\mu^{2-p}/(2-p)\), up to an additive constant. These constants do not affect the likelihood contrast.

Result: For \(y>0\), \(\mu>0\), and \(p\ne1,2\), the Tweedie unit deviance is $$ d(y,\mu)=2\left\{\frac{y^{2-p}}{(1-p)(2-p)} -\frac{y\mu^{1-p}}{1-p} +\frac{\mu^{2-p}}{2-p}\right\}. $$

To obtain the expression, set the saturated mean to \(y\), so its natural parameter is \(\theta(y)\). Subtract the fitted log-likelihood from the saturated one. The carrier term cancels because the observation and dispersion are the same in both contributions. The remaining contrast is

$$ \ell(y;\theta(y),\phi)-\ell(y;\theta(\mu),\phi) =\frac{y\{\theta(y)-\theta(\mu)\}-b(\theta(y))+b(\theta(\mu))}{\phi} =\frac{d(y,\mu)}{2\phi}. $$

Substituting the expressions for \(\theta\) and \(b\) gives the stated formula. The unit deviance itself has no factor of \(1/\phi\); that factor appears in the log-likelihood difference.

An Integral Form and Its Consequences

A convenient form of the same result is

$$ d(y,\mu)=2\int_{\mu}^{y}\frac{y-t}{t^p}\,dt. $$

For \(p\ne1,2\), integrating \(yt^{-p}-t^{1-p}\) between \(\mu\) and \(y\) gives the closed form above. The integral also makes the sign transparent: if \(y>\mu\), both the integrand and the direction of integration are positive; if \(y<\mu\), the integrand is nonpositive over the interval from \(y\) to \(\mu\), and reversing the integration limits makes the integral nonnegative. Equality holds exactly when \(y=\mu\).

Result: For positive \(y,\mu\), \(d(y,\mu)\ge0\), with equality if and only if \(y=\mu\). This follows directly from the integral representation, for every real \(p\) for which the model and the integral are defined on the interval between \(y\) and \(\mu\).

For completeness, the derivation of the integral representation from the likelihood contrast can be expressed without relying on the closed form. Since \(d\theta/dt=1/V(t)=t^{-p}\) and \(db/dt=t\,d\theta/dt=t^{1-p}\),

$$ \begin{aligned} \frac{d(y,\mu)}{2} &=y\{\theta(y)-\theta(\mu)\}-\{b(\theta(y))-b(\theta(\mu))\}\\ &=\int_{\mu}^{y}\{y-t\}\frac{d\theta}{dt}\,dt\\ &=\int_{\mu}^{y}(y-t)t^{-p}\,dt. \end{aligned} $$

The integral is finite for positive \(y,\mu\), including when \(p=1\) or \(p=2\), because its interval stays away from zero.

Worked Example: A Power of \(p=1.5\)

Let \(p=1.5\), observed response \(y=4\), and proposed mean \(\mu=2\). The formula gives

$$ \begin{aligned} d(4,2) &=2\left\{\frac{4^{0.5}}{(-0.5)(0.5)} -\frac{4(2^{-0.5})}{-0.5} +\frac{2^{0.5}}{0.5}\right\}\\ &=2\left\{-8+\frac{8}{\sqrt{2}}+2\sqrt{2}\right\}\\ &=2\left\{-8+4\sqrt{2}+2\sqrt{2}\right\}\\ &=12\sqrt{2}-16\\ &\approx 0.9706. \end{aligned} $$

The result is positive, as expected because \(y\ne\mu\). If \(\phi=0.5\), the saturated-minus-fitted log-likelihood difference is \(d(4,2)/(2\phi)=0.9706\), not the unit deviance multiplied by \(1/\phi\).

The Poisson and Gamma Limits

The closed form has apparent singularities at \(p=1\) and \(p=2\). These are removable for positive \(y\) and \(\mu\). The integral form gives a direct justification: on the finite interval between two positive endpoints, \(t^{-p}\) is bounded uniformly for \(p\) in a sufficiently small neighborhood of either value. The integrand therefore converges uniformly as \(p\) approaches 1 or 2, so the limit can be taken inside the integral.

Result: For \(y>0\) and \(\mu>0\), the limiting unit deviances are $$ d(y,\mu)\big|_{p=1} =2\left\{y\log\left(\frac{y}{\mu}\right)-(y-\mu)\right\}, \qquad d(y,\mu)\big|_{p=2} =2\left\{\frac{y}{\mu}-1-\log\left(\frac{y}{\mu}\right)\right\}. $$ The first is the Poisson unit deviance, and the second is the Gamma unit deviance.

At \(p=1\), integrating the limit of the integral representation yields

$$ 2\int_{\mu}^{y}\left(\frac{y}{t}-1\right)\,dt =2\left\{y\log\left(\frac{y}{\mu}\right)-(y-\mu)\right\}. $$

At \(p=2\), the corresponding calculation is

$$ 2\int_{\mu}^{y}\left(\frac{y}{t^2}-\frac{1}{t}\right)\,dt =2\left\{\frac{y}{\mu}-1-\log\left(\frac{y}{\mu}\right)\right\}. $$

These integral evaluations prove the limits and identify the familiar special cases. At a zero observation, the Poisson formula extends by the convention \(0\log(0/\mu)=0\), giving \(d(0,\mu)=2\mu\). For the compound Poisson-Gamma Tweedie range \(1<p<2\), the same limit from positive \(y\) gives \(d(0,\mu)=2\mu^{2-p}/(2-p)\). A Gamma response has positive support, so its unit deviance is used for \(y>0\), not for a zero response.

Worked Example: The Poisson Limit

Take \(p=1\), \(y=3\), and \(\mu=2\). Then

$$ \begin{aligned} d(3,2) &=2\left\{3\log\left(\frac{3}{2}\right)-(3-2)\right\}\\ &=2\{3(0.405465)-1\}\\ &\approx 2(0.216395)\\ &\approx 0.43279. \end{aligned} $$

For a zero response with the same mean, the convention gives \(d(0,2)=2(2)=4\). The zero case is a boundary value of the Poisson formula, rather than a direct substitution into an expression containing \(0\log 0\).

Worked Example: The Gamma Limit

Take \(p=2\), \(y=4\), and \(\mu=2\). The Gamma unit deviance is

$$ \begin{aligned} d(4,2) &=2\left\{\frac{4}{2}-1-\log\left(\frac{4}{2}\right)\right\}\\ &=2\{2-1-\log 2\}\\ &=2(1-0.693147)\\ &\approx 0.61371. \end{aligned} $$

Again the deviance is nonnegative. The Gamma expression uses a positive observation; substituting \(y=0\) would not describe an outcome in the Gamma response support.

How Deviance Enters Likelihood Calculations

For independent observations from a common Tweedie model with fixed \(p\) and \(\phi\), add the individual unit deviances:

$$ D=\sum_{i=1}^{n}d(y_i,\mu_i). $$

When the saturated model is admissible, the likelihood identity is

$$ \ell_{\mathrm{sat}}-\ell_{\mathrm{fit}}=\frac{D}{2\phi}. $$

Thus the total deviance is \(D\), while the scaled deviance is \(D/\phi\). They are not interchangeable: the factor \(1/\phi\) belongs in the scaled deviance and in twice the log-likelihood difference, not in the definition of \(D\).

This role has an important limit. For fixed \(p\), \(\phi\), and observed data, the carrier terms cancel in a fitted-versus-saturated contrast, so deviance summarizes that contrast. But the deviance alone is not the entire exact likelihood. The carrier term can depend on \(y\), \(\phi\), and \(p\); it matters, for example, when exact likelihoods are compared across dispersion or power values. A likelihood calculation that retains only \(D/(2\phi)\) in such a comparison can omit terms that vary with the parameters.

Common Mistake

A frequent error is to define total deviance as \(\sum_i d(y_i,\mu_i)/\phi\). That expression is the scaled deviance, not the total deviance. The correction is to keep the quantities separate: first calculate \(D=\sum_i d(y_i,\mu_i)\); then divide by \(\phi\) if scaled deviance is wanted. The saturated-minus-fitted log-likelihood difference is \(D/(2\phi)\).

A second pitfall is to substitute \(p=1\) or \(p=2\) directly into the formula for \(p\ne1,2\). Its denominators vanish there. Take the limit, or use the integral form, to obtain the Poisson or Gamma expression.

Key takeaway: The unit deviance is a dispersion-free likelihood contrast determined by the power variance function. For \(p\ne1,2\), it has a closed form; at \(p=1\) and \(p=2\), its continuous limits are the Poisson and Gamma deviances. Sum unit deviances to obtain total deviance, and divide by \(\phi\) only to obtain scaled deviance.

Check Your Understanding

Use the formulas and distinctions developed above.

  1. For \(p\ne1,2\), identify the natural parameter \(\theta(\mu)\) and cumulant function \(b(\theta(\mu))\) associated with \(V(\mu)=\mu^p\).
  2. Explain why the carrier term cancels in a saturated-versus-fitted contrast for a fixed observation and dispersion.
  3. For independent observations, write the definitions of total deviance and scaled deviance, and state the log-likelihood difference they imply.
  4. Why is the unit deviance nonnegative when \(y,\mu>0\)? Use the integral representation.
  5. State the appropriate boundary value of the Poisson unit deviance at \(y=0\), and explain why the same substitution is not appropriate for a Gamma response.
Clinical Biostats