Tutorials › Bioavailability and Bioequivalence › Fixed and Random Effects in Crossover Models

Log-Scale Analysis and ANOVA · Tutorial 183 of 399

Fixed and Random Effects in Crossover Models

See how fixed and random effect choices determine what a crossover model estimates and to which population its conclusions can apply.

Intermediate 10 min read

What You'll Learn

  • Distinguish fixed effects from random effects by the inferential target.
  • Identify conventional classifications for treatment, period, sequence, and subject in a two-period crossover.
  • Interpret treatment contrasts and their exponentiated exposure ratios with the correct direction.
  • Derive how subject and period effects cancel in a balanced crossover contrast.
  • Explain how treating formulations or subjects differently changes the model's meaning.
  • Recognize assumptions and warning signs that make a classification inappropriate.

Why Effect Classification Matters

A crossover model separates systematic differences associated with treatments, periods, and assigned sequences from variation among subjects and their repeated measurements. Calling a term fixed or random is not merely a software setting: it specifies what kinds of effects the analysis is trying to estimate and what population the conclusions concern. In a bioavailability or bioequivalence comparison, this distinction is especially important because the two formulations under comparison are usually specific products, while the study subjects are intended to represent a wider population.

The earlier material on subjects nested within sequence introduces the subject-level term in a crossover model. Here, the emphasis is on why that term—and the treatment, period, and sequence terms—are classified as fixed or random, and how an alternative classification changes the question being answered.

Definition: A fixed effect represents a systematic effect for the particular levels included in the study. The model estimates those level effects or contrasts without treating the observed levels as a random sample from a wider population of levels. A random effect represents variation among levels viewed as sampled from a population of possible levels. The model describes that variation with a probability distribution, typically through a variance component.

These labels concern the model's target, not whether something was physically randomized. For example, sequence may be randomly assigned to subjects in the design, yet sequence is commonly included as a fixed effect because the two sequence patterns in a two-period study are specific design levels, not a sample from a population of possible sequences. Conversely, subjects are commonly random because the observed participants are understood as a sample from a broader population of interest.

A Conventional Two-Period Crossover Model

Let \(Y_{ijk}\) be the log-transformed pharmacokinetic endpoint for subject \(j\) in sequence \(i\) during period \(k\), where \(i\) identifies sequence, \(j\) identifies a subject within that sequence, and \(k\) identifies period. Let \(\ell(i,k)\) denote the treatment received by that sequence in that period. A conventional additive model is

$$ Y_{ijk}=\mu+S_i+P_k+T_{\ell(i,k)}+b_{j(i)}+\varepsilon_{ijk}. $$

Here, \(\mu\) is an overall mean; \(S_i\), \(P_k\), and \(T_{\ell(i,k)}\) are sequence, period, and treatment effects; \(b_{j(i)}\) is the effect of subject \(j\) nested in sequence \(i\); and \(\varepsilon_{ijk}\) is the remaining observation-level variation. A common coding uses sum-to-zero constraints for the fixed effects, such as \(T_T+T_R=0\), so that the treatment contrast is \(T_T-T_R\). The choice of reference coding changes individual coefficient values, but not the fitted treatment contrast.

In the usual interpretation for this setting, treatment, period, and sequence are fixed, while subject nested within sequence is random. One simple distributional specification is \(b_{j(i)}\sim N(0,\sigma_b^2)\) and \(\varepsilon_{ijk}\sim N(0,\sigma^2)\), with subject effects independent of residuals and residuals independent across observations. This specification assumes a common subject-level variance and a common residual variance, no treatment-by-period interaction, and no additional carryover term. The additive model is a useful starting point only when those assumptions are reasonable for the design and data.

Model termUsual classificationWhat the classification targets
TreatmentFixedThe contrast between the named formulations used in the study
PeriodFixedThe difference between the particular study periods
SequenceFixedDifferences between the particular treatment orders in the design
Subject nested within sequenceRandomVariation among subjects sampled from a target population
ResidualRandomObservation-level variation not explained by the included model terms

The fixed effects describe the levels that matter directly to the study question. Treatment is typically fixed because the goal is to compare the specific test and reference formulations, not to infer an average treatment effect over a hypothetical population of formulations. Period is fixed because period 1 and period 2 are the defined occasions in this study. Sequence is fixed because the treatment orders are design categories. Subjects, by contrast, are typically treated as random because the aim is not limited to the particular people enrolled.

Worked Example: Interpreting Components in the Model

Suppose a hypothetical study uses the two sequences \(TR\) and \(RT\), where \(T\) is test and \(R\) is reference. Consider illustrative model component values, all in log-endpoint units: \(\mu=4.60\), \(S_{TR}=0.03\), \(S_{RT}=-0.03\), \(P_1=0.02\), \(P_2=-0.02\), \(T_T=-0.04\), \(T_R=0.04\), and a particular subject's random effect \(b_{j(TR)}=0.10\). Let the residual for each observation below be \(-0.02\). These are hypothetical model values, not results from an actual study.

