Tutorials › Nonlinear Mixed-Effects Models (NLME) › Deriving the NPDE Covariance Transformation

Visual and Numerical Predictive Checks · Tutorial 590 of 797

Deriving the NPDE Covariance Transformation

Learn how the predictive covariance matrix determines the whitening transformation, and why repeated observations must be transformed jointly when they are correlated.

Intermediate 12 min read

What You'll Learn

  • Define the subject-level predictive deviation vector and its covariance matrix.
  • Derive symmetric covariance whitening from an eigendecomposition.
  • Explain how shared random effects induce correlation among repeated measurements.
  • Calculate whitened deviations using both symmetric and Cholesky transformations.
  • Diagnose when whitening assumptions fail or the covariance matrix is not invertible.
  • Distinguish covariance whitening from marginal standardization.

Why Whiten Predictive Deviations Jointly?

A subject’s repeated observations are often related even after accounting for their different prediction times. For example, a subject-specific random effect can shift several concentrations in the same direction, while residual error contributes variation specific to each measurement. Consequently, a deviation that is surprising at one time may not be independent of a deviation at another time. Scaling each observation by its own standard deviation does not remove this dependence.

The covariance transformation used in NPDE calculations addresses this by treating the observations from one subject as a vector. It uses both the marginal variances and the covariances between observations. The result is a vector of deviations with identity covariance under the predictive model. Under a multivariate normal predictive distribution, those transformed components are also independent standard normal variables.

Definition: For subject \(i\), let \(Y_i=(Y_{i1},\ldots,Y_{im_i})^\mathsf{T}\) be the vector of observations at the subject’s observed design points. Let \(\mu_i=E(Y_i)\) and \(\Sigma_i=\operatorname{Cov}(Y_i)\) be the model-predictive mean vector and covariance matrix for that same design. The predictive deviation vector is \(q_i=Y_i-\mu_i\). A whitening matrix \(W_i\) satisfies \(W_i\Sigma_iW_i^\mathsf{T}=I\); the whitened deviation is \(z_i=W_iq_i\).

Here, the predictive distribution is understood to include the sources of variation specified by the predictive check, such as between-subject random effects and residual error. The mean and covariance must correspond to the same conditioning and design as the observations being assessed. For a given subject, the matrix dimension is \(m_i \times m_i\), where \(m_i\) is the number of that subject’s observations.

Deriving the Covariance Transformation

Suppose first that the predictive deviation has mean zero and positive-definite covariance \(\Sigma_i\). A covariance matrix is positive definite when \(a^\mathsf{T}\Sigma_i a>0\) for every nonzero vector \(a\). This condition ensures that all directions in the observation vector have nonzero predictive variance and that the covariance matrix can be inverted.

Because \(\Sigma_i\) is symmetric and positive definite, it has an eigendecomposition \(\Sigma_i=U_i\Lambda_iU_i^\mathsf{T}\), where the columns of \(U_i\) are orthonormal eigenvectors and \(\Lambda_i\) is diagonal with positive eigenvalues. The symmetric inverse square root is \(W_i=U_i\Lambda_i^{-1/2}U_i^\mathsf{T}\). It divides each eigen-direction by the square root of that direction’s predictive variance.

$$ \begin{aligned} z_i &= W_iq_i, \qquad W_i=U_i\Lambda_i^{-1/2}U_i^\mathsf{T},\\ \operatorname{Cov}(z_i) &=W_i\operatorname{Cov}(q_i)W_i^\mathsf{T}\\ &=U_i\Lambda_i^{-1/2}U_i^\mathsf{T} U_i\Lambda_iU_i^\mathsf{T} U_i\Lambda_i^{-1/2}U_i^\mathsf{T}\\ &=U_i I U_i^\mathsf{T}=I. \end{aligned} $$

The simplification follows from \(U_i^\mathsf{T}U_i=I\) and from multiplying each positive eigenvalue by its inverse square root on both sides: \(\lambda^{-1/2}\lambda\lambda^{-1/2}=1\). Thus whitening gives zero covariance between distinct transformed components and unit variance for each component. It does not, by itself, establish that the components are normally distributed. If \(q_i\sim N(0,\Sigma_i)\), then the linear transformation gives \(z_i\sim N(0,I)\), whose components are independent standard normal variables.

The symmetric inverse square root is one valid choice, but not the only one. If \(\Sigma_i=L_iL_i^\mathsf{T}\) is a Cholesky factorization, then \(W_i=L_i^{-1}\) also satisfies \(W_i\Sigma_iW_i^\mathsf{T}=I\). These choices can produce different individual coordinates, even though both have identity covariance. The symmetric choice treats directions without a sequential ordering; Cholesky whitening depends on the order of observations.

