Tutorials › Exam PA - Predictive Analytics › Effects of Log-Transformed Predictors

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

Effects of Log-Transformed Predictors

Translate a multiplicative change in a positive predictor into the correct link-scale and response-scale effect.

Intermediate 9 min read

What You'll Learn

  • State the assumptions needed to interpret a coefficient on the natural logarithm of a predictor.
  • Calculate link-scale changes when the original predictor is multiplied by a constant.
  • Interpret those changes under log, logit, and identity links.
  • Distinguish a constant response ratio from a baseline-dependent response change.
  • Recognize why logging a predictor requires positive values and why other transformations differ.
  • Avoid treating a log-predictor coefficient as a per-unit or per-percentage response change.

Why a Log-Transformed Predictor Changes the Interpretation

A generalized linear model may use a transformed predictor such as \(\log(x)\) rather than the original value \(x\). This is useful when a multiplicative change in \(x\)—for example, doubling it—is more meaningful than adding one unit. The coefficient then describes a change in the model’s linear predictor for a change in \(\log(x)\); the corresponding change in the fitted response depends on the link function.

The key calculation is straightforward, but its interpretation is easy to misstate. A doubling does not change the linear predictor by one coefficient unit: it changes it by the coefficient multiplied by \(\log(2)\). Under a log link this gives a response ratio; under a logit or identity link it gives a different kind of response-scale effect. These distinctions are aligned with the SOA Exam PA (Predictive Analytics) syllabus.

Definition: Suppose a GLM has linear predictor \(\eta=g(\mu)\), where \(\mu=E[Y\mid x,\mathbf z]\) is the conditional mean and \(g\) is the link function. If the model includes \(\beta\log(x)\), then \(\beta\) is the change in \(\eta\) for a one-unit increase in \(\log(x)\), holding the other predictors \(\mathbf z\) fixed. The original predictor \(x\) must be positive when the model uses \(\log(x)\).

The Multiplicative-Change Rule

Consider the model

$$ \eta=\beta_0+\beta\log(x)+\boldsymbol{\gamma}^{\mathsf T}\mathbf z, \qquad x>0. $$

Here \(\mathbf z\) represents the other predictors, and \(\boldsymbol{\gamma}\) their coefficients. Suppose \(x\) changes to \(cx\), where \(c>0\), while \(\mathbf z\) stays fixed. The difference in the linear predictor is

$$ \Delta\eta =\beta\log(cx)-\beta\log(x) =\beta\log(c). $$

This uses the logarithm identity \(\log(cx)=\log(c)+\log(x)\). The effect depends on the factor \(c\), not on the starting value of \(x\). For instance, doubling \(x\) gives \(\Delta\eta=\beta\log(2)\) whether \(x\) changes from 2 to 4 or from 20 to 40. The response-scale effect is found by applying the inverse link to the new linear predictor:

$$ \mu_{\mathrm{new}} =g^{-1}\!\left(\eta_{\mathrm{old}}+\beta\log(c)\right), \qquad \mu_{\mathrm{old}}=g^{-1}(\eta_{\mathrm{old}}). $$

This equation is the general rule. Unless the inverse link has a special form, the change in \(\mu\) cannot be reduced to a single constant amount or ratio that is independent of the baseline.

Justification: Holding the other predictors fixed cancels their contributions when the two linear predictors are subtracted. Since \(\log(cx)=\log(c)+\log(x)\), the only remaining difference is \(\beta\log(c)\). The conditional mean is related to the linear predictor by \(\mu=g^{-1}(\eta)\), so substituting the new value of \(\eta\) gives the response-scale formula above. The derivation requires \(x>0\), \(c>0\), and the stated model form.

How the Link Determines the Response-Scale Effect

The same link-scale change can have quite different interpretations in different GLMs. The table summarizes three common cases. All interpretations hold other predictors fixed, and assume that the model contains \(\beta\log(x)\) without an interaction that changes this coefficient.

LinkResponse-scale result when \(x\) becomes \(cx\)Interpretation
Log: \(\log(\mu)=\eta\)\(\mu_{\mathrm{new}}/\mu_{\mathrm{old}}=c^\beta\)The mean is multiplied by a constant; the ratio does not depend on its baseline.
Logit: \(\log(\mu/(1-\mu))=\eta\)The odds are multiplied by \(c^\beta\)The probability change depends on the original probability.
Identity: \(\mu=\eta\)\(\mu_{\mathrm{new}}-\mu_{\mathrm{old}}=\beta\log(c)\)The mean changes by a constant amount for a given multiplicative factor.

