Tutorials › Joint Modeling of Longitudinal and Time-to-Event Data › Within-Visit Residual Covariance Across Markers

Multiple Longitudinal Markers · Tutorial 370 of 697

Within-Visit Residual Covariance Across Markers

Learn to define and interpret within-visit residual covariance across markers, distinguish it from random-effect covariance, and compare valid covariance specifications.

Advanced 12 min read

What You'll Learn

  • Define a residual covariance matrix for markers measured at the same visit
  • Separate within-visit residual covariance from covariance due to shared random effects
  • Calculate contemporaneous covariance under a multivariate mixed model
  • Compare independent-error, unstructured, and parsimonious specifications
  • Check positive definiteness and identify diagnostic warning signs
  • Recognize when an estimated residual association may be misleading

Why Same-Visit Residual Covariance Matters

When several markers are measured on the same subject at the same visit, their values may still move together after accounting for their modeled means and subject-specific random effects. For example, a shared laboratory condition or short-term physiological fluctuation may affect multiple measurements at once. A model that rules out all such residual association can misrepresent the dependence in the data, even if its random-effects covariance is flexible.

The key distinction is between dependence represented by subject-level random effects and dependence left among measurements made together. The earlier material on block covariance structures for marker random effects concerns the former. This tutorial defines the latter and compares common ways to model it.

Model and Assumptions

Suppose \(p\) markers are measured together at visit \(j\) for subject \(i\). Write the \(p\)-vector of observations as \(Y_{ij}\), and use the multivariate linear mixed model

$$ Y_{ij}=\mu_{ij}+Z_{ij}b_i+\epsilon_{ij}. $$

Here \(\mu_{ij}\) is the vector of fixed-effects means, \(b_i\) is the subject-level vector of random effects, and \(Z_{ij}\) maps those effects to the marker vector. Assume \(E(b_i)=0\), \(\operatorname{Cov}(b_i)=G\), and \(E(\epsilon_{ij}\mid b_i)=0\). For the basic within-visit specification, assume

$$ \operatorname{Cov}(\epsilon_{ij}\mid b_i)=\Sigma_{\epsilon}, \qquad \operatorname{Cov}(\epsilon_{ij},\epsilon_{ik}\mid b_i)=0 \quad (j\ne k). $$

The same \(\Sigma_{\epsilon}\) is used at each visit and for each subject in this homogeneous version. Residual vectors from different subjects are also assumed independent. These are modeling assumptions, not consequences of having repeated measurements. If the residual covariance changes with visit or residuals remain associated across distinct visits, this basic specification is inadequate.

Definition: The within-visit residual covariance matrix \(\Sigma_{\epsilon}\) is the \(p\times p\) covariance matrix of the marker-specific residuals from a single visit, conditional on the random effects and the modeled mean. Its diagonal entries are residual variances; its off-diagonal entries are residual covariances between markers measured together.

A covariance entry has units equal to the product of the units of its two markers. Its corresponding residual correlation is dimensionless. A positive entry means that, conditional on the model, above-mean residuals for one marker tend to occur with above-mean residuals for the other; it does not by itself imply a causal relationship.

Separating Residual and Random-Effect Covariance

The observed covariance between markers at one visit contains both sources of dependence. Conditional on the random effects, the covariance is \(\Sigma_{\epsilon}\). Marginally, it also includes variation in \(b_i\). By the covariance decomposition,

$$ \operatorname{Cov}(Y_{ij}) = \operatorname{Cov}\{E(Y_{ij}\mid b_i)\} + E\{\operatorname{Cov}(Y_{ij}\mid b_i)\} = Z_{ij}GZ_{ij}^{\mathsf T}+\Sigma_{\epsilon}. $$

For two distinct visits \(j\ne k\) on the same subject, the assumed residual independence gives

$$ \operatorname{Cov}(Y_{ij},Y_{ik})=Z_{ij}GZ_{ik}^{\mathsf T}. $$

Thus a same-visit covariance is not automatically a residual covariance: shared random effects also contribute to it. Conversely, cross-marker residual covariance is not a substitute for random effects, which can induce dependence across visits as well as across markers.

Worked Example: Decomposing Contemporaneous Covariance

Consider two markers with random intercepts \(b_i=(b_{i1},b_{i2})^{\mathsf T}\), each entering its corresponding marker with coefficient 1. Suppose, hypothetically,