Worked Example: Whitening a Low-Variance Difference Direction

Consider a hypothetical pair of predictive deviations with covariance \[ \Sigma=\begin{pmatrix}0.51&0.49\\0.49&0.51\end{pmatrix}. \] The diagonal variances are both \(0.51\), and the covariance \(0.49\) indicates strong positive association. The common direction \((1,1)^\mathsf{T}/\sqrt{2}\) has eigenvalue \(1.00\); the difference direction \((1,-1)^\mathsf{T}/\sqrt{2}\) has eigenvalue \(0.02\). Therefore, whitening divides the common-direction component by \(\sqrt{1.00}=1\), and the difference-direction component by \(\sqrt{0.02}\).

Take the hypothetical observed deviation vector \(q=(1,-1)^\mathsf{T}\). It lies entirely in the difference direction: its projection onto the unit difference vector is \(\sqrt{2}\). Its whitened value in that direction is \(\sqrt{2}/\sqrt{0.02}=10\). Expressed in the original two coordinates, the result is \[ z=10\frac{(1,-1)^\mathsf{T}}{\sqrt{2}} =\left(\frac{10}{\sqrt{2}},-\frac{10}{\sqrt{2}}\right)^\mathsf{T} \approx(7.071,-7.071)^\mathsf{T}. \]

The large magnitude is appropriate: the model assigns very little predictive variance to observations moving in opposite directions, so this observed contrast is unusual relative to that covariance. The transformed values are not \((10,-10)^\mathsf{T}\); the factor of \(\sqrt{2}\) is needed when converting the unit eigenvector coordinates back to the original observation coordinates.

How Repeated-Measurement Correlation Enters

A simple random-intercept model shows where off-diagonal covariance comes from. Suppose the model prediction for observation \(j\) on subject \(i\) can be written as a fixed mean plus a shared subject effect and an observation-specific residual: \[ Y_{ij}=\mu_{ij}+b_i+\epsilon_{ij}. \] Assume \(E(b_i)=0\), \(\operatorname{Var}(b_i)=\omega^2\), \(E(\epsilon_{ij})=0\), and \(\operatorname{Var}(\epsilon_{ij})=\sigma^2\). Also assume the residuals are independent across observations and independent of \(b_i\). Then each observation has variance \(\omega^2+\sigma^2\), while two different observations on the same subject have covariance \(\omega^2\), because they share \(b_i\).

This covariance is exactly what a joint transformation needs to account for. If the random intercept is ignored, repeated positive deviations may be counted as though they were separate evidence, even though their common direction is expected under the model. Conversely, a deviation pattern in a low-variance contrast direction can be more surprising than marginal scales suggest.

Worked Example: Random-Intercept Covariance and Marginal Scaling

Suppose a hypothetical two-measurement model has random-intercept variance \(\omega^2=0.64\) concentration-units squared and residual variance \(\sigma^2=0.40\) concentration-units squared. With the independence assumptions above, each marginal variance is \(0.64+0.40=1.04\), and the covariance between the measurements is \(0.64\). Thus \[ \Sigma=\begin{pmatrix}1.04&0.64\\0.64&1.04\end{pmatrix}. \] The correlation is \(0.64/\sqrt{1.04(1.04)}=0.6154\).

For the hypothetical deviation vector \(q=(0.8,0.2)^\mathsf{T}\) concentration units, the eigenvectors are the common and difference directions, with eigenvalues \(1.68\) and \(0.40\). Projecting onto the unit eigenvectors gives \(0.8+0.2\over\sqrt{2}=0.7071\) and \(0.8-0.2\over\sqrt{2}=0.4243\). After whitening, these coordinates are \(0.7071/\sqrt{1.68}=0.5455\) and \(0.4243/\sqrt{0.40}=0.6708\). Transforming back gives \[ z=\left(\frac{0.5455+0.6708}{\sqrt{2}}, \frac{0.5455-0.6708}{\sqrt{2}}\right)^\mathsf{T} \approx(0.8601,-0.0886)^\mathsf{T}. \]

For comparison, dividing each deviation by its marginal standard deviation \(\sqrt{1.04}=1.0198\) gives approximately \((0.7845,0.1961)^\mathsf{T}\), but the resulting pair still has correlation \(0.6154\). Marginal standardization makes the variances one; it does not remove the dependence. The joint whitening transformation does both.

Alternative Whitening and Coordinate Choices

