Tutorials › Quantitative Systems Pharmacology (QSP) › Comparing Models with Correlated and Heterogeneous Data

Competing Biological Hypotheses · Tutorial 612 of 799

Comparing Models with Correlated and Heterogeneous Data

Compare mechanistic models using likelihoods that represent longitudinal correlation, different measurement scales and dependence across data sources.

Advanced 11 min read

What You'll Learn

  • Write a joint Gaussian likelihood for correlated observations using a covariance matrix.
  • Explain why longitudinal measurements cannot automatically be treated as independent.
  • Weight assay residuals according to their measurement scales and uncertainty.
  • Combine independent data sources using block likelihoods, and recognize when cross-source covariance is needed.
  • Check how misspecified dependence can alter a model ranking and the apparent strength of evidence.
  • Compare models only when they use the same observations and a defensible observation model.

Why the observation model matters in a mechanism comparison

Two mechanistic models can make different predictions for the same longitudinal measurements, biomarkers or clinical endpoints. A comparison is only as meaningful as the probability model used to score those predictions. Measurements from one subject over time may be correlated; assays may have different units and precision; and distinct data sources may share samples, laboratories or other sources of variation. Treating all residuals as independent and equally precise can therefore reward the wrong predictions or make a modest difference look decisive.

The focus here is the observation likelihood used to compare mechanistic alternatives. It is not enough to compare unweighted sums of squared residuals. Each candidate model must be evaluated against the same observed data using a likelihood that represents the relevant scales and dependencies. The likelihood describes the observation process conditional on a model’s predicted means; it does not, by itself, establish that a biological mechanism is true.

Definition: Let \(y\) be a vector of \(N\) observed measurements and \(\mu_m\) the corresponding prediction vector from mechanism \(m\). The residual vector is \(r_m=y-\mu_m\). Under a multivariate normal observation model with covariance matrix \(\Sigma\), the log-likelihood is $$ \ell_m=-\frac{1}{2}\left[N\log(2\pi)+\log|\Sigma|+r_m^\mathsf{T}\Sigma^{-1}r_m\right]. $$ Here \(\Sigma\) must be positive definite, and its entries have units consistent with the measurements. Its diagonal entries are variances; off-diagonal entries encode covariance. The quadratic term scores the residuals relative to their joint uncertainty, while the determinant term accounts for the volume of that uncertainty.

This likelihood assumes that, conditional on the model predictions and any included covariates or random effects, the residual vector has mean zero and covariance \(\Sigma\), with a multivariate normal distribution. The covariance model must be scientifically defensible and applied consistently across mechanisms unless a difference in observation process is explicitly justified. If \(\Sigma\) contains estimated parameters, they must be estimated as part of the likelihood, and counted among the fitted parameters when a criterion such as AIC is used.

Longitudinal correlation changes the score

Repeated measurements on a person or experimental unit are often not independent. A shared biological state, an assay batch effect or a slowly varying measurement disturbance can make nearby observations move together. For two measurements with common standard deviation \(\sigma\) and correlation \(\rho\), a simple covariance model is $$ \Sigma=\sigma^2 \begin{pmatrix} 1 & \rho\\ \rho & 1 \end{pmatrix}, \qquad -1<\rho<1. $$ The determinant is \(\sigma^4(1-\rho^2)\), and the residual quadratic is $$ r^\mathsf{T}\Sigma^{-1}r =\frac{r_1^2+r_2^2-2\rho r_1r_2}{\sigma^2(1-\rho^2)}. $$ When \(\rho\) is positive, a pair of residuals with the same sign is less surprising than an equally large pair with opposite signs. Ignoring this structure can change both the ranking and the size of a likelihood difference.

Worked Example: Correlated Longitudinal Residuals Reverse a Ranking

Suppose two hypothetical mechanisms predict concentrations at two times for the same subject. The observations have residual standard deviation \(\sigma=1\) ng/mL at each time, and the prespecified residual correlation is \(\rho=0.8\). Mechanism A has residuals \((1,-1)\) ng/mL; mechanism B has residuals \((1.05,1.05)\) ng/mL. Both use the same covariance matrix and the same two observations.

For mechanism A, the correlated quadratic is $$ Q_A=\frac{1^2+(-1)^2-2(0.8)(1)(-1)}{1^2(1-0.8^2)} =\frac{3.6}{0.36}=10. $$ For mechanism B, it is $$ Q_B=\frac{1.05^2+1.05^2-2(0.8)(1.05)(1.05)}{0.36} =\frac{2.205-1.764}{0.36} =\frac{0.441}{0.36}=1.225. $$ Because the covariance and number of observations are the same, the determinant and normalizing terms cancel in the difference. Thus \(\ell_B-\ell_A=\frac{1}{2}(Q_A-Q_B)=4.3875\): under this specified likelihood, B has the higher likelihood.

If the measurements were incorrectly treated as independent with the same marginal standard deviations, the quadratic terms would instead be \(Q_A=2\) and \(Q_B=2.205\). That calculation very slightly favors A. The ranking changes because the assumed positive correlation makes A’s opposite-sign residuals especially unlikely. The comparison does not prove B’s biological mechanism; it shows that the dependence assumption is consequential.