$$ G= \begin{pmatrix} 1&0.60\\ 0.60&4 \end{pmatrix}, \qquad \Sigma_{\epsilon}= \begin{pmatrix} 0.25&0.10\\ 0.10&1 \end{pmatrix}. $$

The same-visit random-effect contribution is \(Z_{ij}GZ_{ij}^{\mathsf T}=G\), since \(Z_{ij}\) is the \(2\times2\) identity matrix here. Therefore,

$$ \operatorname{Cov}(Y_{ij}) = \begin{pmatrix} 1&0.60\\ 0.60&4 \end{pmatrix} + \begin{pmatrix} 0.25&0.10\\ 0.10&1 \end{pmatrix} = \begin{pmatrix} 1.25&0.70\\ 0.70&5 \end{pmatrix}. $$

The total covariance between the two observed markers is \(0.70\), of which \(0.60\) comes from correlated random intercepts and \(0.10\) from within-visit residual covariance. The total same-visit correlation is \(0.70/\sqrt{1.25\times5}=0.280\). It would be incorrect to describe that total correlation as the residual correlation: the residual correlation is \(0.10/\sqrt{0.25\times1}=0.200\).

Three Covariance Specifications

The covariance specification determines which residual associations the model can represent. For a covariance matrix to be valid, it must be symmetric and positive semidefinite; a positive-definite matrix is generally needed for a nonsingular multivariate normal model. Each proposed parameterization must respect this requirement.

SpecificationWhat it permitsMain trade-off
Independent errorsMarker-specific residual variances, with all cross-marker residual covariances fixed at zeroSimple, but may miss residual association
UnstructuredEvery residual variance and pairwise covariance is estimated freelyFlexible, but needs \(p(p+1)/2\) covariance parameters
ParsimoniousA structured set of variances and associations, such as compound symmetry or a low-rank factor structureUses fewer parameters, but imposes restrictions that may not fit

Under independent errors, \(\Sigma_{\epsilon}\) is diagonal. Its \(p\) diagonal entries can differ, so independence does not require equal residual variances. An unstructured matrix has \(p\) variances and \(p(p-1)/2\) distinct off-diagonal covariances. This flexibility can be useful when the number of markers is small and the data support estimating all entries, but it can be unstable when information is limited.

A common parsimonious option is compound symmetry: all markers have a common residual variance and all distinct marker pairs have a common residual correlation. Another option is heterogeneous compound symmetry, which allows marker-specific variances but shares a common correlation. A factor-analytic specification represents covariance through a small number of shared latent factors plus marker-specific residual variances. These structures can reduce the number of free parameters, but their restrictions should be scientifically and empirically defensible.

Worked Example: Estimating a Two-Marker Residual Covariance

Suppose four hypothetical visits have already been adjusted for their modeled means and subject effects, leaving residual pairs \((1,2)\), \((2,1)\), \((-1,-2)\), and \((-2,-1)\), in the respective marker units. These residuals are centered: each marker’s residuals sum to zero. Using the usual centered sample covariance with denominator \(n-1=3\),

$$ s_{11}=\frac{1^2+2^2+(-1)^2+(-2)^2}{3} =\frac{10}{3}=3.333, \qquad s_{22}=\frac{2^2+1^2+(-2)^2+(-1)^2}{3} =\frac{10}{3}=3.333. $$

The sample cross-covariance is

$$ s_{12}= \frac{(1)(2)+(2)(1)+(-1)(-2)+(-2)(-1)}{3} = \frac{8}{3}=2.667. $$

The resulting illustrative covariance matrix is

$$ \widehat{\Sigma}_{\epsilon}= \begin{pmatrix} 3.333&2.667\\ 2.667&3.333 \end{pmatrix}, \qquad \widehat{\rho}_{12}=\frac{2.667}{\sqrt{3.333(3.333)}}=0.800. $$

This example shows the calculation, not a general mixed-model estimator: residuals estimated from a fitted model are not generally independent raw observations, and fitted random effects are estimated rather than known. In practice, model-based estimation must account for that fitting process. The positive covariance here is a descriptive signal that an independent-error restriction might be worth assessing, not a formal test or proof that a particular structure is correct.

A Parsimonious Structure and Its Validity

For \(p\) markers, compound symmetry with common residual variance \(\sigma_{\epsilon}^{2}\) and common correlation \(\rho\) is

$$ \Sigma_{\epsilon} = \sigma_{\epsilon}^{2} \left\{(1-\rho)I_p+\rho\mathbf{1}\mathbf{1}^{\mathsf T}\right\}. $$

