Tutorials › Generalized Linear Models › Deriving Mean-Scale Effects With The Chain Rule

Link Functions and Scale · Tutorial 109 of 981

Deriving Mean-Scale Effects With The Chain Rule

Learn to derive and calculate mean-scale derivatives, including how link curvature and nonlinear predictor terms change the effect of a continuous covariate.

Beginner 10 min read

What You'll Learn

  • Derive the mean-scale derivative from the inverse link and the derivative of the linear predictor
  • Distinguish a link-scale coefficient from the covariate’s mean-scale derivative
  • Calculate mean-scale effects for probit and square-root links
  • Determine how the derivative changes with the linear predictor
  • Extend the calculation to nonlinear predictor terms and transformed covariates
  • Use a derivative to describe a local change without confusing it with a finite change

From a Link-Scale Coefficient to a Mean-Scale Derivative

In a generalized linear model, the linear predictor describes the mean after applying the link function: \(g(\mu)=\eta\). The inverse link therefore gives \(\mu=g^{-1}(\eta)\). When a predictor is continuous, we can ask a more local question than how its coefficient changes the linear predictor: at a given predictor value, how quickly does the modeled mean change as the covariate changes?

The answer follows from the chain rule. The covariate changes the linear predictor, and the inverse link translates that change onto the mean scale. Consequently, a coefficient that is constant on the link scale need not correspond to a constant change in the mean. The derivative of the inverse link determines how the mean-scale effect varies with the current linear predictor.

Definition: Let \(x\) be a continuous covariate, hold all other covariates fixed, and write the linear predictor as a differentiable function \(\eta(x)\). If the inverse link \(h=g^{-1}\) is differentiable at \(\eta(x)\), the mean-scale derivative with respect to \(x\) is \(\frac{d\mu}{dx}=\frac{d h(\eta(x))}{dx}\). It describes the instantaneous rate of change in the modeled mean per unit change in \(x\), at the specified covariate values.

In the common case \(\eta(x)=\beta_0+\beta_1x+\sum_{j=2}^p\beta_j z_j\), with the \(z_j\) held fixed, \(\frac{d\eta}{dx}=\beta_1\). That coefficient is the change in the linear predictor per unit change in \(x\). To obtain the mean-scale derivative, it must be multiplied by the rate at which the inverse link changes at the current predictor.

The Chain-Rule Result

Theorem: Suppose \(\eta(x)\) is differentiable at \(x\), and \(h=g^{-1}\) is differentiable at \(\eta(x)\). If \(\mu(x)=h(\eta(x))\), then \(\frac{d\mu}{dx}=h'(\eta(x))\eta'(x)=\frac{d g^{-1}}{d\eta}\frac{d\eta}{dx}\), evaluated at the relevant predictor value.

