Tutorials › Biostatistics › Covariance Structure Selection in Longitudinal Models

Longitudinal Data & Mixed Models

Covariance Structure Selection in Longitudinal Models

A practical guide to choosing covariance structures for longitudinal mixed models, including compound symmetry, autoregressive, heterogeneous, unstructured, Toeplitz, and spatial structures, with guidance on ML versus REML, AIC and BIC, convergence, clinical interpretation, and R and SAS implementation.

Advanced 18 min read

What You'll Learn

  • Why covariance structure matters in longitudinal mixed models
  • How CS, AR(1), CSH, UN, Toeplitz, and spatial structures differ
  • How AIC, BIC, likelihood, and convergence are used in model selection
  • When ML should be used instead of REML for covariance comparison
  • How covariance selection affects standard errors and inference
  • How to implement and evaluate covariance structures in R and SAS

Introduction

Longitudinal clinical trials collect repeated measurements from the same participant over time. A patient may have a baseline measurement followed by assessments at Week 2, Week 4, Week 8, Week 12, and later visits.

These observations are not independent.

Measurements from the same patient tend to be correlated because they share the patient's underlying biological characteristics, treatment response, disease trajectory, and measurement environment.

A longitudinal mixed model therefore needs to describe not only the expected mean trajectory but also the covariance among repeated observations within a subject.

Key idea: The fixed-effects portion of a longitudinal model describes the mean response, while the covariance structure describes how repeated observations around that mean are related to one another.

Covariance structure selection is therefore not a cosmetic modeling decision. It determines how the model represents within-subject dependence and can affect standard errors, degrees of freedom, confidence intervals, test statistics, and conclusions about treatment effects.

The General Longitudinal Mixed Model

A common linear mixed model can be written as:

\[ \mathbf{y}_i = \mathbf{X}_i\boldsymbol{\beta} + \mathbf{Z}_i\mathbf{b}_i + \boldsymbol{\epsilon}_i \]

where:

  • \(\mathbf{y}_i\) is the vector of repeated observations for subject \(i\).
  • \(\mathbf{X}_i\boldsymbol{\beta}\) represents the fixed-effects mean structure.
  • \(\mathbf{Z}_i\mathbf{b}_i\) represents subject-specific random effects, if included.
  • \(\boldsymbol{\epsilon}_i\) represents residual variation.

The marginal covariance matrix of the repeated observations is:

\[ \operatorname{Var}(\mathbf{y}_i) = \mathbf{Z}_i\mathbf{G}\mathbf{Z}_i^{\prime} + \mathbf{R}_i \]

The matrix \(\mathbf{R}_i\) describes the residual covariance structure after accounting for the random effects.

Important distinction: A random-intercept model and an explicitly specified residual covariance structure are not interchangeable. A random intercept induces correlation between repeated measurements, while the residual covariance structure describes the remaining within-subject dependence.

Why Covariance Structure Matters

Suppose a patient has measurements:

Visit Measurement
Baseline 52
Week 4 55
Week 8 61
Week 12 65

The four observations provide four pieces of information, but they do not represent four independent patients.

If the correlation between measurements is ignored, the model can incorrectly estimate the amount of independent information contained in the data.

Covariance structure selection attempts to answer questions such as:

  • Are all visits equally correlated?
  • Does correlation decline as the time between visits increases?
  • Does residual variability increase over time?
  • Should each pair of visits have its own covariance?
  • Are observations closer in time more strongly correlated?

The Covariance Matrix

For four repeated measurements, the covariance matrix might be written as:

\[ \mathbf{R}_i = \begin{pmatrix} \sigma_1^2 & \sigma_{12} & \sigma_{13} & \sigma_{14}\\ \sigma_{12} & \sigma_2^2 & \sigma_{23} & \sigma_{24}\\ \sigma_{13} & \sigma_{23} & \sigma_3^2 & \sigma_{34}\\ \sigma_{14} & \sigma_{24} & \sigma_{34} & \sigma_4^2 \end{pmatrix} \]

The diagonal elements are variances.

The off-diagonal elements are covariances.

A correlation matrix instead standardizes the covariance terms:

\[ \rho_{jk} = \frac{\sigma_{jk}}{\sigma_j\sigma_k} \]

Different covariance structures impose different patterns on these variances and correlations.

The Most Common Covariance Structures

The most commonly encountered structures in clinical longitudinal analyses include:

Structure Main Assumption Number of Covariance Parameters
Compound symmetry (CS) Common variance and common correlation 2
AR(1) Correlation declines geometrically with lag 2
Heterogeneous CS (CSH) Visit-specific variances, common correlation \(m+1\)
Heterogeneous AR(1) Visit-specific variances with AR-type correlation \(2m\)
Toeplitz Correlation depends on lag \(m\)
Unstructured (UN) Every variance and covariance estimated freely \(m(m+1)/2\)
Spatial / continuous-time Dependence determined by actual time separation Depends on structure

Here \(m\) denotes the number of repeated measurements.

Compound Symmetry

Compound symmetry, or CS, assumes that every measurement has the same variance and every pair of measurements has the same correlation.

For four visits:

\[ \mathbf{R} = \sigma^2 \begin{pmatrix} 1 & \rho & \rho & \rho\\ \rho & 1 & \rho & \rho\\ \rho & \rho & 1 & \rho\\ \rho & \rho & \rho & 1 \end{pmatrix} \]

