Tutorials › Generalized Linear Models › Finite Changes Under Polynomial Log Means

Count Effects and Predictions · Tutorial 472 of 981

Finite Changes Under Polynomial Log Means

Learn to calculate a finite expected-count ratio from a quadratic log mean and distinguish it from the derivative describing a local effect.

Intermediate 11 min read

What You'll Learn

  • Write the conditional mean in a quadratic log-mean model.
  • Derive the expected-count ratio for any finite predictor change.
  • Relate the finite log ratio to the derivative of the log mean.
  • Distinguish a count-scale derivative from a finite change in expected counts.
  • Interpret effects when the quadratic term makes the log mean bend or turn.

From a Curved Log Mean to a Finite Change

In a count model with a linear log mean, a one-unit predictor increase produces the same expected-count ratio at every starting value. A quadratic term changes that: the ratio for a given step depends on both the size of the step and where it begins. This tutorial derives that dependence and separates a finite change from a local derivative, which describes behavior at an instant.

Let \(Y\) be a count response and \(X\) a continuous predictor. Suppose the conditional mean follows a quadratic log-mean model:

$$ \log\{\mu(x)\}=\beta_0+\beta_1x+\beta_2x^2,\qquad \mu(x)=E[Y\mid X=x]=\exp(\beta_0+\beta_1x+\beta_2x^2). $$

Here \(x\) is a value in the predictor's domain, and \(\beta_0,\beta_1,\beta_2\) are fixed model coefficients. The formulas below concern the model's conditional expected count; they do not require a particular distribution for \(Y\) beyond that conditional mean. In a Poisson regression, for example, \(Y\mid X=x\) has a Poisson distribution with mean \(\mu(x)\).

Definition: For a starting value \(x\) and a finite change \(\Delta\), the finite expected-count ratio is \(\mu(x+\Delta)/\mu(x)\), provided both predictor values are in the model's domain. The local log-mean slope at \(x\) is the derivative of \(\log\{\mu(x)\}\) with respect to \(x\); the local mean slope is the derivative of \(\mu(x)\).

Deriving the Finite-Change Formula

The ratio compares two conditional means. Taking its logarithm subtracts their log means, so the intercept cancels. Expanding the quadratic at the new value gives an exact expression.

Result: In the quadratic log-mean model, for any \(x\) and finite \(\Delta\) for which both means are defined,
$$ \frac{\mu(x+\Delta)}{\mu(x)} =\exp\!\left\{\Delta(\beta_1+2\beta_2x)+\beta_2\Delta^2\right\}. $$

To verify the result, substitute the model mean and use \(\exp(a)/\exp(b)=\exp(a-b)\):

$$ \begin{aligned} \frac{\mu(x+\Delta)}{\mu(x)} &=\exp\!\left[ \beta_0+\beta_1(x+\Delta)+\beta_2(x+\Delta)^2 -\{\beta_0+\beta_1x+\beta_2x^2\} \right]\\ &=\exp\!\left[ \beta_1\Delta+\beta_2(2x\Delta+\Delta^2) \right]\\ &=\exp\!\left\{\Delta(\beta_1+2\beta_2x)+\beta_2\Delta^2\right\}. \end{aligned} $$

Thus the finite log ratio has two parts. The term \(\Delta(\beta_1+2\beta_2x)\) uses the local log-mean slope at the starting value, while \(\beta_2\Delta^2\) accounts for curvature over the whole step. When \(\beta_2=0\), the curvature term disappears and the ratio depends only on the step size, as in a linear log mean. When \(\beta_2\ne0\), omitting the curvature term generally gives the wrong finite ratio.

Worked Example: A Finite Change Can Return to the Same Mean

Suppose \(\log\{\mu(x)\}=\log(10)+0.2x-0.05x^2\). Compare the expected counts at \(x=1\) and \(x=3\), and calculate the local mean slope at \(x=1\).

The finite step is \(\Delta=3-1=2\). The log ratio is

$$ \Delta(\beta_1+2\beta_2x)+\beta_2\Delta^2 =2\{0.2+2(-0.05)(1)\}+(-0.05)(2^2) =2(0.1)-0.2=0. $$