The assumptions are local: the predictor needs a derivative at the covariate value of interest, and the inverse link needs a derivative at the resulting predictor value. No assumption that the link is canonical is required. For the usual linear predictor, the result becomes \(\frac{d\mu}{dx}=h'(\eta)\beta_1\). If the predictor includes a transformed covariate, its derivative must also be included.

Proof. Set \(\eta_0=\eta(x)\), and let \(\Delta\eta=\eta(x+\Delta x)-\eta(x)\). Differentiability of \(\eta\) gives \(\Delta\eta=\eta'(x)\Delta x+o(\Delta x)\). Differentiability of \(h\) at \(\eta_0\) gives \(h(\eta_0+\Delta\eta)-h(\eta_0)=h'(\eta_0)\Delta\eta+o(\Delta\eta)\). If \(\eta'(x)\ne 0\), dividing by \(\Delta x\) and taking the limit yields \(h'(\eta_0)\eta'(x)\). If \(\eta'(x)=0\), then \(\Delta\eta=o(\Delta x)\); the second expansion, divided by \(\Delta x\), tends to zero, including its remainder because \(o(\Delta\eta)/\Delta x\) tends to zero. Thus the derivative has the stated value in either case. \(\square\)

Worked Example: A Probit Mean with a Linear Predictor

Suppose the inverse link is \(h(\eta)=\Phi(\eta)\), where \(\Phi\) is the standard normal cumulative distribution function, and the predictor is \(\eta=0+0.8x\). Here \(h'(\eta)=\phi(\eta)\), where \(\phi(\eta)=\frac{1}{\sqrt{2\pi}}\exp(-\eta^2/2)\) is the standard normal density.

At \(x=0\), the predictor is \(\eta=0\), so the mean is \(\mu=\Phi(0)=0.5\). The mean-scale derivative is \(\frac{d\mu}{dx}=0.8\phi(0)=0.8(0.39894)\approx 0.31915\).

At \(x=1\), the predictor is \(\eta=0.8\), so \(\mu=\Phi(0.8)\approx0.78814\). Now \(\frac{d\mu}{dx}=0.8\phi(0.8)=0.8(0.28969)\approx0.23175\).

The coefficient \(0.8\) is unchanged, but the mean-scale derivative is smaller at \(x=1\) than at \(x=0\), because the inverse-link derivative \(\phi(\eta)\) is smaller at \(\eta=0.8\) than at \(\eta=0\). These derivatives are rates at individual predictor values, not the total change from \(x=0\) to \(x=1\).

How the Mean-Scale Derivative Changes

The first derivative tells us the mean-scale effect at a particular point. To describe how that effect itself varies with \(x\), differentiate once more. A useful special case has a linear predictor in \(x\), so that \(\eta(x)=a+\beta x\) for fixed \(a\) and \(\beta\).

Theorem: Suppose \(\eta(x)=a+\beta x\), and \(h\) is twice differentiable at the predictor values under consideration. Then \(\frac{d\mu}{dx}=\beta h'(\eta)\) and \(\frac{d^2\mu}{dx^2}=\beta^2 h''(\eta)\). In particular, if \(h''(\eta)>0\) throughout an interval, the mean-scale derivative increases with \(x\) on that interval; if \(h''(\eta)<0\), it decreases.

Proof. The chain-rule result gives \(\frac{d\mu}{dx}=h'(\eta)\eta'(x)=\beta h'(\eta)\), since \(\eta'(x)=\beta\). Differentiating this expression with respect to \(x\), using the chain rule again, gives \(\frac{d^2\mu}{dx^2}=\beta h''(\eta)\eta'(x)=\beta^2 h''(\eta)\). Since \(\beta^2\geq0\), the sign of this second derivative is the sign of \(h''(\eta)\) when \(\beta\ne0\); when \(\beta=0\), the mean is constant in \(x\). This proves the stated monotonicity of the first derivative. \(\square\)

For a nonlinear predictor, the second derivative has an additional term. If \(\eta\) and \(h\) are twice differentiable, differentiating \(h'(\eta)\eta'\) yields \(\frac{d^2\mu}{dx^2}=h''(\eta)(\eta')^2+h'(\eta)\eta''\). The second term accounts for curvature in the predictor itself. Thus the way a mean-scale effect varies can reflect both the inverse link and the covariate’s contribution to the predictor.

Worked Example: A Square-Root Link

Consider the inverse link \(h(\eta)=\eta^2\) on the domain \(\eta>0\), corresponding to the one-to-one link \(g(\mu)=\sqrt{\mu}\) for \(\mu>0\). Let \(\eta=0.5+0.3x\), and consider \(x\) values for which \(\eta>0\).

Here \(h'(\eta)=2\eta\), so the derivative is \(\frac{d\mu}{dx}=2\eta(0.3)=0.6\eta\). At \(x=0\), \(\eta=0.5\), \(\mu=(0.5)^2=0.25\), and \(\frac{d\mu}{dx}=0.6(0.5)=0.30\). At \(x=2\), \(\eta=0.5+0.3(2)=1.1\), \(\mu=(1.1)^2=1.21\), and \(\frac{d\mu}{dx}=0.6(1.1)=0.66\).

The predictor increases at the constant rate \(0.3\), but the mean-scale derivative increases from \(0.30\) to \(0.66\). The reason is that \(h'(\eta)=2\eta\) increases over the predictor values in this example. In fact, \(h''(\eta)=2\), so \(\frac{d^2\mu}{dx^2}=(0.3)^2(2)=0.18>0\), confirming that the derivative increases as \(x\) increases.

The finite mean change from \(x=0\) to \(x=2\) is \(1.21-0.25=0.96\). Dividing by the covariate change gives an average rate of \(0.96/2=0.48\), which is between the endpoint derivatives \(0.30\) and \(0.66\). It is not equal to either endpoint derivative.

Transformed Covariates and Finite Changes

If a predictor contains a transformed covariate, the chain rule applies at both stages. For example, if \(\eta(x)=\beta_0+\beta_1x^2\), then \(\eta'(x)=2\beta_1x\), not \(\beta_1\). The mean-scale derivative is therefore \(h'(\eta)2\beta_1x\). A coefficient multiplying a transformation describes change per unit of that transformed quantity; it does not by itself give the derivative per unit of the original covariate.

Worked Example: A Probit Mean with a Squared Covariate

Let \(\mu=\Phi(\eta)\) and \(\eta=0.2+0.4x^2\), with \(x>0\). Then \(\eta'(x)=0.8x\), and the chain rule gives \(\frac{d\mu}{dx}=0.8x\phi(0.2+0.4x^2)\).

At \(x=1\), \(\eta=0.2+0.4=0.6\), and \(\phi(0.6)\approx0.33322\). Thus \(\frac{d\mu}{dx}=0.8(1)(0.33322)\approx0.26658\). At \(x=2\), \(\eta=0.2+0.4(4)=1.8\), and \(\phi(1.8)\approx0.07895\). Thus \(\frac{d\mu}{dx}=0.8(2)(0.07895)\approx0.12632\).

Although the predictor changes faster per unit \(x\) at \(x=2\) than at \(x=1\), the mean-scale derivative is smaller there. The inverse-link derivative has fallen substantially. This illustrates why both factors, \(h'(\eta)\) and \(\eta'(x)\), must be evaluated at the covariate value of interest.

A derivative is a local rate, whereas a finite change compares means at two distinct covariate values. If \(h'\) and \(\eta'\) are continuous between \(x_0\) and \(x_1\), the fundamental theorem of calculus gives \(\mu(x_1)-\mu(x_0)=\int_{x_0}^{x_1}h'(\eta(x))\eta'(x)\,dx\). Thus a derivative at one endpoint generally does not equal the finite change divided by \(x_1-x_0\). A derivative-based approximation can be useful for a small change, but its accuracy depends on how much the derivative varies across that change.

Common Pitfall and Why the Derivative Matters

  • Wrong reasoning: “The coefficient of \(x\) is \(0.8\), so increasing \(x\) by one increases the mean by \(0.8\).” This treats a link-scale change as though it were already on the mean scale.
  • Correction: For a linear predictor, the mean-scale derivative is \(0.8h'(\eta)\), evaluated at the current predictor. It equals \(0.8\) only if the inverse-link derivative at that predictor equals \(1\).
  • Another common error: When \(\eta\) contains \(x^2\), using only the coefficient of \(x^2\). For a derivative with respect to \(x\), differentiate the predictor too: \(\frac{d}{dx}(\beta_1x^2)=2\beta_1x\).

Mean-scale derivatives are useful when a question concerns the rate of change in the modeled mean near a specified covariate value. They also make clear why the covariate’s effect can depend on where in the predictor range it is evaluated, even when the linear predictor has a constant coefficient. To report such an effect responsibly, specify the covariate value and the other covariates held fixed, and distinguish a local derivative from a finite contrast.

Key takeaway: For \(\mu=h(\eta(x))\), the mean-scale derivative is the product of two rates: the inverse-link derivative \(h'(\eta)\) and the predictor derivative \(\eta'(x)\). Its variation comes from changes in either factor.

Check Your Understanding

Use the chain rule and state the covariate values or conditions relevant to each answer.

  1. If \(\eta=1.2+0.5x\) and \(\mu=h(\eta)\), write the mean-scale derivative in terms of \(h'\) and \(\eta\).
  2. If \(h'(\eta)\) is positive and decreasing over the predictor values in a model with \(\eta=a+\beta x\), what does this imply about the mean-scale derivative when \(\beta>0\)?
  3. For \(\eta=2+0.3x^2\), calculate \(\eta'(x)\) and express \(\frac{d\mu}{dx}\) in terms of \(h'\).
  4. Why does a derivative at \(x_0\) generally not equal the average change in the mean between \(x_0\) and \(x_1\)?
  5. For a twice-differentiable inverse link and a linear predictor, what determines the sign of \(\frac{d^2\mu}{dx^2}\) when \(\beta\ne0\)?
Clinical Biostats