There are only two covariance parameters:

  • \(\sigma^2\): common variance
  • \(\rho\): common correlation

When CS Makes Sense

CS can be reasonable when measurements are approximately equally variable and the correlation does not appear to depend strongly on how far apart the visits are.

It is particularly attractive when the number of repeated measurements is large relative to the available sample size because it uses very few covariance parameters.

Limitation: If Week 2 and Week 12 measurements are much less correlated than Week 2 and Week 4 measurements, CS may impose an unrealistic dependence pattern.

Autoregressive AR(1)

An AR(1) covariance structure assumes that correlation declines as the lag between measurements increases.

For equally spaced visits:

\[ \operatorname{Corr}(Y_{ij},Y_{ik}) = \rho^{|j-k|} \]

For four visits, the correlation matrix is:

\[ \begin{pmatrix} 1 & \rho & \rho^2 & \rho^3\\ \rho & 1 & \rho & \rho^2\\ \rho^2 & \rho & 1 & \rho\\ \rho^3 & \rho^2 & \rho & 1 \end{pmatrix} \]

If \(\rho=0.70\), for example:

\[ \rho^2=0.49, \qquad \rho^3=0.343 \]

Thus adjacent observations are more strongly correlated than observations separated by several visits.

When AR(1) Makes Sense

  • Measurements are approximately equally spaced.
  • Correlation decreases with increasing lag.
  • Nearby visits are expected to be more similar than distant visits.
Important: Standard discrete-time AR(1) is most naturally interpreted when visits are equally spaced. If actual elapsed time differs substantially between visits, a continuous-time spatial covariance model may be more appropriate.

Heterogeneous Compound Symmetry

A heterogeneous compound symmetry structure, often denoted CSH, relaxes the equal-variance assumption of CS.

For four visits:

\[ \mathbf{R} = \begin{pmatrix} \sigma_1^2 & \rho\sigma_1\sigma_2 & \rho\sigma_1\sigma_3 & \rho\sigma_1\sigma_4\\ \rho\sigma_1\sigma_2 & \sigma_2^2 & \rho\sigma_2\sigma_3 & \rho\sigma_2\sigma_4\\ \rho\sigma_1\sigma_3 & \rho\sigma_2\sigma_3 & \sigma_3^2 & \rho\sigma_3\sigma_4\\ \rho\sigma_1\sigma_4 & \rho\sigma_2\sigma_4 & \rho\sigma_3\sigma_4 & \sigma_4^2 \end{pmatrix} \]

The correlations remain common, but the variances can differ by visit.

This can be useful when variability increases as disease progression or treatment exposure increases.

Heterogeneous AR(1)

Heterogeneous AR(1) allows both the variances and the correlations to vary according to an AR(1)-type pattern.

The covariance between visits \(j\) and \(k\) can be represented as:

\[ \operatorname{Cov}(Y_j,Y_k) = \sigma_j\sigma_k\rho^{|j-k|} \]

This structure is substantially more flexible than ordinary AR(1), but it also requires substantially more covariance parameters.

Toeplitz Covariance

A Toeplitz structure assumes that covariance depends on the lag between measurements, but unlike AR(1), it does not require a geometric decay pattern.

For four visits:

\[ \mathbf{R} = \begin{pmatrix} \sigma_0 & \sigma_1 & \sigma_2 & \sigma_3\\ \sigma_1 & \sigma_0 & \sigma_1 & \sigma_2\\ \sigma_2 & \sigma_1 & \sigma_0 & \sigma_1\\ \sigma_3 & \sigma_2 & \sigma_1 & \sigma_0 \end{pmatrix} \]

The first off-diagonal represents lag 1, the second lag 2, and so on.

Toeplitz therefore provides more flexibility than AR(1) while still imposing a useful lag-based pattern.

Unstructured Covariance

The unstructured covariance structure, abbreviated UN, estimates every variance and covariance separately.

For four visits:

\[ \mathbf{R} = \begin{pmatrix} \sigma_1^2 & \sigma_{12} & \sigma_{13} & \sigma_{14}\\ \sigma_{12} & \sigma_2^2 & \sigma_{23} & \sigma_{24}\\ \sigma_{13} & \sigma_{23} & \sigma_3^2 & \sigma_{34}\\ \sigma_{14} & \sigma_{24} & \sigma_{34} & \sigma_4^2 \end{pmatrix} \]

For \(m\) visits, UN requires:

\[ \frac{m(m+1)}{2} \]

covariance parameters.

For example:

Number of Visits UN Covariance Parameters
3 6
4 10
5 15
6 21
8 36
10 55
Why UN is attractive: It makes relatively few structural assumptions. Why UN can be dangerous: With many visits or limited sample size, estimating a large number of covariance parameters can lead to instability, convergence problems, boundary estimates, or an estimated covariance matrix that is poorly determined.

Spatial Covariance Structures

Longitudinal data are sometimes collected at irregularly spaced times.

For example, suppose measurements occur at:

  • Day 0
  • Day 7
  • Day 21
  • Day 60
  • Day 120

The gaps are clearly not equal.

A discrete AR(1) structure based simply on visit number treats the difference between visits 1 and 2 similarly to the difference between visits 4 and 5, even though the actual time intervals differ dramatically.

A continuous-time spatial covariance model can instead use actual time distance.

A common exponential correlation model is:

\[ \operatorname{Corr}(Y_j,Y_k) = \exp(-\phi |t_j-t_k|) \]

where \(t_j\) and \(t_k\) are the actual measurement times.

Practical rule: If the scientific rationale is based on actual elapsed time rather than visit number, consider a covariance structure that uses the actual time distance.

Covariance Structure vs. Random Effects

One of the most important concepts in longitudinal modeling is distinguishing the covariance structure from the random-effects structure.

Consider a random-intercept model:

\[ Y_{ij} = \beta_0 + \beta_1 t_{ij} + b_i + \epsilon_{ij} \]

where:

\[ b_i\sim N(0,\sigma_b^2) \]

and:

\[ \epsilon_{ij}\sim N(0,\sigma_e^2) \]

Two observations from the same subject have covariance:

\[ \operatorname{Cov}(Y_{ij},Y_{ik}) = \sigma_b^2 \qquad j\ne k \]

This induces a compound-symmetry-like marginal correlation pattern.

Adding a random slope produces a richer covariance pattern:

\[ Y_{ij} = \beta_0 + \beta_1 t_{ij} + b_{0i} + b_{1i}t_{ij} + \epsilon_{ij} \]

The covariance between observations can then depend on their time values.

Do not automatically add every possible random effect and every possible residual covariance structure. Both components describe dependence. An excessively flexible model can become overparameterized and difficult to estimate.

Marginal and Conditional Perspectives

Mixed models can be interpreted conditionally on subject-specific random effects or marginally over those random effects.

This distinction matters when thinking about covariance structure.

The conditional residual covariance is represented by \(\mathbf{R}\), whereas the marginal covariance incorporates the random-effects contribution:

\[ \mathbf{V}_i = \mathbf{Z}_i\mathbf{G}\mathbf{Z}_i^{\prime} + \mathbf{R}_i \]

Two models that use different random-effects and residual structures can sometimes produce similar marginal covariance patterns.

Therefore, covariance selection should be considered as part of the complete model specification rather than as an isolated technical step.

How Do We Select a Covariance Structure?

There is no single universal rule.

A practical selection process combines:

  • Scientific knowledge
  • Study design
  • Visit spacing
  • Observed variance patterns
  • Observed correlation patterns
  • Model convergence
  • AIC or BIC
  • Likelihood-based comparisons when appropriate
  • Interpretability
  • Stability of treatment-effect estimates
1
Define the fixed-effects mean model first.
2
Identify the scientifically plausible covariance structures.
3
Fit candidate covariance structures using the same mean model.
4
Use ML when comparing models with different fixed-effects structures; use REML for covariance comparison when the fixed-effects structure is held constant.
5
Compare AIC, BIC, likelihood, convergence, and parameter estimates.
6
Check whether the selected structure is scientifically defensible and numerically stable.

Maximum Likelihood vs. Restricted Maximum Likelihood

This is one of the most important technical issues in covariance structure selection.

Maximum Likelihood

Maximum likelihood, or ML, estimates both fixed effects and variance parameters using the full likelihood.

ML is appropriate when comparing models with different fixed-effects structures because the fixed-effects contribution is part of the likelihood comparison.

Restricted Maximum Likelihood

Restricted maximum likelihood, or REML, estimates variance components after accounting for the fixed-effects estimation.

REML generally provides less biased variance-component estimates in finite samples.

However, REML likelihoods from models with different fixed-effects structures are not directly comparable for ordinary likelihood-ratio model selection.

Key rule: When the fixed-effects structure is identical and only the covariance structure changes, REML-based comparisons are commonly appropriate. When the fixed-effects structure changes, refit the candidate models using ML before comparing their likelihoods or AIC values.

AIC

The Akaike Information Criterion is:

\[ AIC = -2\ell + 2k \]

where:

  • \(\ell\) is the maximized log-likelihood.
  • \(k\) is the number of estimated parameters.

Lower AIC is preferred.

AIC rewards better likelihood fit but penalizes model complexity.

BIC

The Bayesian Information Criterion is:

\[ BIC = -2\ell + k\log(n) \]

where \(n\) is the effective sample size used in the likelihood.

BIC applies a stronger complexity penalty than AIC when the sample size is greater than approximately \(e^2\).

Consequently, BIC will often favor a simpler covariance structure than AIC.

Criterion General Behavior
AIC Balances fit and complexity with a relatively lighter penalty
BIC Penalizes additional parameters more strongly as sample size increases
Likelihood ratio test Formal comparison for nested models under appropriate regularity conditions

Do Not Select Covariance Structure by AIC Alone

Suppose the following results are obtained:

Structure Parameters AIC BIC
CS 2 4281 4294
AR(1) 2 4259 4272
CSH 6 4251 4289
UN 15 4248 4345

AIC favors UN, while BIC favors CSH.

This is not a contradiction.

It means the criteria place different weights on model flexibility.

The practical question is not simply "Which AIC is smallest?" Ask whether the additional covariance parameters produce a meaningful and stable improvement in the representation of the repeated measurements.

Likelihood Ratio Tests

For nested models, a likelihood ratio statistic is:

\[ LR = -2 \left[ \ell_{\text{reduced}} - \ell_{\text{full}} \right] \]

Under standard regularity conditions, this can be compared with a chi-square distribution with degrees of freedom equal to the difference in the number of parameters.

