Tutorials › Bioavailability and Bioequivalence › Separating Within- and Between-Subject Variability

Log-Scale Analysis and ANOVA · Tutorial 192 of 399

Separating Within- and Between-Subject Variability

Use repeated log-scale measurements to distinguish subject-to-subject variation from residual variation within a subject, and interpret the resulting variance components.

Intermediate 11 min read

What You'll Learn

  • Specify a random-intercept model for repeated log-scale crossover observations.
  • Explain the assumptions needed to separate between- and within-subject variance.
  • Derive the relationship between marginal variance, within-subject differences, and the variance components.
  • Calculate simple balanced-design estimates of within- and between-subject variance.
  • Interpret variance components, intraclass correlation, and lognormal coefficients of variation.
  • Recognize when model assumptions make the component estimates misleading.

Why Separate the Two Sources of Variation?

Repeated pharmacokinetic measurements vary for more than one reason. Some subjects tend to have consistently higher or lower log exposures than others. In addition, measurements from the same subject vary across occasions, even after systematic treatment and period differences are accounted for. These are distinct sources of variation: one is between subjects, and the other is within subjects.

A replicate crossover design can observe a subject receiving the same formulation more than once. That replication supplies information about occasion-to-occasion variation within a person, while differences in subjects’ average levels supply information about stable between-subject variation. The distinction matters because a marginal spread across all observations combines both sources; it does not, by itself, reveal how much belongs to either one.

The model below concerns a positive pharmacokinetic endpoint analyzed on the log scale, such as AUC or Cmax. Treatments and periods can have systematic effects, so they must be represented in the mean structure before variation is attributed to random components. The subject-specific random intercept is the focus here; estimating fixed period effects is a separate task.

Random-Intercept Model and Assumptions

Definition: Let \(Y_{ij}\) be the log-transformed endpoint for subject \(i\) at occasion \(j\). A random-intercept model is $$ Y_{ij} = \boldsymbol{x}_{ij}^{\mathsf T}\boldsymbol{\beta} + b_i + \varepsilon_{ij}, $$ where \(\boldsymbol{x}_{ij}^{\mathsf T}\boldsymbol{\beta}\) represents the fixed design and treatment effects, \(b_i\) is the subject-specific random intercept, and \(\varepsilon_{ij}\) is the residual for that observation. The model assumes \(b_i \sim N(0,\sigma_b^2)\), \(\varepsilon_{ij} \sim N(0,\sigma_w^2)\), and independence of all residuals from one another and from the random intercepts. Here \(\sigma_b^2\) is the between-subject variance and \(\sigma_w^2\) is the residual within-subject variance, both on the log scale.

The fixed-effects part should account for the systematic design factors included in the analysis, such as treatment and period, as well as sequence where appropriate. Subjects are nested within their assigned sequence in a crossover design; the random intercept describes subject-to-subject variation after the fixed mean structure is accounted for. The subject effects are assumed to come from a common distribution with mean zero and variance \(\sigma_b^2\).

The common residual variance assumption means that observations have the same residual variance across the modeled occasions and formulations. The independent residual assumption means that, conditional on the subject intercept and fixed effects, one occasion’s residual does not predict another’s. These are substantive modeling assumptions, not automatic consequences of using a mixed model. The design must also contain repeated observations on subjects, and the fixed-effect structure must be identifiable from the observed treatment and period pattern.

On the log scale, an individual subject’s intercept is a stable shift in expected log exposure relative to the population mean structure. The residual captures departures around that subject-specific level. It can include biological occasion-to-occasion variation and measurement variation; it should not be described as pure assay error unless the design isolates assay error specifically.

How the Components Are Distinguished

After accounting for fixed effects, write the remaining observation as \(Z_{ij}=b_i+\varepsilon_{ij}\). The marginal variance of one observation combines the two independent components. Two different occasions from the same subject share the same \(b_i\), but have independent residuals. These facts provide two ways to see why replication is informative.

$$ \begin{aligned} \operatorname{Var}(Z_{ij}) &= \sigma_b^2+\sigma_w^2,\\ \operatorname{Cov}(Z_{ij},Z_{ik}) &= \sigma_b^2 \quad (j\ne k),\\ \operatorname{Var}(Z_{ij}-Z_{ik}) &= 2\sigma_w^2 \quad (j\ne k). \end{aligned} $$

The covariance result follows because both observations contain the same random intercept, while their independent residuals contribute no covariance. In the within-subject difference, the common intercept cancels. Thus, under the assumptions, repeated measurements carry information about the residual variance through their differences, while shared movement across occasions carries information about the between-subject variance.