The diagonal entries are \(\sigma_{\epsilon}^{2}\); off-diagonal entries are \(\rho\sigma_{\epsilon}^{2}\). The eigenvalues are \(\sigma_{\epsilon}^{2}(1-\rho)\), with multiplicity \(p-1\), and \(\sigma_{\epsilon}^{2}\{1+(p-1)\rho\}\), with multiplicity 1. Therefore, for \(\sigma_{\epsilon}^{2}>0\), positive definiteness requires

$$ -\frac{1}{p-1}<\rho<1. $$

The lower bound matters: a common correlation below zero is possible, but it cannot be arbitrarily negative. The upper bound prevents perfectly redundant residuals, which would make the matrix singular.

Worked Example: Checking a Compound-Symmetry Matrix

For three hypothetical markers, take a common residual variance of \(4\) squared units and a common residual correlation of \(0.30\). The covariance is

$$ \Sigma_{\epsilon}= \begin{pmatrix} 4&1.2&1.2\\ 1.2&4&1.2\\ 1.2&1.2&4 \end{pmatrix}. $$

Here \(1.2=4(0.30)\). The allowable correlation range is \(-1/2<\rho<1\), so \(0.30\) is admissible. The eigenvalues are \(4(1-0.30)=2.8\), twice, and \(4\{1+2(0.30)\}=6.4\), all positive. The matrix is therefore positive definite. This model uses only two covariance parameters, compared with six for an unstructured covariance matrix of three markers, but it imposes equal residual variances and equal pairwise correlations.

Diagnostics, Comparisons, and Limitations

A useful diagnostic begins with residuals that account for the fitted fixed effects and random effects. Examine marker-pair residual plots and correlations, and look for systematic changes by visit, time, or subject characteristics. Also check whether residual association persists across distinct visits; if it does, the assumption of no cross-visit residual covariance may be questionable. These checks are exploratory: fitted random effects are estimated, so conditional residuals can be shrunken and their raw sample covariance need not be an unbiased estimate of \(\Sigma_{\epsilon}\).

Warning signs include an estimated covariance matrix near singularity, correlations close to their allowable boundaries, unstable estimates across reasonable starting values, and implausible changes in estimates when a few subjects are removed. Near-singularity can arise when the data provide little information to distinguish residual covariance from random-effect covariance. The convergence and stability diagnostics used for mixed models remain relevant, but convergence alone does not establish that a covariance structure is adequate.

The choice is a balance. Independent errors are efficient and interpretable when cross-marker residual association is negligible after accounting for random effects. An unstructured matrix avoids strong equality constraints but can require substantial information, particularly as \(p\) grows. A parsimonious structure can stabilize estimation, but a poor restriction may leave systematic residual patterns or distort other model estimates. Compare scientifically plausible alternatives using suitable model assessment, and consider whether conclusions are sensitive to the choice. A covariance pattern describes conditional dependence; it does not establish a biological mechanism or a causal relation.

Common pitfall: Seeing correlated observed marker values and assigning all of their covariance to \(\Sigma_{\epsilon}\). The observed same-visit covariance is \(Z_{ij}GZ_{ij}^{\mathsf T}+\Sigma_{\epsilon}\). Separate the random-effect contribution from the residual contribution before interpreting either one.

Check Your Understanding

Answer each question, then check the concise solutions below.

  1. In a two-marker model, what does a zero off-diagonal entry of \(\Sigma_{\epsilon}\) assert? Does it imply that the observed markers are uncorrelated?
  2. For four markers, how many distinct covariance parameters does an unstructured residual covariance matrix have?
  3. For compound symmetry with \(p=3\), is a common residual correlation of \(-0.60\) admissible for a positive-definite covariance matrix?
  4. Why might an empirical correlation of fitted residuals not equal the model-based estimate of residual correlation?

Solutions. (1) It asserts zero conditional residual covariance between the markers under the specification. The observed markers need not be uncorrelated, because correlated random effects can contribute \(Z_{ij}GZ_{ij}^{\mathsf T}\). (2) The count is \(p(p+1)/2=4(5)/2=10\): four variances and six distinct covariances. (3) No. The compound-symmetry range is \(-1/(3-1)<\rho<1\), or \(-0.50<\rho<1\); \(-0.60\) is outside it. (4) Fitted residuals use estimated means and random effects, and the fitting process affects their covariance. Their raw empirical correlation is therefore not generally the model-based covariance estimate.

Clinical Biostats