Tutorials › Nonlinear Mixed-Effects Models (NLME) › Log-Transforming a Continuous Covariate

Functional Forms for Covariates · Tutorial 493 of 797

Log-Transforming a Continuous Covariate

You will learn to specify and interpret an additive covariate effect on the log-transformed covariate scale, including how its slope depends on the chosen reference value and the covariate’s proportional change.

Intermediate 10 min read

What You'll Learn

  • Specify an additive parameter effect using the logarithm of a positive covariate relative to a reference value.
  • Distinguish the effect of a one-unit covariate increase from the effect of a proportional increase.
  • Interpret the slope’s units and calculate parameter changes for specified covariate values.
  • Re-express a log-covariate model at a different reference value without changing its predictions.
  • Check positivity, covariate range, and functional-form assumptions before interpreting a fitted relationship.
  • Distinguish a linear effect of log covariate from a power-law effect on the parameter.

Why Transform a Continuous Covariate?

A covariate may have a nonlinear relationship with an NLME parameter when viewed against its raw values, yet have a simpler relationship when viewed against its logarithm. For example, the change in a parameter associated with an increase from 10 to 20 units of a covariate may resemble the change associated with an increase from 50 to 100 units: both are doublings, even though the raw increases differ. A log-transformed covariate expresses this proportional structure directly.

The model developed here is additive in the parameter and linear in the log-transformed covariate. It is not the same as a power-law model, which is linear in the logarithm of the parameter. That distinction determines both the interpretation and units of the covariate-effect coefficient.

Definition: Let \(x\) be a continuous covariate with \(x>0\), let \(x_{\mathrm{ref}}>0\) be a chosen reference value, and let \(\theta_{\mathrm{ref}}\) be the parameter value at that reference. An additive log-covariate relationship is $$ \theta_{\mathrm{pop}}(x)=\theta_{\mathrm{ref}}+\beta\ln\!\left(\frac{x}{x_{\mathrm{ref}}}\right). $$ Here \(\beta\) is the change in the parameter for a one-unit increase in \(\ln(x/x_{\mathrm{ref}})\). The ratio is dimensionless, so the logarithm is well-defined; \(\beta\) has the same units as \(\theta_{\mathrm{pop}}\).

The notation \(\theta_{\mathrm{pop}}(x)\) denotes the parameter’s covariate-dependent structural value, before an individual random effect is applied. In a common NLME specification, an individual parameter is \(\theta_j=\theta_{\mathrm{pop}}(x_j)\exp(\eta_j)\), where \(\eta_j\) is a subject-level random effect. This multiplicative random effect requires the structural value to remain positive. If \(\eta_j\) is centered and symmetric, \(\theta_{\mathrm{pop}}(x_j)\) is the conditional median of \(\theta_j\); it is not generally the conditional mean.

The log-covariate model requires positive covariate values. Its functional-form assumption is that the parameter changes linearly with \(\ln(x/x_{\mathrm{ref}})\) over the range being modeled. It does not assume that the parameter changes by a constant amount for every one-unit increase in the raw covariate.

Interpreting Changes on the Log-Covariate Scale

For two covariate values \(x_1\) and \(x_2\), subtracting their parameter values gives

$$ \theta_{\mathrm{pop}}(x_2)-\theta_{\mathrm{pop}}(x_1) =\beta\ln\!\left(\frac{x_2}{x_1}\right). $$

The reference value cancels in this difference. Consequently, the effect of a covariate change depends on the ratio \(x_2/x_1\), not on the raw difference \(x_2-x_1\). A doubling always gives a change of \(\beta\ln(2)\), regardless of the starting value. A 10% increase gives \(\beta\ln(1.10)\). The sign of the change follows the sign of \(\beta\): if \(\beta\) is negative, increasing \(x\) decreases the parameter.

For small changes, the local rate of change on the raw covariate scale follows by differentiation:

$$ \frac{d\theta_{\mathrm{pop}}(x)}{dx}=\frac{\beta}{x}. $$

Thus the effect per raw covariate unit varies with \(x\), even though the effect per unit change in log covariate is constant. Equivalently, a small proportional change \(dx/x\) produces approximately \(\beta\,dx/x\) parameter units of change. This derivative is a local approximation; for a finite change, use the exact logarithmic difference.

Worked Example: Interpreting a Doubling

Suppose a hypothetical clearance model uses \(x_{\mathrm{ref}}=70\) kg, \(\theta_{\mathrm{ref}}=10.0\) L/h, and \(\beta=2.4\) L/h. Calculate the structural clearance at 140 kg and interpret the change.

The covariate ratio is \(140/70=2\), so

