Tutorials › Pharmacokinetic-Pharmacodynamic (PK/PD) Modeling › Separating Within- and Between-Subject Covariate Effects

Time-Varying Covariates and Dosing History · Tutorial 495 of 598

Separating Within- and Between-Subject Covariate Effects

You will learn how to center time-varying covariates and interpret distinct within-subject and between-subject effects in PK/PD models.

Advanced 11 min read

What You'll Learn

  • Define a subject-level covariate mean and a within-subject deviation.
  • Distinguish within-subject and between-subject covariate associations.
  • Derive the decomposition of pooled regression variation into within- and between-subject components.
  • Specify separate effects for a PK/PD parameter on a log scale.
  • Interpret model coefficients as conditional associations with clear units.
  • Identify weak within-subject information, collinearity, and other diagnostic concerns.

Why Separate Within- and Between-Subject Effects?

A covariate measured repeatedly can vary in two ways: it can differ from one subject to another, and it can change over time within a subject. Those sources of variation do not necessarily have the same relationship with a PK/PD parameter. For example, a subject whose body weight is higher than another subject’s may differ in physiology or disease status, while a temporary increase in one subject’s weight may reflect a different process. Treating both contrasts as one effect can conceal that distinction.

The decomposition in this tutorial is a way to represent these two associations separately. It does not, by itself, establish a causal effect. The interpretation depends on the parameter model, the covariate’s measurement and timing, the subjects and records included, and the assumptions used to estimate the model.

Definition: Let \(x_{ij}\) be a time-varying covariate for subject \(i\) at record \(j\), with \(n_i\) included records for that subject. The subject-level mean is \(\bar{x}_i = \frac{1}{n_i}\sum_{j=1}^{n_i} x_{ij}\). The within-subject deviation is \(x_{ij}-\bar{x}_i\). The deviation describes how the covariate at a particular record differs from that subject’s mean; \(\bar{x}_i\) describes the subject’s average covariate level over the records used to define it.

The mean must be defined for the analysis in question. A record-weighted mean gives equal weight to each included record, so subjects with more records contribute more to the overall record-level mean. A subject-level mean gives equal weight to each subject when averaging subject means. These summaries answer different questions. The window and records used to calculate each \(\bar{x}_i\) should be stated, especially when observation schedules differ.

Two Effects in a Parameter Model

A common specification lets the covariate affect a PK/PD parameter through both its deviation from the subject mean and the subject mean itself. For a positive parameter \(\theta_{ij}\), one possible log-linear model is:

$$ \log(\theta_{ij}) = \log(\theta_{\mathrm{ref}}) + \beta_W(x_{ij}-\bar{x}_i) + \beta_B(\bar{x}_i-x_{\mathrm{ref}}) + \eta_i $$

Here, \(\theta_{\mathrm{ref}}\) is the parameter value at the reference covariate level for a subject whose random effect is zero; \(x_{\mathrm{ref}}\) is the reference for the subject mean. The coefficient \(\beta_W\) describes the association with a change in the covariate relative to that same subject’s mean, holding the subject mean fixed. The coefficient \(\beta_B\) describes the association with a difference in subject means, comparing subjects at the same within-subject deviation. The term \(\eta_i\) represents subject-level random variability in the parameter under the chosen model.

If \(x\) is measured in kilograms, each coefficient has units of inverse kilograms on the log scale. A covariate rescaled in 10-kilogram units instead has coefficients per 10 kilograms. For a one-unit increase in the relevant contrast, the parameter is multiplied by \(\exp(\beta_W)\) or \(\exp(\beta_B)\), respectively. The directions and magnitudes of the two effects need not match.

Interpretation: A within-subject coefficient is not the same as a between-subject coefficient. The former concerns a subject’s departure from their own mean; the latter concerns differences among subjects’ means. Both are conditional model associations, not automatic evidence of causation.

In a nonlinear mixed-effects model, these covariate terms enter the specified individual parameter, and the resulting parameter enters the PK or PD model. Estimation uses the model’s likelihood and random-effects structure, rather than treating each parameter value as directly observed. The usual assumptions of that model still matter: for example, the random-effects distribution and residual-error model must be adequate, and the likelihood must represent the observation process appropriately. The decomposition itself does not ensure those assumptions.

Why the Pooled Association Can Differ

