Tutorials › Exam PA - Predictive Analytics › Deriving Marginal Effects Through a Link

Exam PA · Coefficient Interpretation and Diagnostics · Tutorial 331 of 966

Deriving Marginal Effects Through a Link

Learn to convert a GLM coefficient into the local change in expected response, with calculations for identity, log, and logit links.

Intermediate 9 min read

What You'll Learn

  • Define a response-scale marginal effect for a continuous predictor
  • Derive the effect using the chain rule and inverse link
  • Calculate marginal effects under identity, log, and logit links
  • Evaluate how effects vary with the current fitted mean
  • Distinguish a local derivative from a finite predictor change
  • Identify common errors when interpreting link-scale coefficients

From a Link-Scale Coefficient to a Response-Scale Change

A GLM coefficient describes a change in the linear predictor, not automatically a change of the same size in the expected response. The conversion depends on the link function. For an identity link, the two changes are equal; for log and logit links, the response-scale change depends on the current fitted mean.

That distinction matters when explaining a model in practical terms. A coefficient may be constant on the link scale while the rate of change in expected dollars, counts, or probabilities varies across observations. The response-scale derivative makes that local rate explicit.

Definition: Let \(Y\) be a response with conditional mean \(\mu=E[Y\mid x,z]\), where \(x\) is a continuous predictor and \(z\) represents any other predictors held fixed. The response-scale marginal effect of \(x\) at a specified predictor setting is the partial derivative \(\partial\mu/\partial x\). It describes the local change in the expected response for a one-unit increase in \(x\), with the other predictors unchanged.

For a GLM, the link relates the conditional mean to the linear predictor: \(g(\mu)=\eta\). For example, with a linear predictor \(\eta=\beta_0+\beta_1x+\beta_2z\), the coefficient \(\beta_1\) is the change in \(\eta\) for a one-unit increase in \(x\), holding \(z\) fixed. The response mean is recovered by applying the inverse link: \(\mu=g^{-1}(\eta)\).

The chain-rule result below assumes that the link is differentiable and invertible in the region being considered, that its derivative is nonzero there, and that \(x\) is a continuous predictor. The model’s other predictors are held fixed. If a predictor is categorical, a derivative with respect to its category is generally not the appropriate comparison; compare fitted means at the relevant category values instead.