Different assays require scale-aware scoring

A residual of 1 ng/mL and a residual of 0.01 in fractional receptor occupancy cannot be compared by their raw magnitudes. They have different units and may have very different measurement precision. The covariance matrix handles both: a residual is judged relative to its variance, and covariance terms account for dependence. With independent observations and known standard deviations, the quadratic term reduces to the sum of squared standardized residuals, \(Q=\sum_i (r_i/\sigma_i)^2\).

Standardizing residuals can be useful for interpretation, but the likelihood also contains the determinant of \(\Sigma\). That term must not be dropped when comparing observation models with different variances or covariance structures. If both candidate mechanisms use the same observations and the same fixed covariance matrix, the determinant is common and cancels from their likelihood difference. If the covariance differs, each model’s full likelihood, including its determinant, is needed.

Worked Example: Comparing Predictions on Two Assay Scales

Consider hypothetical observations of 10 ng/mL for a biomarker and 0.60 for receptor occupancy. Assume independent Gaussian measurement errors with standard deviations 1 ng/mL and 0.02 occupancy units, respectively. Mechanism A predicts 8.5 ng/mL and 0.59; mechanism B predicts 9.5 ng/mL and 0.56.

The residuals are \(r_A=(1.5\text{ ng/mL},\,0.01)\) and \(r_B=(0.5\text{ ng/mL},\,0.04)\). Their standardized sums of squares are $$ Q_A=\left(\frac{1.5\text{ ng/mL}}{1\text{ ng/mL}}\right)^2+ \left(\frac{0.01}{0.02}\right)^2 =2.25+0.25=2.50, $$ $$ Q_B=\left(\frac{0.5\text{ ng/mL}}{1\text{ ng/mL}}\right)^2+ \left(\frac{0.04}{0.02}\right)^2 =0.25+4=4.25. $$ The units cancel within each standardized residual. The assay-scale covariance is common to both mechanisms, so the log-likelihood difference is \(\ell_A-\ell_B=\frac{1}{2}(Q_B-Q_A)=0.875\). A has the higher likelihood under these assumptions, even though B predicts the biomarker concentration more closely. B’s occupancy prediction is two standard deviations from the observation, while A’s is half a standard deviation away.

Adding the raw squared residuals would be invalid: it would add quantities with incompatible units and would make the result depend on how occupancy or concentration happened to be recorded. The standard deviations here are assumed known for this illustration; in an application, their source and any estimation uncertainty should be reported.

Combining multiple data sources

For genuinely independent sources, their joint likelihood is the product of their source-specific likelihoods, so their log-likelihoods add. In covariance terms, this corresponds to a block-diagonal \(\Sigma\): each block represents the dependence within a source, and zero off-diagonal blocks assert that sources are independent conditional on the model. That assertion needs justification. Shared subjects, samples, assay batches or data-processing steps can create cross-source dependence. In that case, a joint covariance with cross-source terms, or another suitable joint observation model, is needed.

A source-specific variance can represent a measurement scale or a known difference in precision. It should not be adjusted simply to make a preferred mechanism fit better. If variance parameters are estimated, the likelihood includes their fitted values and the determinant term; AIC’s parameter count \(k\) includes them. Comparing AIC values is meaningful only when the models use the same observed outcomes and compatible likelihood definitions. AIC is \(2k-2\ell\); it penalizes fitted flexibility but cannot repair a misspecified covariance model.

Worked Example: Adding Evidence Across Independent Sources

Suppose two hypothetical sources are conditionally independent: a longitudinal cytokine source and a separate assay source. After applying each source’s covariance model and whitening its residuals, the two sources give the following quadratic contributions. These are dimensionless contributions to the joint quadratic; assume the same total number of observations and the same covariance determinant under both mechanisms.

For mechanism A, the cytokine source contributes \(Q_{A,1}=1\), and the assay source contributes \(Q_{A,2}=9\), so \(Q_A=1+9=10\). For mechanism B, the contributions are \(Q_{B,1}=4\) and \(Q_{B,2}=1\), so \(Q_B=4+1=5\).

The joint log-likelihood difference is $$ \ell_B-\ell_A=\frac{1}{2}(Q_A-Q_B)=\frac{1}{2}(10-5)=2.5. $$ Thus B has the higher joint likelihood under the stated independent-source model, even though A fits the cytokine source better. Reporting the two source contributions makes the trade-off visible; reporting only the total would hide which source drives the comparison.

If the sources were correlated, simply adding these two contributions would not generally give the joint quadratic. The off-diagonal covariance terms would affect both the inverse covariance and its determinant. The assumed block independence should therefore be checked against how the data were collected, not selected because it is computationally convenient.

Why the covariance-weighted score has this form