However, covariance parameters can lie on the boundary of their parameter space. This means the usual chi-square approximation can require special attention in some variance-component testing problems.

Practical point: AIC and BIC are often convenient for comparing a set of candidate covariance structures. Formal likelihood-ratio testing should be used with awareness of whether the models are nested and whether standard asymptotic assumptions apply.

Empirical Clues from the Data

Before fitting highly parameterized structures, examine the observed data.

Useful exploratory quantities include:

  • Variance by visit
  • Standard deviation by visit
  • Pairwise correlations by visit
  • Mean trajectory
  • Number of observations at each visit
  • Actual elapsed time between measurements

Suppose the observed standard deviations look approximately like:

Visit SD
Baseline 8.1
Week 4 8.4
Week 8 8.7
Week 12 8.5

Equal-variance structures such as CS or AR(1) may be reasonable candidates.

Now suppose:

Visit SD
Baseline 6.1
Week 4 7.9
Week 8 10.4
Week 12 13.8

A heterogeneous variance structure deserves consideration.

Correlation Patterns Can Be Informative

Suppose the estimated correlations appear approximately:

Lag Correlation
1 visit 0.78
2 visits 0.60
3 visits 0.47
4 visits 0.37

This pattern is consistent with decreasing correlation as time separation increases.

An AR-type covariance structure may therefore be scientifically reasonable.

A Critical Issue: Visit Number vs. Actual Time

Consider two patients.

Patient A is measured at:

\[ 0,\ 7,\ 14,\ 21\text{ days} \]

Patient B is measured at:

\[ 0,\ 7,\ 30,\ 90\text{ days} \]

Both may have four nominal visits, but the actual time separations are very different.

A standard AR(1) based on visit index treats the observation sequence according to lags of 1, 2, and 3 visits.

A continuous-time covariance model instead uses actual time separation.

Clinical trial implication: If visit windows are wide and actual assessment times vary substantially, consider whether a visit-index covariance model accurately represents the scientific dependence structure.

Missing Data and Covariance Structure

Longitudinal clinical trials frequently have incomplete repeated measurements.

For example:

Subject Baseline Week 4 Week 8 Week 12
001 Observed Observed Observed Observed
002 Observed Observed Missing Observed
003 Observed Missing Missing Observed

Mixed models can accommodate unbalanced longitudinal data under appropriate missing-data assumptions without requiring every subject to have observations at every visit.

However, missingness can make covariance estimation more difficult, particularly for highly parameterized structures such as UN.

Important: A covariance structure that works well with complete data may become unstable when substantial dropout reduces the information available for later visit-specific variances and covariances.

Covariance Structure and MAR

Standard likelihood-based longitudinal mixed models are often interpreted under a missing-at-random framework.

The likelihood uses the observed measurements and does not require simple mean imputation for missing outcomes.

But the validity of the analysis depends on the missingness assumptions and the correctly specified model.

Changing the covariance structure does not automatically solve informative dropout.

A Worked Clinical Example

Suppose a randomized clinical trial compares an active treatment with placebo.

The primary continuous endpoint is measured at:

  • Baseline
  • Week 2
  • Week 4
  • Week 8
  • Week 12
  • Week 24

The planned longitudinal model contains:

  • Treatment
  • Visit
  • Treatment-by-visit interaction
  • Baseline covariate
  • Subject-level repeated observations

The scientific question is whether the treatment groups differ in mean change over time.

Step 1: Define the Mean Model

A categorical-visit model might be:

\[ Y_{ij} = \beta_0 + \beta_1\operatorname{Treatment}_i + \sum_{k=2}^{6}\gamma_k I(t_{ij}=k) + \sum_{k=2}^{6}\delta_k \operatorname{Treatment}_i I(t_{ij}=k) + \beta_B B_i + \epsilon_{ij} \]

The treatment-by-visit interaction allows treatment differences to vary across visits.

Model-selection principle: Choose the mean structure and covariance structure as related but distinct components. Do not change both simultaneously without understanding which component caused the change in fit.

Step 2: Fit Candidate Covariance Structures

Suppose four candidate structures are considered:

Model Covariance Structure Rationale
Model A CS Equal variance and common correlation
Model B AR(1) Correlation decreases with visit lag
Model C CSH Variances may differ by visit
Model D UN Maximum flexibility

Step 3: Compare the Models

Suppose the models produce:

Structure -2 Log Likelihood AIC BIC Converged?
CS 4128.4 4144.4 4181.2 Yes
AR(1) 4107.8 4123.8 4160.6 Yes
CSH 4097.5 4111.5 4175.8 Yes
UN 4088.2 4122.2 4260.7 Yes

UN has the best raw likelihood, but its large number of covariance parameters produces a much larger BIC.

CSH has the smallest AIC in this hypothetical comparison.

The selection should therefore not be reduced to the single statement "UN fits best."

Step 4: Examine Covariance Estimates

Suppose CSH produces estimated standard deviations:

Visit Estimated SD
Baseline 6.2
Week 2 6.7
Week 4 7.1
Week 8 8.5
Week 12 9.0
Week 24 10.1

These estimates suggest increasing variability over time.

If that pattern is clinically plausible, CSH may be preferable to CS.

Step 5: Examine the Treatment Effect

The final model should not be selected solely because its AIC is smallest.

Compare the treatment effect estimates across reasonable covariance structures.