$$ \theta_{\mathrm{pop}}(140) =10.0+2.4\ln(140/70) =10.0+2.4\ln(2) \approx10.0+1.66 =11.7\ \mathrm{L/h}. $$

The modeled increase from 70 kg to 140 kg is \(2.4\ln(2)\approx1.66\) L/h, reported to three significant figures. The coefficient is in L/h, not L/h per kilogram: it multiplies a dimensionless log ratio. The predicted clearance increases because \(\beta\) is positive.

For another check, halving the reference covariate to 35 kg gives \(10.0+2.4\ln(0.5)\approx8.34\) L/h. The decrease from 70 kg is the negative of the increase for a doubling, because \(\ln(0.5)=-\ln(2)\).

Reference Values and Parameterization

At \(x=x_{\mathrm{ref}}\), the log ratio is zero, so \(\theta_{\mathrm{pop}}(x_{\mathrm{ref}})=\theta_{\mathrm{ref}}\). Choosing a reference therefore gives the intercept a direct interpretation: it is the structural parameter at a specified covariate value. A scientifically meaningful reference, such as a typical value in the data, can make that interpretation useful and can reduce unnecessary extrapolation.

Changing the reference does not change the fitted curve if the intercept is transformed consistently. To see this, let \(x_{\mathrm{ref}}'\) be a new reference and define \(\theta_{\mathrm{ref}}'=\theta_{\mathrm{ref}}+\beta\ln(x_{\mathrm{ref}}'/x_{\mathrm{ref}})\). Then

$$ \theta_{\mathrm{ref}}'+\beta\ln\!\left(\frac{x}{x_{\mathrm{ref}}'}\right) =\theta_{\mathrm{ref}}+\beta\ln\!\left(\frac{x_{\mathrm{ref}}'}{x_{\mathrm{ref}}}\right) +\beta\ln\!\left(\frac{x}{x_{\mathrm{ref}}'}\right) =\theta_{\mathrm{ref}}+\beta\ln\!\left(\frac{x}{x_{\mathrm{ref}}}\right). $$

The equality uses \(\ln(a)+\ln(b)=\ln(ab)\) for positive \(a\) and \(b\). The slope \(\beta\) and predictions remain unchanged; only the intercept’s reference-based interpretation changes.

Worked Example: Re-Referencing Without Changing Predictions

A hypothetical model has \(\theta_{\mathrm{ref}}=10.0\) L/h at \(x_{\mathrm{ref}}=50\) mL/min and \(\beta=1.5\) L/h. Re-express the model using 100 mL/min as the reference, then calculate the structural value at 80 mL/min using both parameterizations.

The new reference parameter is the predicted value at 100 mL/min:

$$ \theta_{\mathrm{ref}}' =10.0+1.5\ln(100/50) =10.0+1.5\ln(2) \approx11.0\ \mathrm{L/h}. $$

Using the original reference, the value at 80 mL/min is

$$ 10.0+1.5\ln(80/50) =10.0+1.5\ln(1.6) \approx10.7\ \mathrm{L/h}. $$

Using the new reference gives

$$ 11.0+1.5\ln(80/100) \approx11.0397+1.5\ln(0.8) \approx10.7\ \mathrm{L/h}. $$

The unrounded new reference value is about 11.0397 L/h; retaining it for the second calculation confirms that the prediction is unchanged. The displayed results are rounded to three significant figures.

Per-Unit and Proportional Changes

A log-covariate coefficient should not be interpreted as the effect of adding one raw unit to \(x\). For a raw increase from \(x\) to \(x+1\), the exact parameter change is \(\beta\ln((x+1)/x)\), which depends on the starting value. In contrast, a fixed proportional change has a constant effect. This is useful when covariate values span a wide range and comparisons by percentage or ratio are scientifically more meaningful than comparisons by absolute units.

Worked Example: Comparing a One-Unit Increase With a Doubling

Suppose a hypothetical model for a parameter measured in L/h has \(\beta=-0.80\) L/h and uses positive renal-function values \(x\) in mL/min. Compare a doubling from 30 to 60 mL/min with a one-unit increase from 60 to 61 mL/min.

For the doubling, the exact change is

$$ \Delta\theta_{\mathrm{pop}} =-0.80\ln(60/30) =-0.80\ln(2) \approx-0.555\ \mathrm{L/h}. $$

For the one-unit increase, the change is

$$ \Delta\theta_{\mathrm{pop}} =-0.80\ln(61/60) \approx-0.0132\ \mathrm{L/h}. $$

The doubled covariate produces the same modeled change wherever the doubling occurs. The one-unit increase is much smaller here because one unit is a small proportion of 60. Since the slope is negative, both changes lower the parameter. These calculations describe the covariate component of the model, not a causal effect.