The quadratic term can be understood by converting correlated residuals to uncorrelated, unit-scale residuals. Because a positive-definite covariance matrix has a Cholesky factorization \(\Sigma=LL^\mathsf{T}\), define \(z=L^{-1}r\). Then $$ z^\mathsf{T}z =r^\mathsf{T}(L^{-1})^\mathsf{T}L^{-1}r =r^\mathsf{T}(LL^\mathsf{T})^{-1}r =r^\mathsf{T}\Sigma^{-1}r. $$ Thus the likelihood’s quadratic is the squared length after covariance whitening, not the unweighted squared length in the original measurement coordinates. The determinant term follows from the multivariate normal density’s normalization: the density must integrate to one, and its scale is proportional to \(|\Sigma|^{-1/2}\). Omitting it when covariance parameters differ would fail to compare the normalized probability densities.

1
Specify the observations and predictions.
Align the same measured outcomes and units across candidate mechanisms, then calculate each residual vector \(r_m=y-\mu_m\).
2
State the dependence and scale assumptions.
Specify within-time, within-subject and between-source covariance, and explain why any zero covariance terms are plausible.
3
Evaluate the full likelihood.
Use the covariance-weighted quadratic and the determinant term. Estimate covariance parameters under the stated model if they are not fixed.
4
Compare and qualify the result.
Report the likelihood-based comparison, parameter counts if using AIC, and source contributions or sensitivity to plausible covariance choices.

Diagnostics, alternatives and limitations

A covariance model is an assumption, not a correction that automatically makes a comparison reliable. Check whether its form is plausible given the sampling schedule, repeated units, assay structure and data provenance. Useful checks include whether estimated variances are on plausible assay scales, whether a fitted correlation is near a boundary, and whether the covariance matrix is positive definite. Near-singular matrices can make the inverse unstable and make the likelihood highly sensitive to small changes. For multiple sources, inspect whether the assumed independence is consistent with shared subjects, samples or batches. Sensitivity analyses over scientifically plausible correlations or variance assumptions can reveal whether the ranking is robust; they should not be used to search for a preferred answer.

The main alternatives address different questions. A diagonal covariance assumes no residual correlation; it is simpler, but is not justified merely because it is easier to fit. A structured covariance, such as an autoregressive form for equally spaced measurements, can capture dependence with fewer parameters than an unrestricted covariance matrix, but its structure must fit the design and scientific context. A joint covariance with cross-source terms is needed when sources share residual variation. Predictive cross-validation can assess performance on held-out observations, but it also needs splits that respect the dependence structure: separating repeated observations from the same subject across training and test sets can create information leakage. None of these approaches makes incompatible outcomes comparable without specifying their measurement scales.

The Gaussian likelihood can be sensitive to extreme residuals and to an incorrect covariance form. It may also be difficult to estimate a large covariance matrix with sparse data. A higher likelihood under one assumed observation model is evidence only relative to the specified alternatives, data and assumptions; it is not a probability that the mechanism is correct. AIC comparisons likewise depend on an adequate likelihood and do not account for uncertainty in the chosen covariance structure unless that uncertainty is handled explicitly.

Common pitfall: “The residuals at each time point look small, so I can score them as independent and add their squared errors.” This ignores the joint behavior of repeated measurements. Two mechanisms with similar marginal residual sizes can imply very different residual patterns, and positive correlation can make same-sign and opposite-sign residual pairs have very different probabilities. Use a covariance model supported by the design, and assess how reasonable alternatives affect the comparison.
Key takeaway: A fair comparison of biological mechanisms scores the same data using a likelihood that respects measurement units, uncertainty and dependence. The covariance structure can change the model ranking, not just the reported precision of that ranking.

Check Your Understanding

Try each problem, then compare your reasoning with the solutions below.

  1. Two residuals are \(0.5\) and \(0.5\), with standard deviation 1 for each and correlation \(\rho=0.6\). Calculate their covariance-weighted quadratic.
  2. Why is it invalid to compare a residual of 2 ng/mL directly with a residual of 0.03 occupancy units by adding their squares?
  3. Two independent sources have quadratic contributions \(Q_{A,1}=2\), \(Q_{A,2}=6\), \(Q_{B,1}=5\), and \(Q_{B,2}=1\). Assuming equal observation counts and covariance determinants, which mechanism has the higher joint likelihood, and by how much on the log-likelihood scale?
  4. Two assays use the same observations under both mechanisms, but each mechanism is allowed to fit a different residual variance. Which likelihood terms must be retained in the comparison, and why?

Solutions. 1. \(Q=[0.5^2+0.5^2-2(0.6)(0.5)(0.5)]/(1-0.6^2)=(0.5-0.3)/0.64=0.3125\). 2. The squared residuals have different units, and their sizes must be judged relative to their measurement variances; use covariance-weighted standardized residuals instead. 3. \(Q_A=2+6=8\) and \(Q_B=5+1=6\), so \(\ell_B-\ell_A=(8-6)/2=1\); B has the higher likelihood by 1 log-likelihood unit. 4. Retain both the covariance-weighted quadratic and \(\log|\Sigma|\), as well as the common normalizing term. The determinant differs when the fitted variances differ, so dropping it would compare unnormalized scores rather than the full likelihoods.

Clinical Biostats