Covariance Treatment Difference SE 95% CI
CS -4.8 1.82 (-8.4, -1.2)
AR(1) -4.8 1.71 (-8.2, -1.4)
CSH -4.9 1.74 (-8.3, -1.5)
UN -5.0 1.77 (-8.5, -1.5)

The treatment estimate is stable across structures.

That provides reassurance that the scientific conclusion is not being driven by a fragile covariance assumption.

Good practice: A covariance structure should be evaluated not only for statistical fit but also for whether treatment-effect estimates and their uncertainty are reasonably stable.

What If the Treatment Effect Changes Dramatically?

Suppose instead the results were:

Covariance Estimate SE
CS -4.2 1.4
AR(1) -4.3 1.5
CSH -4.4 2.0
UN -4.7 3.8

The UN model may be too flexible for the available information.

Its treatment estimate is similar, but its uncertainty is much larger.

This is one reason a highly flexible covariance model should not automatically be selected simply because it minimizes the unpenalized likelihood.

Convergence Is Not Optional

A covariance model that does not converge properly should not be selected.

Warning signs include:

  • Failure to converge
  • Non-positive-definite covariance matrix
  • Variance estimates approaching zero
  • Correlation estimates approaching \(\pm1\)
  • Extremely large standard errors
  • Huge condition numbers
  • Different answers from different starting values
  • Optimization warnings
Important: A lower AIC from a numerically unstable or improperly converged model does not make that model preferable.

Boundary Estimates

Suppose an estimated variance is:

\[ \widehat{\sigma}^2\approx0 \]

or a correlation is:

\[ \widehat{\rho}\approx0.999 \]

This can indicate that the data do not provide enough information to estimate the covariance parameters reliably.

A simpler structure may be more appropriate.

Positive Definiteness

A valid covariance matrix must be positive semidefinite.

For a covariance matrix \(\mathbf{R}\), we require:

\[ \mathbf{a}^{\prime}\mathbf{R}\mathbf{a}\ge0 \]

for every vector \(\mathbf{a}\).

This requirement is why covariance structures cannot simply be constructed by independently estimating arbitrary pairwise correlations.

The model-fitting software imposes the mathematical constraints required for a valid covariance matrix.

R Example Using lme4

The lme4 package is widely used for linear mixed models, particularly for random-effects structures.

library(lme4)

fit_ri <- lmer(
  outcome ~ treatment * visit + baseline +
    (1 | subject),
  data = dat,
  REML = TRUE
)

summary(fit_ri)

This model contains a random intercept but does not provide the same flexible residual covariance structures available in specialized mixed-model software.

Important R distinction: For detailed residual covariance-structure selection, packages such as nlme are often more directly suited than lme4, because nlme supports explicit residual correlation and variance structures.

R Example Using nlme: Compound Symmetry

library(nlme)

fit_cs <- lme(
  outcome ~ treatment * visit + baseline,
  random = ~ 1 | subject,
  correlation = corCompSymm(
    form = ~ visit | subject
  ),
  data = dat,
  method = "REML"
)

summary(fit_cs)

R Example Using AR(1)

fit_ar1 <- lme(
  outcome ~ treatment * visit + baseline,
  random = ~ 1 | subject,
  correlation = corAR1(
    form = ~ visit | subject
  ),
  data = dat,
  method = "REML"
)

summary(fit_ar1)

The AR(1) model assumes correlation depends on the lag in the ordering of the measurement occasions.

R Example with Continuous-Time Correlation

For irregularly spaced measurements, a continuous-time correlation structure may be more appropriate.

fit_ct_ar1 <- lme(
  outcome ~ treatment * visit + baseline,
  random = ~ 1 | subject,
  correlation = corCAR1(
    form = ~ time_days | subject
  ),
  data = dat,
  method = "REML"
)

summary(fit_ct_ar1)

Here the correlation is based on the actual continuous measurement time rather than simply the visit number.

R Example with Heterogeneous Variance

A variance function can allow the residual variance to differ across visits.

fit_csh <- lme(
  outcome ~ treatment * visit + baseline,
  random = ~ 1 | subject,
  correlation = corCompSymm(
    form = ~ visit | subject
  ),
  weights = varIdent(
    form = ~ 1 | visit
  ),
  data = dat,
  method = "REML"
)

summary(fit_csh)

The correlation is constrained to a common value while the residual variances can differ across visits.

Comparing AIC in R

AIC(fit_cs, fit_ar1, fit_csh)
BIC(fit_cs, fit_ar1, fit_csh)

Lower values indicate a preferred model according to the corresponding information criterion.

Keep the fixed-effects model constant: When using REML to compare covariance structures, the fixed-effects specification should be the same across the candidate models.

Using ML When Comparing Fixed Effects

Suppose you want to compare:

outcome ~ treatment + visit + baseline

with:

outcome ~ treatment * visit + baseline

The models have different fixed effects.

They should generally be compared using ML rather than REML.

fit_main <- lme(
  outcome ~ treatment + visit + baseline,
  random = ~ 1 | subject,
  correlation = corAR1(form = ~ visit | subject),
  data = dat,
  method = "ML"
)

fit_interaction <- lme(
  outcome ~ treatment * visit + baseline,
  random = ~ 1 | subject,
  correlation = corAR1(form = ~ visit | subject),
  data = dat,
  method = "ML"
)

anova(fit_main, fit_interaction)

SAS Example: Compound Symmetry

