Introduction
Longitudinal clinical studies repeatedly measure an outcome for the same participants over time. Examples include blood pressure, forced expiratory volume, disease activity scores, tumor measurements, cognitive scores, biomarkers, and patient-reported outcomes.
A fundamental question is not simply whether the outcome changes, but how it changes over time.
A linear model assumes that the average change is described adequately by a constant slope. That assumption can be reasonable over a limited follow-up period, but many clinical processes do not evolve at a constant rate.
A treatment may produce a rapid initial response followed by a plateau. A biomarker may fall rapidly and then stabilize. A disease score may improve slowly at first, change rapidly during the middle of follow-up, and then level off.
These patterns are examples of non-linear trajectories.
What Does "Non-Linear Over Time" Mean?
Suppose the outcome for participant \(i\) at time \(t\) is \(Y_i(t)\). A simple linear trajectory is:
The parameter \(\beta_1\) represents the average change per unit increase in time.
The important feature is that the slope is constant.
A non-linear trajectory allows the rate of change to vary with time:
where \(f(t)\) is not constant.
For example, the treatment effect might be largest shortly after treatment initiation and progressively diminish later.
Why a Linear Time Effect Can Be Inadequate
Consider a hypothetical clinical trial in which a symptom score is measured at baseline and at Weeks 2, 4, 8, 12, and 24. Suppose the mean trajectory is approximately:
| Week | Mean Change from Baseline |
|---|---|
| 0 | 0.0 |
| 2 | -4.5 |
| 4 | -7.5 |
| 8 | -10.0 |
| 12 | -10.8 |
| 24 | -11.1 |
The treatment appears to have a rapid early effect followed by a plateau.
A single straight line through these observations would force the early and late changes to be summarized by one average slope.
That may obscure the clinically important feature of the data: the rate of improvement decreases over time.
First Principle: Look at the Data
Before selecting a complicated model, examine the observed trajectories.
Useful plots include:
- Individual subject profiles
- Mean outcome by visit
- Mean change from baseline by visit
- Mean treatment-group trajectories
- Spaghetti plots with an overlaid mean trajectory
- Observed-versus-fitted plots
- Residuals versus time
A trajectory model should be motivated by the pattern of the data and the scientific question, not simply by the availability of a sophisticated statistical method.
Common Shapes of Longitudinal Trajectories
| Pattern | Typical Shape | Potential Model |
|---|---|---|
| Constant change | Straight line | Linear time |
| Accelerating change | Increasing curvature | Quadratic or spline |
| Decelerating change | Rapid early change, then plateau | Quadratic, spline, exponential |
| Early change followed by stable period | Two distinct slopes | Piecewise model |
| Irregular visit pattern | Flexible smooth curve | Spline |
| Distinct visit-specific effects | No assumed shape | Categorical time |
| Asymptotic response | Approaches a limit | Nonlinear mechanistic model |
Approach 1: Categorical Time
The simplest flexible alternative to linear time is to treat visit as a categorical variable.
Instead of assuming:
we allow every scheduled visit to have its own mean:
where the indicator variables represent the scheduled visits.
This approach makes almost no assumption about the shape of the trajectory.
Why Categorical Time Is So Flexible
Suppose measurements occur at Weeks 0, 2, 4, 8, 12, and 24. A categorical-time model can estimate:
- The mean at Week 2
- The mean at Week 4
- The mean at Week 8
- The mean at Week 12
- The mean at Week 24
without requiring the trajectory to be linear, quadratic, or otherwise smooth.
The disadvantage is that categorical time does not provide a compact mathematical description of the underlying curve.
Approach 2: Polynomial Time
A common way to introduce curvature is to add powers of time. A quadratic model is:
The first derivative is:
Therefore, the slope changes with time.
If \(\beta_2<0\), the trajectory is concave downward. If \(\beta_2>0\), the trajectory is concave upward.
Quadratic Example
Suppose the fitted model is:
The instantaneous slope is:
At \(t=0\), the slope is \(-4\). At \(t=5\), the slope is:
Thus, the outcome is decreasing rapidly initially, but the rate of decrease becomes progressively smaller.
This is a useful model for a trajectory that improves rapidly and then begins to plateau.
Centering Time
Polynomial models can become difficult to interpret when time is large. Suppose follow-up extends to 52 weeks. Using \(t\) and \(t^2\) directly can produce large numerical values.
One solution is to center time:
where \(t_0\) is a clinically meaningful reference point.
For example:
means that \(t_c=0\) corresponds to Week 12.
Polynomial Models Beyond Quadratic
A cubic model is:
Higher-order polynomials can represent increasingly complicated curves. However, adding polynomial terms indiscriminately is usually not a good strategy.
High-degree polynomials can produce unstable behavior, particularly near the boundaries of the observed time range.
Approach 3: Piecewise Linear Models
A piecewise linear model is useful when the trajectory has different rates of change during distinct periods.
Suppose treatment response changes rapidly during the first 8 weeks and then levels off. We can define:
and:
Then:
Here \(\beta_1\) represents the slope before the knot at Week 8, while \(\beta_2\) represents the additional change in slope after Week 8.
Interpreting a Piecewise Model
Suppose:
Before Week 8, the slope is:
After Week 8, the total slope becomes:
If instead the coefficient for \(t_2\) were \(+1.5\), the post-Week-8 slope would become:
That would describe rapid early improvement followed by a much flatter trajectory.
Approach 4: Restricted Cubic Splines
Splines provide a flexible way to model non-linear time effects without requiring the entire trajectory to be described by one polynomial.
A spline divides the time range into regions connected by smooth polynomial functions.
A general spline model can be written as:
where \(B_j(t)\) are spline basis functions.
The coefficients themselves are usually not clinically intuitive. Instead, the fitted curve and predicted differences at clinically relevant times are interpreted.
Why Splines Are Powerful
A spline can capture patterns such as:
- Rapid early improvement
- A middle-period acceleration
- A plateau
- A gradual late decline
- Several changes in slope
without requiring the analyst to specify one exact mathematical shape.
This flexibility is especially useful when there is no obvious biological reason to select a quadratic or piecewise model.
Splines Require Restraint
More flexibility is not automatically better.
A spline with too many degrees of freedom can follow random fluctuations rather than the underlying clinical trajectory.
The resulting model may have:
- Unstable estimates
- Excessive curvature
- Poor interpretability
- Overfitting
- Unstable predictions near the boundaries
Knots in a Spline Model
A knot is a location at which the polynomial pieces of a spline join. For example, if follow-up ranges from 0 to 24 weeks, knots might be placed near clinically important periods such as Weeks 4, 8, and 16.
The exact knot strategy depends on the type of spline and software implementation.
Common approaches include:
- Clinically specified knots
- Quantile-based knots
- Prespecified default knot locations
The key requirement is that the choice be defensible and reproducible.
Mixed-Effects Models and Non-Linear Time
Longitudinal data contain repeated observations from the same participants. Those observations are correlated. A mixed-effects model accounts for this by including subject-specific random effects.
A linear mixed model might be written:
where:
- \(Y_{ij}\) is the outcome for participant \(i\) at visit \(j\).
- \(\beta_0\) is the population-average intercept.
- \(\beta_1\) is the population-average time slope.
- \(b_{0i}\) is the participant-specific random intercept.
- \(b_{1i}\) is the participant-specific random slope.
- \(\varepsilon_{ij}\) is the residual error.
The important point is that the fixed-effect representation of time can be made non-linear while retaining the mixed-effects structure.
Quadratic Mixed-Effects Model
For example:
The population-average trajectory is quadratic, while participants are allowed to have different intercepts and linear rates of change.
The model can be extended to include a random quadratic component, although this requires substantially more information and may be difficult to estimate reliably.
Random Effects Do Not Automatically Make the Trajectory Non-Linear
This distinction is important. A model with a random intercept and random slope:
still assumes that each participant follows a linear trajectory.
The participants can have different starting levels and different slopes, but each individual trajectory is still a straight line.
Adding Treatment to a Non-Linear Time Model
Suppose a randomized trial compares treatment \(A\) with control \(C\). A quadratic trajectory model might be:
where \(T_i=1\) for treatment and \(T_i=0\) for control.
The treatment-by-time terms allow the treatment groups to have different trajectory shapes.
Why the Treatment-by-Time Interaction Matters
Suppose treatment produces faster early improvement but the groups become similar later. A simple treatment main effect would not adequately describe that pattern.
The interaction:
allows the treatment effect to vary over time.
For a quadratic model, this can involve:
and:
The resulting treatment difference is a function of time rather than a single constant number.
Treatment Effect as a Function of Time
For the quadratic model above, the treatment-control difference at time \(t\) is:
This is often much more clinically informative than interpreting \(\beta_3\), \(\beta_4\), and \(\beta_5\) separately.
The analyst can estimate \(\Delta(t)\) at clinically meaningful visits such as Weeks 4, 8, 12, and 24.
Non-Linear Trajectory Does Not Mean Non-Linear Treatment Effect
These concepts should not be confused. A study may have a non-linear outcome trajectory in both groups while the treatment difference remains approximately constant.
For example:
Both trajectories are non-linear, but:
is constant.
Therefore, a non-linear time trend does not automatically imply a time-varying treatment effect.
Visit as a Categorical Variable in Clinical Trials
In many confirmatory clinical trials, scheduled visit is treated as categorical rather than continuous.
This is often particularly attractive when:
- Visits are irregularly spaced.
- The primary comparison is defined at a specific endpoint visit.
- The shape of the trajectory is not itself scientifically important.
- There is no compelling reason to assume a particular mathematical form.
- The number of scheduled visits is moderate.
For example, Week 12 and Week 24 can have independent effects without assuming that the difference between Weeks 12 and 24 follows the same rate of change as earlier intervals.
Continuous Time vs. Categorical Time
| Feature | Continuous Time | Categorical Time |
|---|---|---|
| Assumes functional form | Yes | No specific shape |
| Handles irregular observation times | Yes | Less naturally |
| Easy visit-specific estimates | Requires prediction | Yes |
| Compact trajectory description | Yes | No |
| Can model smooth curves | Yes | No |
| Interpretability | Depends on parameterization | Usually straightforward |
Handling Irregular Measurement Times
One major advantage of continuous-time modeling is that time can be represented using the actual measurement time rather than merely the scheduled visit.
Suppose participants have observations at:
- Day 0
- Day 13
- Day 29
- Day 57
- Day 91
A continuous-time model can use the actual day value.
Categorical visit coding would treat observations according to visit labels, which may be preferable when the estimand is explicitly visit based.
Example: Rapid Early Response Followed by Plateau
Consider a clinical outcome measured over 24 weeks. The observed group means suggest:
| Week | Observed Mean Change |
|---|---|
| 0 | 0.0 |
| 2 | -3.8 |
| 4 | -6.9 |
| 8 | -9.4 |
| 12 | -10.2 |
| 24 | -10.5 |
A linear model might estimate an average slope of approximately:
But that does not mean the treatment changes the outcome by 0.44 units every week.
The actual trajectory suggests much faster change during the first several weeks.
A quadratic or spline model can represent this changing rate.
Comparing Candidate Models
| Model | Strength | Limitation |
|---|---|---|
| Linear | Simple and interpretable | Cannot represent curvature |
| Quadratic | Simple curvature | Can behave poorly at boundaries |
| Cubic | More flexible polynomial | Potential instability |
| Categorical visit | Highly flexible and visit-specific | Less parsimonious |
| Piecewise linear | Clinically interpretable slope changes | Requires knot selection |
| Restricted cubic spline | Flexible smooth trajectory | Less intuitive coefficients |
Model Selection Should Not Be Based Only on P-Values
Suppose a quadratic term has a p-value of 0.03. That does not automatically mean the quadratic model is the correct clinical model.
Likewise, a non-significant quadratic term does not prove that the true trajectory is linear.
Model selection should consider:
- Scientific plausibility
- Graphical fit
- Residual behavior
- Clinical interpretability
- Prespecified analysis strategy
- Stability of estimates
- Model complexity
- Ability to estimate the desired treatment effect
Residual Diagnostics
Residual plots are particularly useful for identifying an inappropriate time specification.
For a linear model, plot residuals against time.
If residuals display a systematic pattern such as:
- Positive residuals early
- Negative residuals in the middle
- Positive residuals late
then the fitted line may be missing curvature.
A successful non-linear model should reduce systematic structure in the residuals.
Observed vs. Fitted Trajectories
A particularly useful diagnostic is to overlay:
- Observed mean values
- Linear fitted trajectory
- Quadratic fitted trajectory
- Spline fitted trajectory
This allows investigators to determine whether increased model complexity actually provides a meaningful improvement in the trajectory.
Mixed Model Covariance and Non-Linear Time Are Different Decisions
Two separate modeling decisions are sometimes confused.
The first is the mean trajectory:
The second concerns the within-subject covariance:
A non-linear mean trajectory does not determine the appropriate covariance structure.
For example, a study might use:
- A quadratic mean trajectory
- Random intercepts and slopes
- An unstructured residual covariance
or:
- A spline mean trajectory
- Random intercepts
- AR(1) residual covariance
These are separate components of the longitudinal model.
R: Linear Mixed Model
A basic linear mixed model can be fitted using
lmer() from the lme4
package.
library(lme4)
fit_linear <- lmer(
change ~ week + treatment + week:treatment +
(1 + week | subject),
data = dat
)
summary(fit_linear)
This model allows:
- A linear population-average time trend
- A treatment effect
- A treatment-by-time interaction
- Subject-specific random intercepts
- Subject-specific random slopes
R: Quadratic Mixed Model
To allow curvature:
fit_quad <- lmer(
change ~ week + I(week^2) +
treatment +
week:treatment +
I(week^2):treatment +
(1 + week | subject),
data = dat
)
summary(fit_quad)
The fixed-effect component now allows each treatment group to have a quadratic trajectory.
Centering Time in R
dat$week_c <- dat$week - 12
fit_quad <- lmer(
change ~ week_c + I(week_c^2) +
treatment +
week_c:treatment +
I(week_c^2):treatment +
(1 + week_c | subject),
data = dat
)
Here, zero corresponds to Week 12. The intercept therefore has a more clinically meaningful interpretation.
R: Categorical Visit
dat$visit <- factor(dat$visit)
fit_visit <- lmer(
change ~ visit * treatment +
(1 | subject),
data = dat
)
summary(fit_visit)
This model estimates treatment differences separately across visits without requiring a linear or polynomial trajectory.
R: Natural Cubic Splines
The splines package provides a convenient way to
fit natural cubic splines.
library(splines)
fit_spline <- lmer(
change ~ ns(week, knots = c(4, 8, 16)) *
treatment +
(1 | subject),
data = dat
)
summary(fit_spline)
The treatment interaction allows the trajectory to differ between groups.
R: Estimated Treatment Differences
For a flexible model, one useful approach is to estimate marginal means at specific times.
library(emmeans)
emm <- emmeans(
fit_spline,
~ treatment | week,
at = list(
week = c(2, 4, 8, 12, 24)
)
)
pairs(emm)
This produces treatment comparisons at clinically meaningful time points.
SAS: Linear Mixed Model
In SAS, the standard procedure for many linear mixed-effects longitudinal
models is PROC MIXED.
proc mixed data=dat;
class subject treatment;
model change =
week
treatment
week*treatment
/ solution ddfm=kr;
random intercept week
/ subject=subject
type=un;
run;
This specifies random intercepts and random slopes with an unstructured covariance matrix for the random effects.
SAS: Quadratic Time
data dat2;
set dat;
week_c = week - 12;
week_c2 = week_c * week_c;
run;
proc mixed data=dat2;
class subject treatment;
model change =
week_c
week_c2
treatment
week_c*treatment
week_c2*treatment
/ solution ddfm=kr;
random intercept week_c
/ subject=subject
type=un;
run;
The centered quadratic model allows the average trajectory to curve over time while retaining participant-specific random intercepts and slopes.
SAS: Categorical Visit
proc mixed data=dat;
class subject treatment visit;
model change =
visit
treatment
visit*treatment
/ solution ddfm=kr;
random intercept
/ subject=subject;
run;
This approach is often very useful when the primary estimand is defined at specific scheduled visits.
SAS: Spline Basis Variables
SAS can generate spline basis variables using procedures such as
PROC TRANSREG, or analysts can construct basis
variables using appropriate spline functions and then fit those variables in
PROC MIXED.
A conceptual workflow is:
/* Generate or define spline basis variables first */
proc mixed data=dat_spline;
class subject treatment;
model change =
spline1
spline2
spline3
treatment
spline1*treatment
spline2*treatment
spline3*treatment
/ solution ddfm=kr;
random intercept
/ subject=subject;
run;
The exact basis construction should be aligned with the prespecified spline method and knot locations.
Piecewise Models in R
A piecewise model can be constructed explicitly.
dat$week_early <- pmin(dat$week, 8)
dat$week_late <- pmax(dat$week - 8, 0)
fit_piecewise <- lmer(
change ~ week_early +
week_late +
treatment +
week_early:treatment +
week_late:treatment +
(1 + week_early | subject),
data = dat
)
summary(fit_piecewise)
The coefficient for week_early describes the early
slope.
The coefficient for week_late represents the
change in slope after the Week 8 knot.
Piecewise Models in Clinical Interpretation
Suppose the early slope is \(-1.5\) units per week and the post-knot slope is \(-0.2\).
The clinical interpretation is not simply that the outcome changes at \(-0.2\) after Week 8. Rather:
- Before Week 8, the estimated rate of change is \(-1.5\) units per week.
- After Week 8, the trajectory becomes much flatter.
This can be much easier to communicate than a high-dimensional spline model.
Non-Linear Trajectories and Baseline Adjustment
Clinical longitudinal models often adjust for baseline outcome. Suppose \(Y_{i0}\) is baseline and \(Y_{ij}\) is a post-baseline measurement. A model can include baseline as a covariate:
The exact parameterization depends on the estimand and analysis strategy.
Baseline adjustment should not be confused with the decision about whether time is linear or non-linear.
Non-Linearity Can Be Different by Treatment Group
One of the most important questions is whether the treatment groups have the same trajectory shape.
A model without a treatment-by-time interaction assumes that treatment shifts the trajectory without changing its shape.
A model with treatment-by-time interaction allows the treatment effect to change over time.
For a general function \(f(t)\):
where \(g(t)\) represents the time-varying component of the treatment effect.
What If the Trajectory Is Exponential?
Some biological processes naturally suggest exponential behavior. A simple exponential decay model is:
where:
- \(A\) is the asymptotic level.
- \(B\) describes the initial displacement from that level.
- \(k\) controls the rate of decay.
This can be appropriate when the underlying scientific mechanism strongly supports exponential behavior.
However, such models are more restrictive than splines and can require nonlinear estimation.
Mechanistic vs. Statistical Non-Linearity
There are two broad reasons to use a non-linear trajectory model.
Statistical flexibility
The objective is to describe the observed trajectory without imposing an unnecessary shape. Splines are often useful here.
Mechanistic modeling
The objective is to represent a biological or pharmacological mechanism. Examples include:
- Exponential decay
- Logistic growth
- Emax models
- Compartmental models
- Indirect-response models
Mechanistic models are especially important in pharmacokinetics, pharmacodynamics, and quantitative systems pharmacology.
Modeling a Plateau
A plateau is one of the most common clinical trajectory patterns. A simple quadratic model can approximate a plateau over a limited follow-up period.
But if the asymptotic behavior is scientifically important, a model with an explicit asymptote may be preferable.
For example:
The trajectory approaches \(A+B\) as \(t\) increases.
The advantage is mechanistic interpretability. The disadvantage is that the model imposes a specific functional form.
Don't Overinterpret the Quadratic Coefficient
Suppose a quadratic mixed model estimates:
It is tempting to say: "The treatment has a negative quadratic effect of 0.04."
That is usually not the most useful clinical interpretation.
Instead, calculate predicted outcomes or treatment contrasts across time. For example:
| Week | Estimated Treatment Difference | 95% CI |
|---|---|---|
| 4 | -4.1 | -6.2 to -2.0 |
| 8 | -7.3 | -9.6 to -5.0 |
| 12 | -8.5 | -10.8 to -6.2 |
| 24 | -8.7 | -11.2 to -6.2 |
This directly communicates how the treatment effect evolves over time.
Non-Linearity and Missing Data
Longitudinal studies frequently contain missing measurements. A flexible trajectory model does not automatically solve missing-data problems.
Investigators should consider:
- Why observations are missing
- The assumed missing-data mechanism
- Whether the likelihood-based model is appropriate
- Sensitivity analyses
- Pattern-mixture or selection models when appropriate
Under a missing-at-random assumption, mixed models estimated by maximum likelihood can use incomplete longitudinal records without requiring last-observation-carried-forward imputation.
Non-Linearity and Unequal Follow-Up
Participants may have different numbers of observations. One participant might have measurements through Week 24, while another might withdraw at Week 12.
Mixed-effects models can naturally accommodate different numbers of observations per participant under their assumed missing-data framework.
This is one reason mixed models are widely used for longitudinal clinical data.
Non-Linearity and Unequally Spaced Visits
Unequally spaced visits create another reason to think carefully about the time variable.
Suppose visits occur at Days 1, 7, 28, 84, and 168. Treating visit number as:
implicitly assumes equal spacing.
Using actual time:
preserves the actual temporal distances.
Which approach is appropriate depends on whether the scientific estimand is visit-based or time-based.
A Practical Model Selection Workflow
How to Choose Among the Main Approaches
| Situation | Preferred Starting Point |
|---|---|
| Only a few scheduled visits | Categorical time |
| Clearly curved trajectory | Quadratic model |
| Rapid early change then plateau | Piecewise or spline model |
| Known clinical transition point | Piecewise model |
| Unknown smooth shape | Restricted cubic spline |
| Strong biological mechanism | Mechanistic non-linear model |
| Primary estimand at Week 12 | Visit-specific contrast |
Common Mistakes
- Assuming every longitudinal trajectory is linear. Many clinical outcomes have rapid early changes followed by stabilization.
- Adding polynomial terms without examining the data. A quadratic term should have a scientific or empirical rationale.
- Using a high-degree polynomial to fit every fluctuation. This can produce unstable and poorly interpretable trajectories.
- Confusing random slopes with non-linear trajectories. Random slopes allow subjects to have different linear rates; they do not create curvature.
- Interpreting spline coefficients directly. Spline basis coefficients are usually not clinically intuitive.
- Choosing knots solely because they improve a p-value. Knot selection should be scientifically and statistically defensible.
- Ignoring treatment-by-time interaction. If treatment effects evolve differently over time, a common trajectory may be inadequate.
- Focusing only on the time-term p-value. The clinical question is often better answered using estimated treatment differences at relevant times.
- Confusing mean trajectory with covariance structure. These are separate components of a longitudinal model.
- Using actual time automatically. Actual elapsed time is not always the appropriate estimand when the analysis is explicitly visit based.
- Assuming a flexible model solves missing-data problems. The missing-data mechanism still requires consideration.
- Overfitting the trajectory. More flexibility does not necessarily produce a better clinical model.
A Detailed Example: Linear vs. Quadratic vs. Spline
Suppose a randomized clinical trial measures change from baseline through Week 24. The investigator fits three models.
| Model | AIC | Trajectory Description |
|---|---|---|
| Linear | 2,410 | Constant slope |
| Quadratic | 2,350 | Early change followed by flattening |
| Restricted cubic spline | 2,342 | Flexible smooth curve |
The spline has the smallest AIC, but that does not automatically mean it should be selected.
The quadratic model may be preferable if:
- Its fitted trajectory is nearly identical to the spline.
- The quadratic shape is clinically plausible.
- The parameters are easier to communicate.
- The prespecified analysis plan favors a parsimonious model.
Conversely, the spline may be preferable if the quadratic model systematically misses clinically important changes in slope.
Comparing Trajectories at Specific Times
For a flexible trajectory model, investigators often want estimates at a set of clinically important times. For example:
At each time, estimate:
and its confidence interval.
This transforms a complicated trajectory model into clinically interpretable results.
Plotting the Estimated Trajectory
A publication-quality longitudinal analysis should usually include a plot of the estimated trajectories.
A useful figure can show:
- Observed group means
- Model-based predicted means
- 95% confidence intervals
- Time on the horizontal axis
- Outcome or change from baseline on the vertical axis
The figure often communicates the non-linear pattern more effectively than a table of regression coefficients.
Trajectory Modeling and the Estimand
Before selecting a model, define what quantity the study is trying to estimate. Possible estimands include:
- Treatment difference at Week 12
- Treatment difference at Week 24
- Average treatment difference across follow-up
- Difference in slopes
- Difference in trajectory shape
- Time to maximum treatment response
- Area under the outcome trajectory
Different estimands can lead to different preferred models.
When Categorical Time Is the Better Choice
Categorical time is often underestimated because it is statistically simple.
Suppose the trial's primary objective is the treatment difference at Week 12. If measurements occur at six scheduled visits, categorical visit can provide direct estimates at each visit without imposing an artificial curve.
This is particularly useful in confirmatory clinical trials where scheduled visits and prespecified contrasts are central to the analysis.
When a Continuous Non-Linear Time Model Is Better
Continuous non-linear time is especially useful when:
- The actual timing of observations varies.
- The trajectory itself is scientifically important.
- The study contains many observation times.
- A smooth response curve is desired.
- There is interest in estimating changes between scheduled visits.
- A biologically meaningful functional form exists.
Non-Linear Time and Random Slopes
Suppose the population trajectory is quadratic. It may still be reasonable to allow participants to have different linear rates of change:
This model says:
- The population trajectory is curved.
- Participants vary in baseline level.
- Participants vary in their linear rate of change.
- The curvature is shared through the fixed-effect structure.
That can be a sensible compromise when there are insufficient data to support subject-specific curvature.
Should You Add a Random Quadratic Effect?
In principle, a model could include:
so that each participant has an individual quadratic component.
But this substantially increases model complexity.
The data must support estimation of:
- Random intercept variance
- Random slope variance
- Random quadratic variance
- Covariance between these random effects
With limited numbers of observations per participant, this can lead to singular fits or unstable covariance estimates.
Model Convergence Matters
Flexible longitudinal models can encounter computational problems. Common warnings include:
- Non-convergence
- Singular covariance matrices
- Boundary estimates
- Very large standard errors
- Highly correlated parameters
These are not merely technical annoyances. They can indicate that the proposed model is too complex for the available data.
A simpler, stable model is often preferable to a theoretically richer model that cannot be estimated reliably.
Centering and Scaling for Polynomial Models
Suppose time ranges from 0 to 365 days. Using:
produces values as large as:
Centering and scaling can improve numerical behavior. For example:
now expresses time approximately in months relative to Day 180.
The exact transformation should be chosen so that coefficients and predictions remain interpretable.
Reporting a Non-Linear Longitudinal Analysis
A statistical report should explain:
- Why a non-linear trajectory was considered
- How time was parameterized
- Whether time was centered or scaled
- How knots were selected if splines were used
- Whether treatment-by-time interactions were included
- The random-effects specification
- The residual covariance structure
- The method used for estimation
- How missing observations were handled
- Which time points were used for treatment contrasts
Example Statistical Methods Language
A concise methods description might state:
For a spline model, the corresponding description would specify the spline type and knot locations.
What to Include in a Statistical Analysis Plan
For an important longitudinal analysis, the SAP should specify:
- Outcome definition
- Baseline definition
- Scheduled visits
- Time scale
- Primary estimand
- Fixed effects
- Time parameterization
- Treatment-by-time interaction
- Random effects
- Covariance structure
- Estimation method
- Degrees-of-freedom method where applicable
- Missing-data assumptions
- Planned contrasts
- Confidence interval method
- Graphical displays
- Sensitivity analyses
Sensitivity Analyses
When the trajectory is uncertain, sensitivity analyses can compare reasonable alternative specifications. For example:
- Categorical visit
- Linear time
- Quadratic time
- Piecewise linear time
- Restricted cubic spline
The goal is not to select whichever model gives the most favorable treatment result.
Instead, the purpose is to assess whether the substantive conclusion is robust to plausible trajectory assumptions.
Avoiding Data-Driven Model Shopping
Suppose an analyst tries:
- Linear time
- Quadratic time
- Cubic time
- Four-knot spline
- Five-knot spline
- Piecewise model with three knots
and then selects the model with the smallest p-value for treatment.
This can introduce substantial bias.
Model flexibility should be justified independently of the observed treatment result whenever possible.
Non-Linear Trajectories in Regulatory Clinical Trials
In a regulatory clinical-trial setting, the model should be chosen to support a clearly defined estimand.
A highly flexible trajectory can be useful for understanding the longitudinal profile, but the primary efficacy conclusion may still be based on a prespecified visit-specific contrast.
This is an important distinction:
The trajectory model is a statistical tool used to estimate the desired clinical quantity.
A Complete Decision Framework
| Question | Recommended Consideration |
|---|---|
| Are there only a few scheduled visits? | Consider categorical visit |
| Is the trajectory approximately straight? | Linear time may be sufficient |
| Is there simple curvature? | Consider quadratic time |
| Is there a meaningful change point? | Consider piecewise linear time |
| Is the trajectory smooth but unknown? | Consider restricted cubic splines |
| Is there a biological mechanism? | Consider a mechanistic non-linear model |
| Do treatment effects change over time? | Include treatment-by-time terms |
| Do subjects differ in rate of change? | Consider random slopes |
| Are residual correlations substantial? | Evaluate covariance structure separately |
| Is the model unstable? | Reduce complexity |
The Most Important Distinction: Shape vs. Heterogeneity
Longitudinal modeling involves at least two distinct sources of complexity.
The first is trajectory shape:
which determines whether the average response is linear, curved, piecewise, smooth, or otherwise non-linear.
The second is between-subject heterogeneity:
which describes how participants differ from one another.
A strong longitudinal model addresses both without confusing them.
A Practical Example of the Distinction
Imagine two patients:
| Week | Patient A | Patient B |
|---|---|---|
| 0 | 50 | 65 |
| 4 | 43 | 57 |
| 8 | 39 | 51 |
| 12 | 38 | 49 |
| 24 | 37 | 48 |
Both patients show a curved trajectory. They also differ substantially in baseline level.
A useful model may therefore need:
- A non-linear fixed time effect to describe curvature
- A random intercept to describe baseline heterogeneity
- Possibly a random slope to describe differences in rate of change
These are complementary rather than competing ideas.
Recommended Default Strategy
There is no universal best model, but a practical strategy for many longitudinal clinical analyses is:
Summary Comparison
| Method | Flexibility | Interpretability | Best Use |
|---|---|---|---|
| Linear | Low | High | Approximately constant rate of change |
| Quadratic | Moderate | Moderate | Simple curvature |
| Piecewise linear | Moderate | High | Known change points |
| Categorical visit | High | High at specific visits | Visit-specific clinical inference |
| Restricted cubic spline | High | Moderate | Unknown smooth trajectory |
| Mechanistic non-linear | Variable | Potentially very high | Strong biological model |
Key Takeaways
Non-linear longitudinal trajectories are common in clinical research. A linear time effect is convenient, but it should not be used automatically when the underlying trajectory clearly changes slope.
Several approaches are available:
- Categorical time avoids imposing a functional form.
- Quadratic models provide a simple representation of curvature.
- Piecewise models are useful when slope changes occur at meaningful time points.
- Splines provide flexible smooth trajectories.
- Mechanistic models are appropriate when biological knowledge supports a specific functional form.
These approaches can all be embedded within a mixed-effects framework.
The most important conceptual distinction is that non-linear time effects describe trajectory shape, while random effects describe between-subject heterogeneity.
References
Fitzmaurice, G.M., Laird, N.M. & Ware, J.H. (2011).
Applied Longitudinal Analysis, 2nd ed.
Wiley.
Verbeke, G. & Molenberghs, G. (2000).
Linear Mixed Models for Longitudinal Data.
Springer.
Pinheiro, J.C. & Bates, D.M. (2000).
Mixed-Effects Models in S and S-PLUS.
Springer.
Harrell, F.E. (2015).
Regression Modeling Strategies, 2nd ed.
Springer.
Ruppert, D., Wand, M.P. & Carroll, R.J. (2003).
Semiparametric Regression.
Cambridge University Press.
Diggle, P., Heagerty, P., Liang, K.-Y. & Zeger, S. (2002).
Analysis of Longitudinal Data, 2nd ed.
Oxford University Press.
Little, R.J.A., et al. (2012).
The prevention and treatment of missing data in clinical trials.
New England Journal of Medicine, 367, 1355–1360.