For this subject in sequence \(TR\), the period 1 treatment is \(T\). The model-predicted log endpoint for that observation is

$$ 4.60+0.03+0.02-0.04+0.10-0.02=4.69. $$

In period 2, the subject receives \(R\). The corresponding prediction is

$$ 4.60+0.03-0.02+0.04+0.10-0.02=4.73. $$

The sequence and subject components are the same in the two observations because they belong to the same subject and sequence. The period and treatment components differ. The fixed contrast \(T_R-T_T=0.04-(-0.04)=0.08\) log units is reference minus test. Its exponential, \(\exp(0.08)\approx1.083\), is a reference-to-test ratio. In the opposite direction, the test-to-reference ratio is \(\exp(T_T-T_R)=\exp(-0.08)\approx0.9231\). The sign and direction must be stated whenever a contrast is back-transformed.

What Cancels in the Treatment Contrast?

A simple derivation shows why subject-level effects are central to crossover comparisons. Suppose the two sequences are \(TR\) and \(RT\), with period effects \(P_1\) and \(P_2\). Subtract a subject's period 1 result from the period 2 result in sequence \(TR\). The subject effect and sequence effect occur in both observations and cancel:

$$ D_{TR}=Y_{ij2}-Y_{ij1} =(T_R-T_T)+(P_2-P_1)+(\varepsilon_{ij2}-\varepsilon_{ij1}). $$

For sequence \(RT\), define the within-subject contrast in the direction reference minus test, period 1 minus period 2. Again, the subject and sequence effects cancel, while the period contrast reverses:

$$ D_{RT}=Y_{ij1}-Y_{ij2} =(T_R-T_T)-(P_2-P_1)+(\varepsilon_{ij1}-\varepsilon_{ij2}). $$

If the two sequences contribute equally, averaging their mean contrasts removes the period difference:

$$ \frac{\bar{D}_{TR}+\bar{D}_{RT}}{2} =(T_R-T_T)+\frac{1}{2n}\left[\sum_{j=1}^{n}(\varepsilon_{TR,j,2}-\varepsilon_{TR,j,1})+\sum_{j=1}^{n}(\varepsilon_{RT,j,1}-\varepsilon_{RT,j,2})\right]. $$

This cancellation explains the role of the crossover: each subject receives both treatments, so stable subject-level differences do not enter that subject's treatment contrast. The derivation depends on the additive model and the comparison's balanced sequence contributions. It is not a license to ignore design imbalance, missing observations, or departures from the model; those issues require an analysis that accounts for the actual data structure.

Worked Example: Combining Contrasts Across Sequences

Consider four hypothetical subjects with complete log-endpoint observations. For each subject, calculate reference minus test, choosing the subtraction order so that the period effect has the same sign convention within each sequence:

SequenceSubjectWithin-subject contrast, reference minus test (log units)
TRA0.14
TRB0.06
RTC0.12
RTD-0.04

The mean contrast in sequence \(TR\) is

$$ \bar{D}_{TR}=\frac{0.14+0.06}{2}=0.10. $$

The mean contrast in sequence \(RT\) is

$$ \bar{D}_{RT}=\frac{0.12+(-0.04)}{2}=0.04. $$

With equal numbers in the two sequences, the equally weighted combined contrast is

$$ \widehat{T_R-T_T}=\frac{0.10+0.04}{2}=0.07\text{ log units}. $$

The corresponding test-to-reference ratio is in the opposite direction:

$$ \exp(\widehat{T_T-T_R})=\exp(-0.07)\approx0.9324. $$

Thus, for these hypothetical observations, the estimated test-to-reference geometric-mean ratio is about 0.9324. This calculation illustrates the contrast's direction and the balanced cancellation of the period effect; by itself it does not provide a standard error, confidence interval, or bioequivalence conclusion.

How Alternative Classifications Change the Question

A variable is not inherently fixed or random in every conceivable analysis. Its classification follows from the population and effects of interest. Changing the classification can change the model's interpretation even if the data table is unchanged.

Worked Example: Fixed Formulations Versus Random Formulations

In a hypothetical bioequivalence study, the formulations are one named test product and one named reference product. Treating treatment as fixed gives a direct contrast \(T_T-T_R\), which targets the difference between those products. If that contrast is \(-0.07\) log units, exponentiating gives a test-to-reference ratio of \(\exp(-0.07)\approx0.9324\). That statement is about the named products.