The Cholesky method provides a convenient alternative when a sequential transformation is appropriate. It is useful to see why it can differ from symmetric whitening without contradicting the identity-covariance result.

Worked Example: Cholesky Whitening

Let the hypothetical covariance matrix be \[ \Sigma=\begin{pmatrix}4&2\\2&3\end{pmatrix}, \qquad L=\begin{pmatrix}2&0\\1&\sqrt{2}\end{pmatrix}, \] so that \(LL^\mathsf{T}=\Sigma\). For \(q=(2,1)^\mathsf{T}\), Cholesky whitening gives \(z=L^{-1}q\). Solving \(Lz=q\), the first row gives \(2z_1=2\), hence \(z_1=1\). The second row gives \(z_1+\sqrt{2}z_2=1\), hence \(z_2=0\). Thus \(z=(1,0)^\mathsf{T}\).

Indeed, \(L^{-1}\Sigma(L^{-1})^\mathsf{T}=I\). A symmetric inverse-square-root transformation of the same \(q\) generally produces different coordinates, because it rotates and scales along covariance eigen-directions rather than sequentially removing dependence. The two results answer the same covariance-whitening requirement, but individual values should not be compared across conventions as if the coordinates were identical.

Assumptions, Diagnostics, and Limitations

A valid covariance whitening step depends on a correctly specified predictive mean and covariance for the subject’s observation design. The deviation should be centered by the predictive mean; otherwise \(E(q_i)\) may not be zero, and whitening will not correct that bias. The covariance matrix must also be symmetric positive definite for an ordinary full-rank inverse square root or Cholesky inverse to exist.

Useful checks include confirming that the covariance is symmetric, inspecting its eigenvalues, and verifying numerically that \(W_i\Sigma_iW_i^\mathsf{T}\) is close to the identity. If a supposedly full-rank covariance has a zero or negative eigenvalue, do not silently treat the ordinary inverse square root as valid. A zero eigenvalue indicates a direction with no predictive variation; a negative eigenvalue is inconsistent with a valid covariance matrix and may indicate numerical or modeling problems. Near-zero eigenvalues can make the transformation highly sensitive to small errors.

After transformation, persistent nonzero means, variances far from one, or dependence in the whitened deviations can indicate a problem with predictive calibration, covariance specification, distributional assumptions, or numerical implementation. These checks are diagnostic rather than a proof that the model is correct. In particular, identity covariance does not guarantee normality. A nonlinear mixed-effects predictive distribution can be nonnormal, even when its mean and covariance are accurately represented. Under nonnormality, whitening removes linear covariance but does not generally make the components independent or normally distributed.

A common mistake is to standardize each time point separately and conclude that the repeated deviations are independent because each has variance one. In the random-intercept example, each marginally standardized deviation still has correlation \(0.6154\). The correction is to transform the vector using its full covariance matrix. A second mistake is to interpret a large whitened contrast as a large raw concentration residual: whitening measures deviation relative to the model’s variance in a direction, so its scale and meaning depend on the covariance structure.

The symmetric inverse square root is especially interpretable in terms of covariance eigen-directions, while Cholesky whitening is computationally convenient and naturally sequential. Neither choice repairs a wrong covariance model, removes nonlinear dependence in general, or substitutes for assessing the predictive distribution. The covariance transformation is one defined step in the NPDE construction, not a standalone guarantee of model adequacy.

Key takeaway: For repeated observations, the NPDE covariance step acts on the whole subject-level deviation vector. It scales directions according to predictive variance and removes modeled linear correlation; marginal standardization alone cannot do that.

Check Your Understanding

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

  1. For a deviation vector with covariance \(\Sigma\), what condition must a whitening matrix \(W\) satisfy?
  2. A covariance matrix has eigenvalue \(0.25\) in a particular unit direction. By what factor does symmetric whitening scale the component in that direction?
  3. In a random-intercept model, why is the covariance between two distinct observations on the same subject equal to the random-intercept variance under independent residual errors?
  4. Why does dividing each repeated deviation by its marginal standard deviation not generally yield independent standardized deviations?
  5. If the predictive deviation is multivariate normal with mean zero and covariance \(\Sigma\), what distribution does an exact whitened vector have?

Solutions. (1) It must satisfy \(W\Sigma W^\mathsf{T}=I\). (2) The factor is \(1/\sqrt{0.25}=2\). (3) Both observations contain the same random intercept, while their independent residuals have zero covariance, so their covariance is \(\operatorname{Var}(b_i)\). (4) Marginal scaling sets each variance to one but leaves off-diagonal correlations generally nonzero. (5) The whitened vector has distribution \(N(0,I)\); its components are independent standard normal variables.