In SAS PROC MIXED, compound symmetry can be specified with TYPE=CS.

proc mixed data=dat method=reml;
    class subject treatment visit;

    model outcome =
        treatment
        visit
        treatment*visit
        baseline
        / ddfm=kr;

    repeated visit /
        subject=subject
        type=cs;

run;

The Kenward-Roger degrees-of-freedom method is commonly used in clinical longitudinal analyses when appropriate.

SAS Example: AR(1)

proc mixed data=dat method=reml;
    class subject treatment visit;

    model outcome =
        treatment
        visit
        treatment*visit
        baseline
        / ddfm=kr;

    repeated visit /
        subject=subject
        type=ar(1);

run;

SAS Example: Unstructured Covariance

proc mixed data=dat method=reml;
    class subject treatment visit;

    model outcome =
        treatment
        visit
        treatment*visit
        baseline
        / ddfm=kr;

    repeated visit /
        subject=subject
        type=un;

run;

For \(m\) visits, the UN structure estimates:

\[ \frac{m(m+1)}{2} \]

covariance parameters.

SAS Example: Heterogeneous Compound Symmetry

proc mixed data=dat method=reml;
    class subject treatment visit;

    model outcome =
        treatment
        visit
        treatment*visit
        baseline
        / ddfm=kr;

    repeated visit /
        subject=subject
        type=csh;

run;

SAS Example: Compare Candidate Structures

A practical workflow is to fit candidate structures under the same fixed-effects model and collect fit statistics.

ods output FitStatistics=fit_cs;

proc mixed data=dat method=reml;
    class subject treatment visit;

    model outcome =
        treatment
        visit
        treatment*visit
        baseline
        / ddfm=kr;

    repeated visit /
        subject=subject
        type=cs;
run;

ods output FitStatistics=fit_ar1;

proc mixed data=dat method=reml;
    class subject treatment visit;

    model outcome =
        treatment
        visit
        treatment*visit
        baseline
        / ddfm=kr;

    repeated visit /
        subject=subject
        type=ar(1);
run;

The resulting fit statistics can then be reviewed alongside convergence, covariance estimates, and treatment-effect results.

Why Unstructured Is Not Always the Gold Standard

UN is often described as the most flexible covariance structure.

That does not mean it is automatically the best structure.

Suppose a study has 10 visits.

UN requires:

\[ \frac{10(11)}{2}=55 \]

covariance parameters.

That can be a substantial burden, particularly if the study has modest sample size or considerable dropout.

A simpler structure such as AR(1), CSH, or Toeplitz may provide a better balance between flexibility and stability.

The Parameter-to-Information Problem

A covariance structure becomes increasingly difficult to estimate as the number of parameters grows relative to the number of subjects contributing information.

This is especially important because covariance parameters are estimated from within-subject repeated observations.

A trial with 1,000 observations may still have only 100 subjects.

The effective information for subject-level covariance estimation is therefore very different from treating all 1,000 observations as independent.

Think in subjects, not just rows. Longitudinal datasets may contain many rows while still providing relatively limited information for estimating a highly flexible within-subject covariance matrix.

Small Samples and Overparameterization

Suppose there are only 60 subjects and 8 planned visits.

UN requires:

\[ \frac{8(9)}{2}=36 \]

covariance parameters.

This may be ambitious depending on the amount of missingness, treatment allocation, and distribution of observations across visits.

A lower-dimensional structure may be much more stable.

Covariance Structure Selection Is Not the Same as Mean Model Selection

Suppose the treatment-by-visit interaction is significant under CS but not under UN.

This does not necessarily mean that one model is "correct" and the other is "wrong."

The estimated standard errors depend on the covariance model.

The appropriate question is whether the covariance model is adequately supported by the data and scientific context.

Do not choose the covariance structure solely because it produces a statistically significant treatment result. That approach reverses the modeling logic and can introduce bias into the analysis strategy.

Pre-Specification in Clinical Trials

Covariance structure selection should ideally be addressed before the unblinded primary analysis.

The protocol or statistical analysis plan may specify:

  • Primary mean model
  • Primary covariance structure
  • Alternative covariance structures
  • Model-selection criteria
  • Rules for handling convergence failure
  • Degrees-of-freedom method
  • Estimation method
  • Missing-data assumptions

For example:

Example SAP language: The primary longitudinal analysis will use a mixed model for repeated measurements with treatment, visit, treatment-by-visit interaction, and baseline value as fixed effects. The within-subject covariance structure will be selected from prespecified candidate structures using a defined model selection criterion, subject to convergence and positive-definiteness requirements.

Should the Best-Fitting Structure Always Be the Primary Structure?

Not necessarily.

Suppose two structures have nearly identical AIC values:

Structure AIC
AR(1) 4124.1
CSH 4123.8

The AIC difference is only:

\[ \Delta AIC=0.3 \]

Such a small difference does not provide strong evidence that CSH is meaningfully better.

If AR(1) has a clear scientific rationale and substantially simpler interpretation, it may be preferable.

Parsimony matters. When competing structures have essentially comparable fit, a simpler, scientifically interpretable, and numerically stable structure is often preferable to a much more complicated one.

AIC Differences

A useful quantity is:

\[ \Delta_i = AIC_i-\min(AIC) \]

The model with the smallest AIC has \(\Delta=0\).

Models with small differences in AIC have similar empirical support relative to the candidate set.