How This Model Differs From Nearby Functional Forms

The earlier material on additive linear effects, exponential effects, and power-law effects uses different scales for the covariate or parameter. Identifying the scale is essential before interpreting a coefficient.

RelationshipWhat is linearInterpretation of a fixed proportional increase
\(\theta=\theta_{\mathrm{ref}}+\beta\ln(x/x_{\mathrm{ref}})\)Parameter versus log covariateConstant additive change in the parameter
\(\theta=\theta_{\mathrm{ref}}(x/x_{\mathrm{ref}})^\gamma\)Log parameter versus log covariateConstant proportional change in the parameter
\(\theta=\theta_{\mathrm{ref}}+\beta(x-x_{\mathrm{ref}})\)Parameter versus raw covariateChange depends on the raw increase in \(x\)

In the first row, the effect of doubling is \(\beta\ln(2)\) parameter units. In the power-law row, a doubling multiplies the parameter by \(2^\gamma\). These are not interchangeable interpretations. The log-covariate additive form also differs from a raw-scale linear model: its raw-scale slope is \(\beta/x\), not a constant.

Assumptions, Diagnostics, and Limitations

Before fitting or interpreting this relationship, check that the covariate is strictly positive and that its units and reference value are specified. The model is invariant to changing the covariate’s units if the reference is converted consistently: both \(x\) and \(x_{\mathrm{ref}}\) are multiplied by the same conversion factor, leaving their ratio unchanged. Zero or negative values cannot be used directly in this logarithm; adding an arbitrary constant changes the model and requires scientific justification.

The assumed relationship is linear in log covariate across the modeled range. Plotting observations or suitable residual summaries against \(\ln(x/x_{\mathrm{ref}})\), and examining the fitted relationship over the data-supported range, can reveal systematic departures such as curvature or a pattern driven by only a few extreme covariate values. Residual stratification across covariate ranges can also help identify remaining structure. Sparse observations near the extremes make the shape there difficult to assess, and predictions far outside the observed range are extrapolations, not well-supported consequences of the data.

If the parameter must be positive, the additive form must remain positive over the covariate range used. For \(\beta>0\), its smallest structural value occurs at the smallest modeled \(x\); for \(\beta<0\), it occurs at the largest modeled \(x\). Check that the resulting values are clinically and mathematically plausible. If positivity is not maintained, the specification may be unsuitable for that parameter or range. A multiplicative parameter model can ensure positivity, but it changes the meaning of the covariate effect; it is not a harmless numerical adjustment.

The model also assumes a constant effect per unit of log covariate. A good fit over a narrow range does not establish that the same relationship holds over a much wider range. Choice among candidate functional forms should consider data support, parameter interpretation, and clinical relevance, rather than selecting a form only because it produces a favorable statistical result.

Common Mistake

Common mistake: “The coefficient is \(-0.80\), so increasing the covariate by one mL/min decreases the parameter by \(0.80\) L/h.” This is incorrect because the coefficient multiplies a change in log covariate, not a raw one-unit change. For a change from \(x_1\) to \(x_2\), calculate \(\beta\ln(x_2/x_1)\). In particular, the effect of a one-unit increase depends on the starting value, while the effect of a fixed ratio is constant.

Check Your Understanding

Try each problem, then check the solutions below.

  1. A model has \(\theta_{\mathrm{ref}}=5.0\) mg/h at \(x_{\mathrm{ref}}=20\) kg and \(\beta=0.60\) mg/h. What is the modeled change when \(x\) doubles?
  2. For \(\beta=1.2\) parameter units, compare the exact effect of increasing \(x\) from 10 to 11 with the effect of increasing it from 100 to 101. Why do they differ?
  3. What must be changed when the reference covariate is changed, and what remains invariant?
  4. Why is \(\theta=\theta_{\mathrm{ref}}+\beta\ln(x/x_{\mathrm{ref}})\) not a power-law relationship?

Solutions. (1) The change is \(0.60\ln(2)\approx0.416\) mg/h; the modeled value after doubling is approximately \(5.42\) mg/h. (2) From 10 to 11 the change is \(1.2\ln(11/10)\approx0.114\) parameter units. From 100 to 101 it is \(1.2\ln(101/100)\approx0.0119\) units. The raw increases are both one unit, but they are different proportions of their starting values. (3) Recalculate the reference parameter as the model’s value at the new reference. The slope and predictions at all covariate values remain invariant. (4) The parameter itself, not its logarithm, is linear in \(\ln(x/x_{\mathrm{ref}})\). A power law is linear in log parameter versus log covariate and gives a proportional parameter change for a fixed covariate ratio.