Theorem: Under those conditions, if \(\eta=\beta_0+\beta_1x+\beta_2z\), then the response-scale marginal effect of \(x\) is $$ \frac{\partial\mu}{\partial x} = \frac{d g^{-1}(\eta)}{d\eta}\,\beta_1 = \frac{\beta_1}{g'(\mu)}. $$

Why the Chain-Rule Formula Holds

The mean is a function of the linear predictor, and the linear predictor is a function of \(x\). Differentiate the identity \(g(\mu)=\eta\) with respect to \(x\), keeping \(z\) fixed. The left side differentiates by the chain rule; the right side differentiates as a linear expression in \(x\).

$$ \frac{d}{dx}g(\mu) = g'(\mu)\frac{\partial\mu}{\partial x} = \frac{\partial\eta}{\partial x} = \beta_1. $$

Since \(g'(\mu)\ne 0\) in the region considered, divide both sides by \(g'(\mu)\). This gives \(\partial\mu/\partial x=\beta_1/g'(\mu)\). Equivalently, differentiate the inverse-link expression \(\mu=g^{-1}(\eta)\): its derivative with respect to \(\eta\) is multiplied by \(\partial\eta/\partial x=\beta_1\). The distributional family determines the response’s conditional distribution and variance, but this chain-rule conversion of the mean does not require a particular family.

Three Common Links

For the three links below, \(\beta_1\) always means the change in the linear predictor for a one-unit increase in \(x\). The response-scale effect is obtained by differentiating the inverse link.

LinkInverse linkResponse-scale marginal effect
Identity: \(g(\mu)=\mu\)\(\mu=\eta\)\(\beta_1\)
Log: \(g(\mu)=\log(\mu)\)\(\mu=e^\eta\)\(\beta_1\mu\)
Logit: \(g(\mu)=\log\left(\mu/(1-\mu)\right)\)\(\mu=1/(1+e^{-\eta})\)\(\beta_1\mu(1-\mu)\)

For the identity link, \(d\mu/d\eta=1\), so the marginal effect is constant and equals \(\beta_1\). For the log link, \(d\mu/d\eta=e^\eta=\mu\), so the effect is \(\beta_1\mu\): it changes with the fitted mean. For the logit link, differentiating \(1/(1+e^{-\eta})\) gives \(\mu(1-\mu)\), so the effect is \(\beta_1\mu(1-\mu)\). For a binary response, \(\mu\) is the fitted probability, and this effect is therefore in probability units per unit of \(x\).

Worked Examples

Worked Example: Identity Link for Expected Processing Time

A hypothetical insurer models the number of hours needed to process a claim. Conditional on predictors, processing time \(Y\) follows a normal distribution \(Y\mid x,z\sim N(\mu,16)\), where the second parameter is the variance. The identity-link model is \(\mu=\eta=40+6x-2z\), with \(x\) measured in additional documentation checks and \(z\) a fixed workload index. Find the expected time at \(x=5,z=3\), and the response-scale marginal effect of \(x\). Also calculate the fitted change from \(x=5\) to \(x=7\), holding \(z=3\).

Method. With an identity link, \(\mu=\eta\) and the marginal effect is the coefficient of \(x\). First compute the fitted means to check that the local effect agrees with the finite change.

At \(x=5,z=3\), \(\mu=40+6(5)-2(3)=40+30-6=64\) hours. At \(x=7,z=3\), \(\mu=40+6(7)-2(3)=40+42-6=76\) hours.

Thus the fitted change over two additional checks is \(76-64=12\) hours, or \(12/2=6\) hours per check. Directly, \(\partial\mu/\partial x=6\) hours per check. The results agree. The specified variance, 16 hours squared, describes response variability around the conditional mean and does not alter this derivative.

Common mistake avoided: Treating the intercept or the coefficient of \(z\) as part of the marginal effect of \(x\). With the other predictor held fixed, the derivative with respect to \(x\) is only the coefficient multiplying \(x\).

Worked Example: Log Link for Expected Claim Cost

For a hypothetical portfolio segment, claim cost \(Y\), in dollars, has a Gamma conditional distribution with mean \(\mu\) and variance \(\operatorname{Var}(Y\mid x)=0.20\mu^2\). A log-link model is \(\log(\mu)=\eta=\log(120)+0.04x\), where \(x\) is the number of prevention inspections. Calculate the expected cost and response-scale marginal effect at \(x=0\) and at \(x=10\). Then compare the exact fitted change over those ten inspections with the derivative at \(x=0\) multiplied by ten.

Method. For a log link, \(\mu=e^\eta\) and the derivative is \(\beta_1\mu=0.04\mu\). The Gamma variance specification is given to identify the conditional distribution; the mean and derivative use the fitted mean.

At \(x=0\), \(\eta=\log(120)\), so \(\mu=e^{\log(120)}=120\) dollars. The marginal effect is \(0.04(120)=4.8\) dollars per inspection.

At \(x=10\), \(\eta=\log(120)+0.04(10)=\log(120)+0.4\). Therefore \(\mu=120e^{0.4}=120(1.4918247)=179.01896\) dollars. The marginal effect there is \(0.04(179.01896)=7.1607584\) dollars per inspection. Rounded to four decimal places, the fitted mean is $179.0190 and the marginal effect is $7.1608 per inspection.

The exact fitted change over ten inspections is \(179.01896-120=59.01896\) dollars, or an average of \(59.01896/10=5.901896\) dollars per inspection. In contrast, the derivative at \(x=0\) multiplied by ten is \(4.8(10)=48\) dollars. The latter is a local-slope approximation at the starting value, not the exact change across the full interval. The derivative increases as the fitted mean increases.

Common mistake avoided: Reporting \(0.04\) dollars per inspection as the response-scale effect. It is the change in the log mean; the response-scale derivative at a particular setting is \(0.04\mu\).

Worked Example: Logit Link for a Claim Indicator

A hypothetical model predicts whether a reported incident results in a claim payment. The response \(Y\) is Bernoulli with probability \(P(Y=1\mid x)=p\). The logit model is \(\log(p/(1-p))=\eta=-2+0.5x\), where \(x\) is an exposure score. Find the fitted probability and response-scale marginal effect at \(x=3\). Then calculate the exact probability change from \(x=3\) to \(x=4\).

Method. For the logit link, first find \(p=1/(1+e^{-\eta})\), then calculate \(0.5p(1-p)\). This derivative is a local probability change per score unit.

At \(x=3\), \(\eta=-2+0.5(3)=-0.5\). Thus \(p=1/(1+e^{0.5})=1/(1+1.6487213)=0.3775407\). The marginal effect is \(0.5(0.3775407)(1-0.3775407)=0.5(0.3775407)(0.6224593)=0.1175019\). To four decimal places, the fitted probability is 0.3775 and the local effect is 0.1175 probability units per score unit.

At \(x=4\), \(\eta=-2+0.5(4)=0\), so \(p=1/(1+e^0)=0.5\). The exact fitted change is \(0.5-0.3775407=0.1224593\), or 0.1225 to four decimal places. It differs from the derivative at \(x=3\), because a derivative describes the local slope at one predictor value, not the exact change over a full unit.

Common mistake avoided: Calling the coefficient \(0.5\) a half-unit increase in probability. It is a change in the logit; the response-scale effect at \(x=3\) is about 0.1175.

Interpretation and Common Traps

The marginal effect is local: it is evaluated at a predictor setting and describes an instantaneous rate of change there. For a log or logit link, changing the current fitted mean changes the marginal effect even when the coefficient stays fixed. A finite predictor change should instead be evaluated by calculating the fitted mean at both endpoints and subtracting. Multiplying a derivative by a large change is generally only an approximation.

A second important distinction is the scale and unit. Under a log link, \(\beta_1\mu\) has the units of the response per unit of \(x\). Under a logit link, \(\beta_1\mu(1-\mu)\) is a probability change per unit of \(x\). Neither should be reported as if it were the link-scale coefficient itself.

Exam trap: For a logit model with coefficient \(\beta_1=0.5\) and fitted probability \(p=0.3775\), the incorrect response-scale calculation is \(0.5\), treating the coefficient as a 0.5 probability increase per unit. The correction is \(0.5(0.3775)(1-0.3775)=0.1175\) probability units per unit at that fitted probability. The coefficient remains \(0.5\) on the logit scale; the derivative is the response-scale effect.

In actuarial applications, the distinction helps make model outputs interpretable without overstating what the model establishes. A fitted marginal effect is an association implied by the specified model, conditional on the other predictors held fixed. It does not, by itself, show that changing the predictor would cause the expected response to change. When explaining a result, state the predictor setting, units, response scale, and whether the reported quantity is a local derivative or a finite fitted difference.

Check Your Understanding

For each model, calculate the requested fitted mean or probability and response-scale marginal effect. Round probabilities to four decimal places.

  1. A Gaussian response has \(Y\mid x\sim N(\mu,9)\) and identity-link model \(\mu=8+1.25x\). Find \(\mu\) and the marginal effect at \(x=6\). (Answer: \(\mu=15.5\); marginal effect \(=1.25\) response units per unit of \(x\).)
  2. A Gamma response has mean \(\mu\), variance \(0.16\mu^2\), and log-link model \(\log(\mu)=\log(80)+0.02x\). Find the fitted mean and marginal effect at \(x=5\). (Answer: \(\mu=80e^{0.1}=88.4136\); marginal effect \(=1.7683\) response units per unit of \(x\).)
  3. A Bernoulli response has logit model \(\eta=-1.5+0.6x\). Find the fitted probability and marginal effect at \(x=2\). (Answer: \(p=0.4256\); marginal effect \(=0.1467\) probability units per unit of \(x\).)
  4. A Gaussian response has identity-link model \(\mu=25-0.8x+1.4z\). At \(x=5,z=2\), find the fitted mean, marginal effect of \(x\), and fitted mean change when \(x\) increases by 2 with \(z\) fixed. (Answer: \(\mu=23.8\); marginal effect \(=-0.8\) per unit; fitted change \(=-1.6\).)
  5. A Bernoulli response has logit model \(\eta=-2+0.4x-0.3z\). Holding \(z=2\), find the fitted probability and marginal effect at \(x=5\), then find the exact fitted probability change from \(x=5\) to \(x=6\). (Answer: at \(x=5\), \(p=0.3543\) and marginal effect \(=0.0915\) per unit; the fitted probability at \(x=6\) is \(0.4502\), so the exact change is \(0.0958\).)
Clinical Biostats