This is more informative than simply ranking models 1, 2, 3, and 4.

AICc for Smaller Samples

When sample size is relatively small relative to the number of estimated parameters, a finite-sample correction can be useful.

A common form is:

\[ AIC_c = AIC + \frac{2k(k+1)}{n-k-1} \]

where \(k\) is the number of parameters and \(n\) is the relevant sample size.

The correction becomes increasingly important as \(k\) approaches \(n\).

Software note: The exact availability and implementation of AICc differs across statistical packages and model classes. Use the criterion consistently and verify how the software defines the sample size and parameter count.

Common Covariance Selection Scenarios

Observed Pattern Candidate Structure
Similar variances and similar correlations CS
Correlation decreases with lag AR(1)
Variances differ by visit CSH or heterogeneous AR-type structure
Correlation depends on lag without geometric decay Toeplitz
Very flexible covariance pattern with adequate information UN
Irregularly spaced observations Continuous-time spatial structure

Common Mistakes

  1. Assuming CS is always the default answer. CS is simple and useful, but it may be unrealistic when correlation changes with time.
  2. Using AR(1) with highly irregular visit spacing without considering actual time. The discrete AR(1) model is based on visit lag rather than elapsed time.
  3. Choosing UN automatically because it makes fewer assumptions. UN may require many parameters and can be unstable.
  4. Comparing REML likelihoods across different fixed-effects models. Use ML when comparing fixed-effects structures.
  5. Choosing the structure solely by p-value. Covariance selection should not be driven by whether the treatment effect becomes statistically significant.
  6. Ignoring convergence warnings. An unstable covariance model is not a valid preferred model simply because its AIC is low.
  7. Ignoring variance heterogeneity. Residual variability may increase or decrease substantially over time.
  8. Ignoring dropout. Late-visit covariance parameters can become difficult to estimate when many subjects discontinue.
  9. Confusing random effects with residual covariance. Both contribute to within-subject dependence but play different roles in the model.
  10. Changing the covariance structure after seeing treatment results. Post hoc selection based on the desired inferential result can undermine the credibility of the analysis.

A Practical Model Selection Strategy

A robust approach is to start with a scientifically reasonable set of candidate structures rather than fitting every possible structure.

1
Understand the measurement schedule and actual time spacing.
2
Specify the clinical mean model independently of covariance selection.
3
Inspect empirical variance and correlation patterns.
4
Select a small set of scientifically plausible covariance structures.
5
Fit all candidates using the same dataset and mean structure.
6
Verify convergence and positive-definite covariance estimates.
7
Compare AIC, BIC, and other appropriate fit statistics.
8
Inspect covariance parameter estimates for plausibility.
9
Compare treatment estimates and standard errors across reasonable models.
10
Select a structure that balances fit, parsimony, scientific rationale, and numerical stability.

What If Candidate Models Give Similar Results?

This is often a good outcome.

Suppose CS, AR(1), and CSH all produce similar treatment estimates and similar confidence intervals.

Then the scientific conclusion is relatively robust to covariance specification.

In such a situation, selection can reasonably emphasize:

  • Scientific interpretability
  • Parsimony
  • Convergence
  • Pre-specification
  • Consistency with prior studies

What If Candidate Models Give Different Results?

This deserves more attention.

Large differences in standard errors or treatment conclusions may indicate that the data do not strongly identify the within-subject covariance pattern.

Investigate:

  • Whether the most flexible model is overparameterized
  • Whether there is substantial dropout
  • Whether visit spacing is irregular
  • Whether variances differ substantially by visit
  • Whether the mean model is correctly specified
  • Whether the random-effects structure is appropriate

Sensitivity analyses may be particularly valuable in this situation.

Covariance Structure and Degrees of Freedom

In finite samples, uncertainty in estimated covariance parameters can affect the degrees of freedom used for hypothesis tests.

Methods such as the Kenward-Roger approximation attempt to improve small-sample inference by accounting for covariance-parameter estimation.

Another commonly used approach is the Satterthwaite approximation.

Method General Purpose
Residual / containment approaches Traditional approximate degrees of freedom
Satterthwaite Approximate denominator degrees of freedom
Kenward-Roger Small-sample adjustment to covariance and degrees-of-freedom calculations
Clinical-trial relevance: The covariance structure and degrees-of-freedom method should be considered together because both influence the standard errors and inferential results of a longitudinal mixed model.

Covariance Selection in MMRM

The mixed model for repeated measures, or MMRM, is widely used for longitudinal continuous endpoints in randomized clinical trials.

A typical MMRM includes:

  • Treatment
  • Visit
  • Treatment-by-visit interaction
  • Baseline covariate
  • Repeated observations within subject

Covariance structure selection is therefore a central part of MMRM specification.

UN is commonly considered because it makes relatively few assumptions about the covariance matrix, but alternatives such as CS, AR(1), CSH, or Toeplitz may be more stable depending on the study.

Why MMRM Makes Covariance Selection Especially Important

In an MMRM, the treatment-by-visit interaction may be estimated using within-subject longitudinal information.

Therefore, the covariance matrix directly affects the precision with which these visit-specific treatment differences are estimated.

A poorly specified covariance structure can lead to inefficient or unstable inference.

Practical takeaway: For an MMRM, covariance structure selection should be treated as an integral part of the primary statistical model rather than an afterthought.

Baseline Adjustment and Covariance Structure