Now consider a different hypothetical research question: four formulations, sampled from a defined population of possible formulations, are included to estimate how much treatment effects vary across that population. A random-treatment model would represent formulation deviations as draws from a distribution with mean zero and variance \(\tau^2\). For illustration, suppose four estimated deviations, centered at zero, are \(-0.06,\ 0.01,\ 0.03,\ 0.02\) log units. Their sample variance as a simple descriptive summary is

$$ s^2=\frac{(-0.06)^2+(0.01)^2+(0.03)^2+(0.02)^2}{4-1} =\frac{0.0050}{3}=0.001667\text{ log units}^2. $$

This descriptive calculation shows dispersion among these four values; it is not, on its own, an estimate of a model's \(\tau^2\), because it does not account for estimation uncertainty. More importantly, the random-formulation question concerns variation across a population of formulations, not the specific test-versus-reference contrast. That is generally not the target of a standard bioequivalence comparison.

The same reasoning applies to subject classification. A fixed-subject model represents the enrolled subjects with separate subject effects and conditions on those particular subjects. It can still estimate a treatment contrast when each subject receives both treatments, but it does not model subjects as draws from a population or estimate a between-subject variance component in the same way. A random-subject model instead represents a population distribution of subject effects, supporting a population-oriented interpretation under its assumptions.

Sequence classification also needs a target-based rationale. The two sequences \(TR\) and \(RT\) are the specific orderings used by the design. Treating them as fixed gives a contrast between these observed sequence categories. A random-sequence term would instead assert that the design sequences represent draws from some broader population of possible sequences. With only the planned sequence levels, that broader population may not have a meaningful scientific definition. Random allocation of subjects to sequences does not by itself justify a random sequence effect.

Period is usually fixed for the same reason: period 1 and period 2 are the specific occasions being compared. Treating periods as random would change the target to variability over a population of possible periods. That may be sensible in some repeated-time settings, but it is not the conventional interpretation of the two prespecified periods in a standard crossover.

Assumptions, Diagnostics, and Limitations

Effect classification is only one part of model specification. The conventional model also assumes the fixed effects represent the systematic structure adequately and that the random components follow the stated distributional and independence assumptions. In particular, a subject random intercept alone describes shared subject-level shifts; it does not automatically represent every possible pattern of within-subject association. Nor does an additive model allow the treatment contrast to change across periods.

Warning signs include subject patterns that are not well represented by a common subject-level shift, substantially different residual spread across treatments or periods, or a treatment pattern that appears to change by period. An absent or incomplete observation can also disrupt the simple balanced contrast derivation above. Such signs do not prove a particular alternative model is correct, but they indicate that the assumed classification or model structure needs scrutiny rather than automatic acceptance.

A central limitation is that a fixed-versus-random choice cannot be settled by a test statistic alone. It should be made from the scientific target and design, then assessed alongside the model's assumptions. In standard bioequivalence analysis, named formulations are fixed, prespecified periods and sequences are fixed, and sampled subjects are random. Alternative choices can be valid for different questions, but their estimates should not be described as though they answer the standard named-product comparison.

Common Mistake

  • Wrong reasoning: “Sequence was randomly assigned, so sequence must be a random effect.” Random assignment describes how subjects enter design groups; it does not define the population of levels represented by a model term.
  • Correction: Decide whether the sequence levels are the specific design categories of interest or a sample from a meaningful population of possible sequences. For the usual two-period crossover, sequence is generally fixed, while subjects are random because participants represent a target population.
  • Wrong reasoning: “The model's treatment contrast is reference minus test, so exponentiating it gives the test-to-reference ratio.”
  • Correction: A contrast \(T_R-T_T\) exponentiates to the reference-to-test ratio. The test-to-reference ratio is \(\exp(T_T-T_R)=\exp[-(T_R-T_T)]\).
Key takeaway: Fixed effects describe the particular treatment, period, and sequence levels in the study; random effects describe variation among sampled levels, commonly subjects. Choose the classification to match the scientific target, and state the contrast direction before interpreting an exponentiated estimate.

Check Your Understanding

Answer each question, then compare with the brief solutions below.

  1. In the conventional two-period model, which term is usually random: treatment, period, sequence, or subject nested within sequence? Why?
  2. A fitted contrast is \(T_T-T_R=0.05\) log units. What is the test-to-reference ratio, approximately?
  3. Why does a subject's additive random effect cancel from a within-subject treatment contrast?
  4. What population-level question is implied by treating treatment as random?

Solutions. (1) Subject nested within sequence is usually random because enrolled subjects are treated as a sample from a target population; treatment, period, and sequence are usually fixed study levels. (2) The test-to-reference ratio is \(\exp(0.05)\approx1.051\). (3) The same subject effect is added to both of that subject's period observations, so subtraction gives \(b_{j(i)}-b_{j(i)}=0\). (4) Random treatment implies that the observed treatment levels represent a sample from a defined population of possible treatments, and the model targets variation across that population rather than only a contrast between named formulations.

Clinical Biostats