A simple method-of-moments calculation makes this distinction explicit in a balanced setting. Suppose there are \(n\) subjects, each with \(m\) observations, and the fixed effects have been removed so that the residualized observations follow \(Z_{ij}=b_i+\varepsilon_{ij}\). Define the between-subject mean square from subject means and the within-subject mean square from deviations around each subject’s mean. Their expected values are:

$$ E(MS_W)=\sigma_w^2,\qquad E(MS_B)=\sigma_w^2+m\sigma_b^2. $$

The within mean square estimates residual variance. The between mean square contains residual variance too, because each subject mean averages only a finite number of residuals. Subtracting the within mean square removes that contribution; dividing by the number of observations per subject yields the between-subject variance estimate.

1
Estimate the within component.
Set \(\widehat{\sigma}_w^2=MS_W\), since \(E(MS_W)=\sigma_w^2\) under the balanced random-intercept model.
2
Remove the within contribution from the between mean square.
Since \(E(MS_B)=\sigma_w^2+m\sigma_b^2\), the expected difference is \(m\sigma_b^2\).
3
Scale to the per-subject variance.
The method-of-moments estimate is \(\widehat{\sigma}_b^2=(MS_B-MS_W)/m\). In an unbalanced or more complex design, the simple mean-square formula need not apply; mixed-model estimation accounts for the actual design.

This derivation also explains a limitation of the simple estimator: sampling variation can make \(MS_B-MS_W\) negative even though a variance cannot be negative. A constrained variance-component fit, such as restricted maximum likelihood (REML), imposes the nonnegative parameter space and uses the design’s full likelihood structure. In a balanced case where the estimate is positive, the simple calculation is useful for understanding what information identifies each component.

Worked Example: Estimating Components From Balanced Mean Squares

Suppose a hypothetical replicate crossover has 8 subjects with 2 adjusted log-endpoint observations per subject. After fixed design effects are accounted for, the within-subject mean square is \(MS_W=0.0036\) and the between-subject mean square is \(MS_B=0.0180\). Use the balanced method-of-moments formulas.

There are \(m=2\) observations per subject. First, the estimated within-subject variance is $$ \widehat{\sigma}_w^2=MS_W=0.0036. $$

Then the estimated between-subject variance is $$ \widehat{\sigma}_b^2=\frac{MS_B-MS_W}{m} =\frac{0.0180-0.0036}{2} =\frac{0.0144}{2} =0.0072. $$

Both estimates are nonnegative, so this calculation is not in conflict with the variance parameter constraints. The corresponding log-scale standard deviations are \(\sqrt{0.0036}=0.0600\) within subjects and \(\sqrt{0.0072}=0.0849\) between subjects. These are standard deviations in log units, not percentage-point differences in the original endpoint.

The estimated marginal variance of one adjusted observation is the sum: $$ \widehat{\sigma}_b^2+\widehat{\sigma}_w^2 =0.0072+0.0036=0.0108. $$ Its log-scale standard deviation is \(\sqrt{0.0108}=0.1039\). This total spread alone would not identify the two sources; the repeated observations and their within-subject structure are what permit the separation.

Interpreting Variance on the Log Scale

Variance components are additive on the modeled log scale. They are not percentages, and a larger variance component means greater dispersion on that scale. For a normally distributed log effect with variance \(\sigma^2\), exponentiating the effect gives a lognormal multiplicative factor. A commonly used coefficient-of-variation conversion for that factor is \(\sqrt{\exp(\sigma^2)-1}\), expressed as a proportion. This conversion describes the variability associated with a particular log-scale component under the normality model; it does not turn the variance itself into a percentage.

Worked Example: Converting the Components to Relative Variation

Use the hypothetical variance estimates \(\widehat{\sigma}_w^2=0.0036\) and \(\widehat{\sigma}_b^2=0.0072\) from the previous calculation. The within-subject lognormal coefficient of variation is $$ \sqrt{\exp(0.0036)-1} =\sqrt{1.003606-1} =\sqrt{0.003606} =0.06005, $$ or approximately \(6.01\%\).

The between-subject coefficient of variation on the same lognormal basis is $$ \sqrt{\exp(0.0072)-1} =\sqrt{1.007226-1} =\sqrt{0.007226} =0.08501, $$ or approximately \(8.50\%\). These summaries express relative variability associated with each component, not a treatment difference and not a confidence interval. Their interpretation relies on the normal random-effects model on the log scale.

The same components also determine the correlation between two adjusted observations from the same subject at different occasions. Under the random-intercept assumptions, this correlation is the intraclass correlation:

$$ \rho=\frac{\sigma_b^2}{\sigma_b^2+\sigma_w^2}. $$

