Why Represent Ordered Categories With a Trend?
Some covariates have categories with a natural order: for example, mild, moderate, and severe disease, or successive stages of renal impairment. Treating these categories as nominal is flexible, but it does not use their order to summarize a pattern. Numeric trend coding uses the order by assigning each category a score, then describes the covariate effect with a slope across those scores. The benefit is parsimony; the cost is a substantive assumption about how effects change from one category to the next.
In an NLME model, the trend is specified for a model parameter, not automatically for the observed response. For example, a trend in clearance changes the clearance used by the structural model; it does not assert that concentrations change linearly across category scores. The parameter scale matters: a linear trend in clearance differs from a linear trend in log clearance.
Indicator Coding and Trend Coding
With indicator coding, choose category 1 as the reference and give each other category its own coefficient. A standard form for one parameter is
Here \(I(c_i=c)\) is 1 when individual \(i\) is in category \(c\), and 0 otherwise. The reference category has transformed typical parameter value \(\beta_0\); category \(c\) has transformed typical value \(\beta_0+\gamma_c\). Indicator coding does not require the category effects to follow a particular pattern.
Numeric trend coding instead uses one slope:
For the examples here, the random effect \(\eta_i\) has mean zero, the same distribution across categories, and is independent of category. These assumptions mean that setting \(\eta_i=0\) gives the typical parameter value in each category. The trend describes that typical value; it does not remove individual variation or specify the residual-error model.
Subtracting the transformed typical value for category \(d\) from that for category \(c\) gives
Thus, category effects are equally spaced on the \(g(\theta)\) scale when the scores are equally spaced. With scores \(0,1,2,\ldots\), each one-point increase adds \(\beta_1\) on that scale. If \(g\) is the identity function, this means equal additive changes in the parameter. If \(g(\theta)=\log(\theta)\), it means equal changes in log parameter, or equal multiplicative ratios in the parameter.
Calculating Effects on Different Parameter Scales
Worked Example: An Additive Trend in Clearance
Suppose a hypothetical NLME model uses severity scores 0, 1, 2, and 3 for four ordered categories. Clearance \(CL_i\), measured in L/h, has an identity-scale trend with \(\beta_0=5.00\) L/h and \(\beta_1=-0.400\) L/h per score point. For the typical individual, \(\eta_i=0\), so
The category-specific typical clearances are:
- Score 0: \(5.00-0.400(0)=5.00\) L/h.
- Score 1: \(5.00-0.400(1)=4.60\) L/h.
- Score 2: \(5.00-0.400(2)=4.20\) L/h.
- Score 3: \(5.00-0.400(3)=3.80\) L/h.
The model therefore assigns a decrease of 0.400 L/h for each one-point score increase. For example, the typical contrast between scores 0 and 3 is \(3(-0.400)=-1.20\) L/h, and \(5.00-1.20=3.80\) L/h. This is an additive pattern in clearance, not a claim that the observed concentration changes by a fixed amount.
Worked Example: A Multiplicative Trend in a Parameter
Consider three hypothetical ordered categories scored 0, 1, and 2. Suppose a parameter \(\theta_i\), measured in L/h, is modeled on the log scale:
At \(\eta_i=0\), exponentiating gives \(\theta_{\mathrm{typ}}(c)=5.00(0.800)^{x_c}\) L/h. The values are:
- Score 0: \(5.00(0.800)^0=5.00\) L/h.
- Score 1: \(5.00(0.800)^1=4.00\) L/h.
- Score 2: \(5.00(0.800)^2=3.20\) L/h.
Each one-point score increase multiplies the typical parameter by 0.800, corresponding to a 20.0% decrease relative to the preceding category. The two-point contrast is a ratio of \(0.800^2=0.640\), so the score-2 typical value is 64.0% of the score-0 value. It is not a constant additive decrease: the decreases are 1.00 L/h and then 0.800 L/h.
How the Trend Restricts Indicator Effects
The restriction can be seen directly by rewriting the trend model in reference-cell form. If scores are \(x_1=0,x_2=1,\ldots,x_K=K-1\), then category \(c\)'s indicator coefficient on the transformed scale must equal \(\beta_1x_c\). In particular, the second category's effect is \(\beta_1\), and the third category's effect is \(2\beta_1\). An arbitrary set of indicator coefficients will not generally satisfy these equalities.
Worked Example: Checking Whether Indicator Effects Follow a Trend
Suppose a hypothetical model uses log parameter effects and has three ordered categories scored 0, 1, and 2. An indicator-coded model estimates a typical parameter of 6.00 L/h in the reference category, with log-scale coefficients \(\gamma_2=-0.100\) and \(\gamma_3=-0.350\). The typical parameter values implied by these estimates are:
- Category 1: \(6.00\) L/h.
- Category 2: \(6.00\exp(-0.100)=5.429\) L/h.
- Category 3: \(6.00\exp(-0.350)=4.228\) L/h.
For a one-slope trend on these scores, the category-2 effect would be \(\beta_1\), and the category-3 effect would have to be \(2\beta_1\). If \(\beta_1=-0.100\), the category-3 effect required by the trend would be \(-0.200\), not \(-0.350\). Conversely, setting \(\beta_1=-0.350/2=-0.175\) to match category 3 would imply a category-2 effect of \(-0.175\), not \(-0.100\). These indicator effects therefore do not lie on a straight line across the assigned scores. The indicator model can represent them; a linear trend model cannot represent both exactly.
Choosing Scores, Checking Fit, and Understanding Limits
Ordinal labels establish order, but they do not by themselves establish equal spacing. Assigning scores 0, 1, 2 assumes that the modeled effect changes by the same amount from the first to the second category as from the second to the third, on the chosen parameter scale. If scientifically justified spacing differs, scores such as 0, 1, 3 can encode that spacing; the model then assumes a change three times as large between scores 0 and 3 as between scores 0 and 1. The scores should be chosen for a defensible reason, not because numeric labels happen to exist.
A trend model is attractive when a monotone, approximately linear pattern is scientifically credible and the data do not support many separate category effects. It uses fewer fixed-effect coefficients than indicator coding and can be more stable when some categories are sparse. Indicator coding is preferable when category-specific departures are plausible or when the order is meaningful but spacing is not. As in the earlier material on categorical covariates, these are alternative parameterizations of the covariate effect, not different definitions of the underlying categories.
Assess the assumption on the scale actually modeled. Useful checks include plotting category-specific model estimates or predictions against the assigned scores, inspecting whether deviations from a straight line are systematic, and checking whether estimates are imprecise because some categories contain little information. In an NLME analysis, observed response summaries alone may not reveal the parameter pattern: response depends on the structural model, other covariates, dosing, sampling, and random effects. Use model-based parameter or response diagnostics appropriate to the fitted model.
A trend can also be misleading if it is extrapolated beyond observed categories, if a category score is miscoded, or if the effect changes direction across levels. A linear identity-scale trend can imply impossible values outside the observed score range, such as negative clearance. A log-scale trend guarantees positive parameter values but still imposes a constant ratio per score point. Neither coding resolves confounding, sparse data, or misspecification elsewhere in the NLME model.
Record the ordered levels and the numeric score assigned to each; do not assume ordinal labels imply equal spacing.
State whether the trend is additive in the parameter, additive in its log, or linear on another chosen transformed scale.
Calculate each typical value and relevant contrast, then check units and whether the implied pattern is scientifically plausible.
Ask whether the category effects plausibly follow the imposed straight line; use indicator coding when unrestricted category-specific effects are needed.
Check Your Understanding
Answer the questions, then compare your work with the solutions.
- For scores 0, 1, and 2, what does an identity-scale slope of 0.30 units per score point imply for the contrast between scores 0 and 2?
- A log-scale trend has \(\beta_1=\log(1.10)\). What is the multiplicative change for a three-point score increase?
- With four equally spaced categories, how many fixed-effect coefficients are used by reference-cell indicator coding and by a one-slope trend model, including the intercept?
- For scores 0, 1, and 2, indicator effects on the modeled scale are \(\gamma_2=-0.20\) and \(\gamma_3=-0.50\). Can a one-slope trend represent both exactly? Explain.
- Why is it not enough to say that numeric coding is appropriate simply because category labels are ordered?
Solutions. (1) The contrast is \(0.30(2-0)=0.60\) units; the typical value at score 2 is 0.60 units above that at score 0. (2) The ratio is \(\exp(3\beta_1)=\exp(3\log(1.10))=1.10^3=1.331\), a 33.1% increase relative to the score-0 value. (3) Indicator coding uses \(1+(4-1)=4\) coefficients; trend coding uses 2, an intercept and a slope. (4) No. Matching category 2 requires \(\beta_1=-0.20\), which predicts \(\gamma_3=2\beta_1=-0.40\), not \(-0.50\). (5) Numeric trend coding additionally assumes equal score increments and a straight-line effect on the specified parameter scale; ordering alone does not justify those assumptions.