For a log link, the result follows by exponentiating both linear predictors: \(\mu_{\mathrm{new}}=\exp(\eta_{\mathrm{old}}+\beta\log(c))=\mu_{\mathrm{old}}c^\beta\). For a logit link, exponentiating \(\eta\) gives the odds \(\mu/(1-\mu)\), so the same calculation applies to the odds, not directly to the probability. For an identity link, the inverse link leaves \(\eta\) unchanged, so the link-scale difference is also the difference in fitted means.

Worked Example: A Log-Link Model for Event Counts

A hypothetical monitoring program counts service interruptions over a fixed observation period. Conditional on a positive equipment-age index \(x\), suppose the count \(Y\) has a Poisson distribution with mean \(\lambda(x)\), and the model is

$$ Y\mid x\sim\operatorname{Poisson}(\lambda(x)), \qquad \log(\lambda(x))=\log(8)+0.5\log(x). $$

Compare the fitted mean when the index increases from \(x=1\) to \(x=4\). The other conditions are held fixed.

Method. This is a log-link model, so calculate the multiplicative factor in the mean. The change in \(x\) is a factor of \(c=4/1=4\), giving

$$ \Delta\eta=0.5\log(4)=0.5(1.386294)=0.693147. $$

At \(x=1\), \(\log(\lambda)=\log(8)+0.5\log(1)=\log(8)\), so \(\lambda_{\mathrm{old}}=8\). The mean ratio is

$$ \frac{\lambda_{\mathrm{new}}}{\lambda_{\mathrm{old}}} =\exp(0.693147) =2. $$

Therefore, \(\lambda_{\mathrm{new}}=8(2)=16\). Direct substitution checks the result: at \(x=4\), \(\log(\lambda)=\log(8)+0.5\log(4)=\log(8)+\log(2)=\log(16)\), so the new fitted mean is 16 interruptions.

The model describes the expected count; it does not say that the observed count must equal 8 or 16. The common mistake to avoid is reporting \(0.5\) as the mean’s percentage increase. The coefficient is on the log-mean scale; the fourfold change in \(x\) produces a mean ratio of \(4^{0.5}=2\).

Logit Link: The Odds Ratio Is Not a Probability Ratio

For a binary response, let \(p(x)=P(Y=1\mid x,\mathbf z)\). Under a logistic GLM, the logit is \(\log(p/(1-p))\). A coefficient on \(\log(x)\) gives a constant multiplier for the odds when \(x\) is multiplied by \(c\). To obtain a probability, first update the odds and then convert those odds back to a probability. In general, the probability difference varies with the starting probability.

Worked Example: Updating a Claim Probability Under a Logit Link

Suppose a hypothetical claim-indicator model is

$$ Y\mid x\sim\operatorname{Bernoulli}(p(x)), \qquad \operatorname{logit}(p(x))=\beta_0+0.8\log(x). $$

At \(x=2\), the fitted probability is \(0.2000\). Find the fitted probability at \(x=6\), with other predictors fixed.

Method. The predictor is multiplied by \(c=6/2=3\). At \(x=2\), the odds are \(0.2/(1-0.2)=0.2/0.8=0.25\). The log-odds change and odds multiplier are

$$ \Delta\eta=0.8\log(3)=0.8(1.098612)=0.878890, \qquad \exp(\Delta\eta)=3^{0.8}=2.4082. $$

Thus the new odds are \(0.25(2.4082)=0.60205\). Convert these odds \(o\) to a probability using \(p=o/(1+o)\):

$$ p_{\mathrm{new}} =\frac{0.60205}{1+0.60205} =\frac{0.60205}{1.60205} \approx 0.3758. $$

The fitted probability rises from \(0.2000\) to approximately \(0.3758\). The check is that its odds, \(0.3758/(1-0.3758)\), are approximately \(0.60205\), as calculated. Probabilities are rounded to four decimals. The common mistake is to call \(2.4082\) a probability multiplier; it multiplies the odds, not the probability.

Identity Link: A Constant Change in the Fitted Mean

With an identity link, the fitted mean changes additively by \(\beta\log(c)\). The effect is constant for a given multiplicative change in \(x\), but the model does not guarantee that predictions remain within a restricted range such as positive values. Whether the identity link is appropriate depends on the response and on the behavior of predictions over the range of interest.

Worked Example: A Gaussian Model With an Identity Link