The distinction can be seen directly in a simple linear regression with an intercept. Suppose the outcome \(y_{ij}\) is regressed on \(x_{ij}\), and define \(\bar{x}\) and \(\bar{y}\) as means across all records. The total cross-product can be split into a within-subject part and a between-subject part:

$$ \sum_i\sum_j (x_{ij}-\bar{x})(y_{ij}-\bar{y}) = \sum_i\sum_j (x_{ij}-\bar{x}_i)(y_{ij}-\bar{y}_i) + \sum_i n_i(\bar{x}_i-\bar{x})(\bar{y}_i-\bar{y}) $$

To justify the identity, write \(x_{ij}-\bar{x}=(x_{ij}-\bar{x}_i)+(\bar{x}_i-\bar{x})\), and write the corresponding decomposition for \(y\). Multiplying gives four terms. The sum of each within-subject deviation is zero: \(\sum_j(x_{ij}-\bar{x}_i)=0\) and \(\sum_j(y_{ij}-\bar{y}_i)=0\). Therefore, both cross-terms sum to zero, leaving the within and between terms shown. The same decomposition applies to the total sum of squares of \(x\).

Thus, the pooled least-squares slope combines within- and between-subject information, with weights determined by their covariate sums of squares. It is not generally the simple average of the two slopes. If the slopes differ, the pooled slope can represent neither contrast well. This algebra is useful for understanding the risk; it is not a substitute for fitting the PK/PD model that represents the outcome and parameter structure.

Worked Example: Calculate the Within and Between Slopes

Consider a small, hypothetical data set for a continuous outcome \(y\) and covariate \(x\). These five records are used only to demonstrate the decomposition.

Subject\(x\) records\(y\) records\(\bar{x}_i\)\(\bar{y}_i\)
A10, 122, 4113
B14, 16, 185, 5, 91619/3

The record-level means are \(\bar{x}=(10+12+14+16+18)/5=14\) and \(\bar{y}=(2+4+5+5+9)/5=25/5=5\). For subject A, the within-subject \(x\) sum of squares is \((-1)^2+1^2=2\), and its within-subject cross-product is \((-1)(-1)+(1)(1)=2\). For subject B, the \(x\) deviations are \(-2,0,2\), and the \(y\) deviations are \(-4/3,-4/3,8/3\). Therefore, B’s within-subject \(x\) sum of squares is \(4+0+4=8\), and its cross-product is \((-2)(-4/3)+(0)(-4/3)+(2)(8/3)=8\).

The within-subject slope is consequently \((2+8)/(2+8)=10/10=1.000\). For the between-subject part, subject A’s mean deviations from the record-level means are \(-3\) for \(x\) and \(-2\) for \(y\); subject B’s are \(2\) and \(4/3\). The between-subject cross-product is \(2(-3)(-2)+3(2)(4/3)=12+8=20\). The between-subject \(x\) sum of squares is \(2(-3)^2+3(2)^2=18+12=30\), giving a between-subject slope of \(20/30=0.6667\).

The total cross-product is \(10+20=30\), and the total \(x\) sum of squares is \(10+30=40\). The pooled slope is \(30/40=0.7500\). Here it lies between the within and between slopes, with more weight from the between-subject variation. It is not equal to either distinct association.

Specifying and Interpreting the Model in Practice

For a PK parameter such as clearance, it is often useful to model the logarithm because the parameter must be positive and a log-linear covariate relationship gives multiplicative effects. The example below uses a covariate expressed in units of 10 kilograms above a 70-kilogram reference. Estimates are hypothetical.

Worked Example: Interpret Separate Clearance Effects

Suppose a fitted model for clearance has \(\theta_{\mathrm{ref}}=5.00\) L/h, \(\beta_W=-0.0800\) per 10 kg, and \(\beta_B=-0.0300\) per 10 kg. Consider the model with \(\eta_i=0\). For a 10-kg increase above a subject’s own mean, with the subject mean held at the reference, the clearance ratio is:

$$ \frac{\theta_{\mathrm{new}}}{\theta_{\mathrm{old}}} = \exp(\beta_W \times 1) = \exp(-0.0800) = 0.9231 $$

The model therefore associates that within-subject increase with clearance about \(1-0.9231=0.0769\), or 7.69%, lower, conditional on the model. For a 10-kg higher subject mean, at the same within-subject deviation, the corresponding between-subject ratio is:

$$ \exp(\beta_B \times 1) = \exp(-0.0300) = 0.9704 $$

That is about 2.96% lower clearance per 10-kg difference in the subject mean. If both contrasts increase by one unit, the model gives \(5.00\exp(-0.0800-0.0300)=5.00\exp(-0.1100)=4.479\) L/h. This value follows from the specified reference and random effect; it is not a separate estimate of either coefficient. Neither association alone establishes that changing an individual’s weight would cause the modeled change in clearance.

The time-varying covariate must be available at the records where the parameter model requires it, and the subject mean must correspond to a clearly defined analysis window. If a covariate is constant within every subject, its within-subject deviation is always zero, so the data contain no information for estimating \(\beta_W\). If each subject has only one included record, the same problem occurs. Conversely, if subjects have little between-subject variation in their means, \(\beta_B\) may be weakly informed.

Estimation Checks, Alternatives, and Limitations

A separate-effect model requires enough information in both dimensions. Before interpreting estimates, examine the number and timing of records per subject, the distribution of within-subject deviations, the spread of subject means, and the relationship between the two constructed covariates. Check whether estimates are imprecise or unstable, whether standard errors are large, and whether changing the defined analysis window materially changes subject means or estimates. Assess model fit using diagnostics appropriate to the PK/PD model, including residual patterns and predictions across subjects and covariate ranges.

A common alternative is to use a single covariate term \(x_{ij}\). This is more parsimonious and can be reasonable if the scientific question supports a common association or the data cannot identify two effects. But it constrains the within- and between-subject associations to be the same on the model scale. The decomposed model relaxes that constraint, at the cost of estimating an additional effect and requiring sufficient within- and between-subject variation. A model with subject-specific random slopes is another possible extension, but it requires enough repeated information and a suitable random-effects structure; it is not a replacement for defining the mean and deviation clearly.

The decomposition has limitations. A subject mean calculated from observed records can depend on the observation schedule, and sparse records may represent a subject’s underlying average poorly. Covariate measurement error can distort the constructed terms. Unmeasured subject characteristics can also be associated with both the subject mean and the PK/PD parameter. Including a subject mean can help represent between-subject structure, but does not automatically remove confounding or guarantee that random effects are independent of the covariates.

  • Pitfall: treating the pooled coefficient as a within-subject effect. A pooled regression uses both within- and between-subject variation. Its slope can be a weighted mixture, as the worked calculation shows.
  • Pitfall: calling a within-subject deviation the original covariate. A deviation of zero means the record equals that subject’s defined mean; it does not mean the covariate itself is zero.
  • Pitfall: interpreting \(\beta_B\) as a within-person response. The between-subject coefficient compares subject means. It does not describe what would happen if one person’s covariate changed.
  • Pitfall: assuming centering solves confounding. The decomposition separates contrasts in the model; causal interpretation still requires appropriate design and assumptions.
Key takeaway: Include both \(x_{ij}-\bar{x}_i\) and \(\bar{x}_i-x_{\mathrm{ref}}\) when the scientific question and data support distinct within- and between-subject associations. State how each mean is defined, interpret the coefficients separately, and check that the data contain variation to estimate both.

Check Your Understanding

Answer each question, then compare with the solutions below.

  1. Subject C has covariate values 6, 8, and 10. What is the subject mean and the within-subject deviation for the second record?
  2. If a subject’s covariate is constant across all included records, what can the data identify about the within-subject coefficient?
  3. A log-parameter model has a between-subject coefficient of \(0.05\) per covariate unit. What parameter ratio corresponds to a 2-unit difference in subject means, at the same within-subject deviation?
  4. Why might a pooled slope fail to represent either the within-subject or the between-subject association?

Solutions. (1) The mean is \((6+8+10)/3=8\), and the second-record deviation is \(8-8=0\). (2) Every within-subject deviation is zero, so these records provide no information about the within-subject coefficient. (3) The ratio is \(\exp(0.05\times2)=\exp(0.10)=1.105\), or about 10.5% higher. (4) A pooled slope combines within- and between-subject cross-products and sums of squares; when the distinct slopes differ, the pooled result can be a weighted mixture rather than either association.

Clinical Biostats