Therefore \(\mu(3)/\mu(1)=\exp(0)=1\). Direct calculation checks this: the log mean at \(x=1\) is \(\log(10)+0.15\), and at \(x=3\) it is \(\log(10)+0.6-0.45=\log(10)+0.15\). Both expected counts are \(10e^{0.15}\), approximately \(11.62\).

The local log-mean slope is \(\beta_1+2\beta_2x\), which at \(x=1\) equals \(0.2-0.1=0.1\). Since \(\mu'(x)=\mu(x)(\beta_1+2\beta_2x)\), the local mean slope there is \(10e^{0.15}(0.1)\), approximately \(1.16\) expected counts per unit of \(x\). A positive local slope at the starting point is consistent with the finite ratio of one: the mean first rises and then falls over the full interval.

Local Derivatives and the Finite-Change Identity

The local log-mean slope follows by differentiating the quadratic log mean. The derivative of the mean itself follows from the chain rule. These derivatives describe instantaneous rates of change, not ratios across a nonzero interval.

Result: For every \(x\) in the model's domain,
$$ \frac{d}{dx}\log\{\mu(x)\}=\beta_1+2\beta_2x, \qquad \mu'(x)=\mu(x)(\beta_1+2\beta_2x). $$

For the second equality, write \(\mu(x)=\exp\{\eta(x)\}\), where \(\eta(x)=\beta_0+\beta_1x+\beta_2x^2\). Differentiation gives \(\mu'(x)=\exp\{\eta(x)\}\eta'(x)\), and \(\eta'(x)=\beta_1+2\beta_2x\). Substituting \(\exp\{\eta(x)\}=\mu(x)\) proves the expression.

There is also an exact link between the finite log ratio and local log-mean slopes. Since \(\eta(x)=\log\{\mu(x)\}\) is continuously differentiable, the fundamental theorem of calculus applies on the interval between \(x\) and \(x+\Delta\):

$$ \log\!\left\{\frac{\mu(x+\Delta)}{\mu(x)}\right\} =\eta(x+\Delta)-\eta(x) =\int_x^{x+\Delta}(\beta_1+2\beta_2t)\,dt. $$

For \(\Delta\ne0\), dividing by \(\Delta\) shows that the finite log ratio per unit of predictor change is the average local log-mean slope along that interval:

$$ \frac{1}{\Delta}\log\!\left\{\frac{\mu(x+\Delta)}{\mu(x)}\right\} =\beta_1+2\beta_2x+\beta_2\Delta. $$

The right side is the local slope at the midpoint \(x+\Delta/2\). This follows because the derivative \(\beta_1+2\beta_2t\) is linear in \(t\), so its average over the interval equals its value at the midpoint. Equivalently, the quadratic model gives the exact finite log ratio as \(\Delta\) times the midpoint slope. This identity holds for positive or negative \(\Delta\), with the signed integral and signed denominator interpreted consistently.

Worked Example: Comparing the Finite Ratio With the Starting Slope

Let \(\mu(x)=4\exp(0.3x+0.04x^2)\). Find the ratio for a change from \(x=2\) to \(x=2.5\), then compare it with the local slopes at the start and midpoint.

Here \(\Delta=0.5\), and the finite log ratio is

$$ 0.5\{0.3+2(0.04)(2)\}+0.04(0.5)^2 =0.5(0.46)+0.01=0.24. $$

Thus the expected-count ratio is \(e^{0.24}\), approximately \(1.271\): the expected count at \(2.5\) is about 27.1% larger than at \(2\). Directly, the exponents beyond \(\log(4)\) are \(0.3(2)+0.04(2^2)=0.76\) at \(x=2\), and \(0.3(2.5)+0.04(2.5^2)=1.00\) at \(x=2.5\); their difference is \(0.24\).

The starting local log-mean slope is \(0.3+0.08(2)=0.46\). Multiplying it by the step gives \(0.46(0.5)=0.23\), not the exact finite log ratio \(0.24\). The midpoint is \(2.25\), where the local slope is \(0.3+0.08(2.25)=0.48\); multiplying by \(0.5\) gives \(0.24\), exactly. The mean at the starting point is \(4e^{0.76}\), approximately \(8.54\), so its local mean slope there is \(8.54(0.46)\), approximately \(3.93\) expected counts per predictor unit. That count-scale derivative is neither the finite ratio nor the finite difference in expected counts.

Reading Curvature and Direction

The quadratic coefficient determines how the local log-mean slope changes with \(x\). If \(\beta_2>0\), the slope increases as \(x\) increases; if \(\beta_2<0\), it decreases. When \(\beta_2\ne0\), the slope is zero at \(x=-\beta_1/(2\beta_2)\), if that point lies in the predictor's domain. This is the turning point of the log mean and, because the exponential function is increasing, also of the mean.

A finite ratio greater than one means the expected count at the endpoint \(x+\Delta\) is higher than at \(x\); a ratio below one means it is lower. It does not imply that the mean moved in that direction at every point in between. A curved mean can rise and then fall, or fall and then rise. Therefore, when interpreting a finite change, report the starting value, the size and direction of the change, and the resulting ratio rather than describing only the coefficient of \(x\).

Worked Example: A Finite Increase Across a Turning Point

Suppose \(\mu(x)=2\exp(0.5x-0.1x^2)\). Compare \(x=0\) with \(x=2\), and examine how the local slope changes along the interval.

With \(\Delta=2\), the log ratio is

$$ 2\{0.5+2(-0.1)(0)\}+(-0.1)(2^2) =1-0.4=0.6. $$

The expected-count ratio is \(e^{0.6}\), approximately \(1.822\). Since \(\mu(0)=2\), the endpoint mean is \(\mu(2)=2e^{0.6}\), approximately \(3.64\), an increase of about \(1.64\) expected counts.

The local log-mean slope is \(0.5-0.2x\). It is \(0.5\) at \(x=0\), \(0.1\) at \(x=2\), and zero at \(x=2.5\). The turning point is outside the interval \([0,2]\), so the mean increases throughout this particular change, though its relative rate of increase declines. The average slope on \([0,2]\) is \(0.3\); multiplying by the step \(2\) gives the exact log ratio \(0.6\). At the starting point, using the local slope alone would instead give \(2(0.5)=1\), which overstates the finite log ratio.

Common Mistake: Treating the Linear Coefficient as the Whole Effect

A frequent error is to say that a one-unit increase in \(x\) always multiplies the expected count by \(e^{\beta_1}\), because \(\beta_1\) is the coefficient of \(x\). That is correct only if \(\beta_2=0\). In a quadratic model, a one-unit step from \(x\) has ratio

$$ \frac{\mu(x+1)}{\mu(x)} =\exp\{\beta_1+2\beta_2x+\beta_2\} =\exp\{\beta_1+2\beta_2x+\beta_2\}. $$

The ratio can vary with the starting value, and it includes the curvature contribution \(\beta_2\). A related mistake is to interpret \(\mu'(x)\) as a finite expected-count difference. A derivative is a limiting rate per unit of \(x\); over a finite interval the exact difference is \(\mu(x+\Delta)-\mu(x)\), and the exact ratio is \(\mu(x+\Delta)/\mu(x)\). They answer different questions.

Key takeaway: For a quadratic log mean, calculate a finite expected-count ratio by subtracting the two log means. Use the derivative for an instantaneous local effect. The quadratic term makes the finite effect depend on both the starting predictor value and the step size.

Check Your Understanding

Use the quadratic log-mean model and distinguish finite changes from local slopes.

  1. For \(\log\{\mu(x)\}=\beta_0+\beta_1x+\beta_2x^2\), derive the ratio \(\mu(x+2)/\mu(x)\).
  2. If \(\beta_2=0\), what is the expected-count ratio for a change of \(\Delta\), and why does it no longer depend on the starting value?
  3. Explain why \(\beta_1+2\beta_2x\) is not generally the exact log ratio for a finite change from \(x\) to \(x+\Delta\).
  4. For \(\beta_1=0.4\), \(\beta_2=-0.05\), and a change from \(x=1\) to \(x=2\), calculate the log ratio and the expected-count ratio.
  5. What does a finite expected-count ratio greater than one tell you? Does it establish that the mean increased at every point between the two predictor values?
Clinical Biostats