Baseline adjustment is frequently included in longitudinal models.

For example:

\[ Y_{ij} = \beta_0 + \beta_B B_i + \beta_T T_i + \beta_V V_j + \beta_{TV}(T_iV_j) + \epsilon_{ij} \]

The covariance structure describes dependence among post-baseline outcomes after accounting for the fixed effects.

It is therefore important to distinguish:

  • Adjustment for baseline in the mean model
  • Within-subject covariance among repeated outcomes

These address different statistical questions.

Covariance Selection and Sensitivity Analysis

A strong longitudinal analysis can evaluate whether conclusions are robust under alternative reasonable covariance structures.

For example:

Analysis Structure
Primary Prespecified covariance structure
Sensitivity 1 AR(1)
Sensitivity 2 CSH
Sensitivity 3 UN, if estimable

If the treatment conclusion remains similar across these analyses, confidence in the robustness of the result increases.

Do Not Use Covariance Selection to "Find Significance"

Suppose an analyst fits six covariance structures and reports the one that produces the smallest treatment p-value.

This is poor statistical practice.

The covariance structure should be selected according to a prespecified or scientifically defensible procedure, not according to which model produces the most favorable treatment conclusion.

The selection target is the covariance model, not the p-value. Fit, parsimony, scientific plausibility, convergence, and stability should drive covariance selection.

A Compact Decision Table

Question Possible Answer
Are all variances similar? Consider CS or AR(1)
Does correlation decline with lag? Consider AR(1)
Does variance change over time? Consider CSH or heterogeneous AR
Does covariance depend on lag without geometric decay? Consider Toeplitz
Are observations irregularly spaced? Consider continuous-time covariance
Is sample size large enough for many covariance parameters? UN may be feasible
Does UN fail to converge? Consider a simpler structure
Are several structures similarly supported? Prefer a stable, interpretable, parsimonious structure

A Complete Covariance Selection Checklist

  • Confirm the measurement schedule.
  • Determine whether visit intervals are approximately equal.
  • Examine the number of subjects relative to the number of visits.
  • Assess the amount and pattern of dropout.
  • Specify the fixed-effects mean model.
  • Identify plausible covariance structures.
  • Fit models under the same data and fixed-effects specification.
  • Use REML for covariance comparison when fixed effects are unchanged.
  • Use ML when comparing different fixed-effects structures.
  • Review AIC.
  • Review BIC.
  • Consider likelihood-ratio tests for appropriate nested models.
  • Check convergence.
  • Check positive definiteness.
  • Inspect covariance parameter estimates.
  • Compare treatment-effect estimates and standard errors.
  • Consider sensitivity analyses.
  • Document the final selection rationale.

The Most Important Concept

The most important point is that covariance structure selection is a balance between realism and estimability.

A very simple model such as CS may impose unrealistic assumptions.

A very flexible model such as UN may impose too few structural assumptions but require too many parameters.

AR(1), CSH, Toeplitz, heterogeneous AR-type structures, and continuous-time models occupy different positions along this spectrum.

The best covariance structure is therefore not necessarily the one with the largest number of parameters or the smallest raw likelihood.

Bottom line: Choose a covariance structure that is scientifically plausible, statistically supported, computationally stable, and sufficiently flexible for the longitudinal data. Use AIC and BIC as model-selection tools rather than automatic decision rules, distinguish REML from ML when comparing models, and evaluate whether treatment-effect inference remains stable under reasonable alternative covariance specifications.

Summary

Covariance structure selection is a fundamental component of longitudinal mixed-effects modeling.

The major structures have different assumptions:

Structure Core Assumption
CS Equal variance and equal correlation
AR(1) Correlation decreases geometrically with lag
CSH Different variances but common correlation
Heterogeneous AR Different variances plus AR-type correlation
Toeplitz Covariance depends on lag
UN Every variance and covariance estimated freely
Continuous-time spatial Correlation depends on actual elapsed time

The selection process should consider:

  • Scientific plausibility
  • Visit spacing
  • Observed variance patterns
  • Observed correlation patterns
  • AIC and BIC
  • Likelihood comparisons
  • Convergence
  • Positive definiteness
  • Parameter stability
  • Treatment-effect robustness

For clinical longitudinal studies, the final covariance structure should be documented clearly in the statistical analysis plan and supported by a reproducible model-selection strategy.

References

Laird, N.M. & Ware, J.H. (1982). Random-effects models for longitudinal data. Biometrics, 38(4), 963–974.

Verbeke, G. & Molenberghs, G. (2000). Linear Mixed Models for Longitudinal Data. Springer.

Fitzmaurice, G.M., Laird, N.M. & Ware, J.H. (2011). Applied Longitudinal Analysis. Wiley.

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.

Kenward, M.G. & Roger, J.H. (1997). Small sample inference for fixed effects from restricted maximum likelihood. Biometrics, 53, 983–997.

Wolfinger, R. (1993). Covariance structure selection in general mixed models. Communications in Statistics — Simulation and Computation, 22, 1079–1106.

Pinheiro, J.C. & Bates, D.M. (2000). Mixed-Effects Models in S and S-PLUS. Springer.

Akaike, H. (1974). A new look at the statistical model identification. IEEE Transactions on Automatic Control, 19, 716–723.

Schwarz, G. (1978). Estimating the dimension of a model. The Annals of Statistics, 6, 461–464.