It is the fraction of the marginal variance attributable to stable between-subject differences, and also the model-implied correlation for two distinct occasions from the same subject after fixed effects are removed. It is not the proportion of subjects who have a particular property, nor is it a measure of treatment agreement by itself.

Worked Example: Interpreting the Intraclass Correlation

For the hypothetical estimates above, calculate the model-implied within-subject correlation: $$ \widehat{\rho} =\frac{0.0072}{0.0072+0.0036} =\frac{0.0072}{0.0108} =0.6667. $$

Under the fitted random-intercept model, two different adjusted log-endpoint observations from the same subject have estimated correlation about \(0.667\). This relatively high value indicates that stable differences among subjects account for a substantial share of marginal variation. It does not mean that 66.7% of the endpoint is between-subject variation; it is a ratio of variances and has no endpoint units.

Diagnostics, Alternatives, and Limits

Component estimates are meaningful only to the extent that the model’s assumptions and design are adequate. Examine the study layout first: if subjects do not have repeated observations, within-subject variation cannot be separated from subject-level variation by this random-intercept structure alone. Then consider whether treatment, period, and sequence terms in the fixed mean structure are appropriate. A systematic mean pattern left unmodeled can be mistaken for residual variation or can distort the estimated components.

After fitting, inspect subject-level patterns and residuals on the log scale. Residual spread that changes across treatments or occasions, serial dependence beyond the shared intercept, or conspicuous departures from the assumed distribution can make a single common \(\sigma_w^2\) inadequate. A random-intercept model also assumes subjects differ by a stable additive shift on the log scale. If subjects’ treatment responses vary systematically, that simple structure may not represent the dependence fully. Diagnostics can reveal warning signs, but they do not prove the assumptions.

The main alternative summaries answer different questions. A marginal standard deviation combines between- and within-subject variation and is useful for overall dispersion, but cannot attribute that dispersion to its source. A within-subject difference or paired contrast removes a common subject intercept and targets within-subject variation for the compared observations, but does not by itself estimate the population’s between-subject variance. A mixed model uses both shared subject-level patterns and within-subject deviations, and can accommodate incomplete or unbalanced observations under its assumptions. Its flexibility does not make misspecification harmless.

In an unbalanced crossover or one with missing occasions, the balanced mean-square calculation is generally not the appropriate estimator. REML or another suitable mixed-model method uses the available design information to estimate variance components. Such estimates can still be imprecise, especially with few subjects or few repeated observations. A boundary estimate of zero for a variance component may reflect limited information as well as a genuinely small component; it should not be interpreted as proof that the source of variation is absent.

Common Mistake

Common mistake: Treating the standard deviation across every log observation as the within-subject standard deviation. That overall spread includes both stable subject differences and occasion-level residual variation. Under the random-intercept model, the marginal variance is \(\sigma_b^2+\sigma_w^2\). The within-subject component is identified from variation around subject-specific levels, while the shared pattern across repeated observations informs the between-subject component.

A related error is to call \(\sigma_b^2\) “variability in treatment response.” A random intercept describes stable subject-level variation common across modeled occasions. Treatment-response heterogeneity would require a different random-effects structure and a design capable of identifying it.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions.

  1. In a random-intercept model, what does the subject-specific random intercept represent, and what does the residual represent?
  2. For two different occasions from the same subject, write the model-implied covariance and explain why it has that value.
  3. In a balanced design with \(m=3\), \(MS_W=0.0040\), and \(MS_B=0.0190\), calculate the method-of-moments estimates of both variance components.
  4. If \(\widehat{\sigma}_b^2=0.006\) and \(\widehat{\sigma}_w^2=0.004\), calculate the intraclass correlation and interpret it.
  5. Why can an unmodeled systematic period pattern make a variance-component interpretation less trustworthy?

Solutions. (1) The random intercept represents stable between-subject deviation on the log scale; the residual represents occasion-level deviation after the fixed effects and subject intercept are accounted for. (2) The covariance is \(\sigma_b^2\), because the observations share \(b_i\), while their independent residuals have zero covariance. (3) \(\widehat{\sigma}_w^2=MS_W=0.0040\), and \(\widehat{\sigma}_b^2=(0.0190-0.0040)/3=0.0050\). (4) \(\widehat{\rho}=0.006/(0.006+0.004)=0.600\). The fitted model attributes 60.0% of the marginal log-scale variance to stable subject differences; this is also the modeled correlation between two distinct adjusted observations from one subject. (5) If the mean structure omits systematic differences across periods, those patterns can be left in the residuals and affect the estimated variation. The residual would then no longer represent only the intended within-subject deviations under the stated model.