A hypothetical operations team models processing time \(Y\), in minutes, using a positive workload index \(x\). Suppose

$$ Y\mid x\sim N(\mu(x),9), \qquad \mu(x)=54.1589-3\log(x). $$

The normal distribution’s second parameter is the variance, so the conditional variance here is 9 minutes squared. Compare the fitted mean at \(x=4\) and \(x=8\).

Method. This is a doubling, so \(c=8/4=2\). The linear predictor and response are identical under the identity link. The change is

$$ \Delta\mu=-3\log(2)=-3(0.693147)=-2.079441. $$

At \(x=4\), the fitted mean is \(54.1589-3\log(4)\). Since \(\log(4)=1.386294\), this is approximately \(54.1589-4.1589=50.0000\) minutes. At \(x=8\), the fitted mean is approximately \(50.0000-2.0794=47.9206\) minutes. Direct substitution gives \(54.1589-3\log(8)\approx47.9206\), confirming the calculation. Means are rounded to four decimal places.

The doubling reduces the fitted mean by about 2.0794 minutes, not by 3 minutes. The coefficient applies to a one-unit increase in \(\log(x)\), whereas doubling \(x\) increases \(\log(x)\) by \(\log(2)\). The common mistake is to use the original-unit change \(8-4=4\) as though the model contained \(4\beta\).

Interpretation Checks and Common Traps

Before interpreting a fitted coefficient, check what was actually entered into the model. A formula using \(\log(x)\) is different from one using \(x\), \(\log(1+x)\), or a logarithm with a base other than \(e\). For \(\log(x)\), the multiplicative-change rule applies because \(\log(cx)-\log(x)=\log(c)\). It does not apply in the same form to \(\log(1+x)\): the change becomes \(\log(1+cx)-\log(1+x)\), which depends on the starting value of \(x\).

A percentage increase is a multiplicative change. For example, a 10% increase uses \(c=1.10\), while a 10% decrease uses \(c=0.90\). For a log-link model the corresponding mean ratio is \(1.10^\beta\) or \(0.90^\beta\); it is not generally \(1+0.10\beta\) or \(1-0.10\beta\). Those latter expressions may be approximations for small changes, not exact interpretations.

The calculation also depends on the model containing the stated log term. If the coefficient is estimated using \(\log(x)\), it is not a coefficient per dollar, per year, or per one-unit increase in \(x\). If \(x\) can be zero or negative, \(\log(x)\) is undefined, so the model requires a suitable domain or a different transformation. Any change in other predictors, or a model term that alters the effect of \(\log(x)\), must be accounted for separately rather than silently held fixed.

Key takeaway: When a positive predictor changes from \(x\) to \(cx\), a term \(\beta\log(x)\) changes the linear predictor by exactly \(\beta\log(c)\). Then apply the model’s inverse link: a log link gives a mean ratio \(c^\beta\), a logit link gives an odds ratio \(c^\beta\), and an identity link gives an additive mean change \(\beta\log(c)\).

Check Your Understanding

For each problem, hold all unspecified predictors fixed. Give probabilities to four decimals where applicable.

  1. A Poisson GLM has a log link and \(\log(\lambda)=\alpha+0.3\log(x)\). The fitted mean is 12 when \(x=5\). Find the mean when \(x=20\), and state the mean ratio. (Answer: ratio \(4^{0.3}=1.5157\); new mean \(12(1.5157)=18.19\).)
  2. A logistic GLM includes \(-0.5\log(x)\). At \(x=4\), the fitted probability is \(0.4000\). Find the fitted probability at \(x=16\). (Answer: the odds are multiplied by \(4^{-0.5}=0.5\); new probability \(0.2500\).)
  3. An identity-link GLM has fitted mean 14 when \(x=3\), and coefficient \(2.5\) on \(\log(x)\). Find the fitted mean at \(x=9\). (Answer: change \(2.5\log(3)=2.7465\); new mean \(16.7465\).)
  4. A log-link model has coefficient \(0.12\) on \(\log(x)\). By what factor does the fitted mean change when \(x\) increases by 10%? Give the percentage change to two decimal places. (Answer: factor \(1.1^{0.12}=1.0115\), an increase of \(1.15\%\).)
  5. A logistic GLM has coefficient \(0.7\) on \(\log(x)\). The fitted probability is \(0.1000\) at \(x=2\). Find the fitted probability at \(x=4\). (Answer: new odds \(=(0.1/0.9)2^{0.7}\approx0.1805\); new probability \(\approx0.1529\).)
Clinical Biostats