Tutorials › Multi-Omics Data Integration › Worked Example Fitting Two Matched Omics Blocks

Latent Factor Models and Their Interpretation · Tutorial 255 of 597

Worked Example Fitting Two Matched Omics Blocks

Learn to fit and interpret a shared Gaussian factor across two matched omics blocks, calculate subject scores and reconstructed measurements, and check whether the fit is credible.

Advanced 12 min read

What You'll Learn

  • Set up a one-factor Gaussian model for two feature blocks measured on the same subjects.
  • Normalize scores and loadings to resolve their arbitrary scale.
  • Fit a rank-one model by least squares and relate it to the singular value decomposition.
  • Calculate subject scores, loadings, reconstructed values, and residual error.
  • Distinguish a shared factor pattern from evidence of a causal biological mechanism.
  • Diagnose poor fits and recognize when alternatives to a spherical Gaussian factor model are needed.

Fitting a Common Factor Across Matched Blocks

Suppose each subject has measurements from two omics blocks, such as expression and protein abundance. A factor model can summarize a pattern that varies across subjects and appears in both blocks. The practical task is to fit the pattern, quantify each subject’s position along it, and check how well it reconstructs the observed measurements. Matching is essential: each row in both blocks must refer to the same subject in the same order.

For this worked model, measurements are centered across subjects and placed on comparable scales before fitting. Write \(X^{(1)}\) and \(X^{(2)}\) for the resulting \(n\)-by-\(p_1\) and \(n\)-by-\(p_2\) matrices. Concatenate them by columns to form \(X=[X^{(1)}\;X^{(2)}]\), an \(n\)-by-\(p\) matrix where \(p=p_1+p_2\). A row is a subject; a column is a feature.

Definition: A one-factor Gaussian model for the concatenated, centered measurements is \(X_{ij}=z_i\lambda_j+\varepsilon_{ij}\). Here \(z_i\) is subject \(i\)’s factor score, \(\lambda_j\) is feature \(j\)’s loading, and \(\varepsilon_{ij}\) is residual measurement variation. In the spherical-error version used for the least-squares fit, the errors are independent with \(\varepsilon_{ij}\sim N(0,\sigma^2)\). The same \(z_i\) applies to features in both blocks; the loadings for the first and second blocks are the corresponding parts of \(\lambda\).

The Gaussian assumption gives a likelihood-based reason to minimize squared residuals: for independent Gaussian errors with common variance, maximizing the conditional likelihood over scores and loadings is equivalent to minimizing \(\sum_{i,j}(X_{ij}-z_i\lambda_j)^2\). For a single-factor fit, use the normalization \(\sum_i z_i=0\) and \(z'z=n\). Without a scale constraint, multiplying all scores by a constant and dividing all loadings by the same constant leaves the fitted values unchanged. A sign change in both scores and loadings also leaves them unchanged.

Least-Squares Fit and Its Justification

For any fixed, centered score vector \(z\) with \(z'z=n\), the loading that minimizes the squared residuals is \(\hat{\lambda}=X'z/n\). The fitted matrix is then \(\hat{X}=z\hat{\lambda}'\). Searching over all allowed score vectors gives the best rank-one least-squares reconstruction of \(X\). This is the leading-component solution from the singular value decomposition (SVD), with the score vector rescaled to satisfy the stated normalization.

$$ \hat{\lambda}=\frac{X'z}{n}, \qquad \hat{X}=z\hat{\lambda}', \qquad \operatorname{SSE}=\sum_{i=1}^{n}\sum_{j=1}^{p}(X_{ij}-\hat{X}_{ij})^2. $$

To see why the SVD gives the least-squares solution, take a unit-length vector \(u\) and write \(z=\sqrt{n}\,u\). For fixed \(u\), the fitted value in feature \(j\) is the projection of column \(X_{\cdot j}\) onto \(u\), namely \(u(u'X_{\cdot j})\). The total squared residual is therefore

$$ \|X\|_F^2-\|X'u\|^2. $$

The first term does not depend on \(u\). Thus minimizing residual sum of squares is equivalent to maximizing \(u'XX'u\) subject to \(u'u=1\). The maximum is attained by a leading eigenvector of \(XX'\), equivalently the leading left singular vector of \(X\). This establishes the rank-one least-squares result; it does not establish that one factor is scientifically adequate or that the Gaussian assumptions are appropriate.

Worked Example: Exact Fit Across Two Matched Blocks

Consider four hypothetical subjects with two centered features in each block. Their concatenated measurements are \((-1,-0.5,-0.75,0.5)\), \((-1,-0.5,-0.75,0.5)\), \((1,0.5,0.75,-0.5)\), and \((1,0.5,0.75,-0.5)\). The first two entries belong to block 1; the last two belong to block 2. The matrix is centered, and its rows are aligned by subject.

The score vector \(z=(-1,-1,1,1)'\) is centered and satisfies \(z'z=4=n\). Applying the conditional loading formula gives

$$ \hat{\lambda}=\frac{X'z}{4} =\frac{1}{4} \begin{pmatrix} 4\\2\\3\\-2 \end{pmatrix} = \begin{pmatrix} 1\\0.5\\0.75\\-0.5 \end{pmatrix}. $$

The first block’s loadings are \((1,0.5)\); the second block’s are \((0.75,-0.5)\). For subject 1, multiplying score \(-1\) by these loadings reconstructs \((-1,-0.5,-0.75,0.5)\), exactly the observed row. The same calculation reconstructs all four rows, so the residuals and SSE are zero. This is an exact rank-one pattern by construction, not evidence that real data will fit perfectly.

Scores, Reconstruction, and Residuals

After fitting the loadings, reconstruct a subject’s measurements by multiplying their score by each loading. A positive score predicts values in the directions of positive loadings and opposite directions for negative loadings; a negative score reverses those directions. A loading’s magnitude indicates how strongly that feature changes along the fitted pattern, in the units used for the input data.

There are different ways to estimate scores once loadings are available. With scores treated as unknown fixed quantities, the least-squares score for a subject is \(\hat{z}_i=X_{i\cdot}\hat{\lambda}/(\hat{\lambda}'\hat{\lambda})\). If instead the model assigns a standard normal prior \(z_i\sim N(0,1)\), the posterior mean score is \(\hat{z}_i=\hat{\lambda}'X_{i\cdot}/(\hat{\lambda}'\hat{\lambda}+\sigma^2)\). The latter shrinks scores toward zero to reflect residual noise. These estimators answer slightly different questions; state which is used.

Worked Example: Estimating a Noisy Subject’s Score

Suppose a fitted model has loading vector \(\hat{\lambda}=(0.8,0.4,0.6,-0.4)'\) and residual variance \(\sigma^2=0.36\). A hypothetical subject has centered measurements \(x=(1.0,0.2,0.5,-0.3)'\). Under the standard normal score prior, the posterior mean score is

$$ E(z\mid x)=\frac{\hat{\lambda}'x}{\hat{\lambda}'\hat{\lambda}+\sigma^2} =\frac{0.8(1.0)+0.4(0.2)+0.6(0.5)+(-0.4)(-0.3)} {0.8^2+0.4^2+0.6^2+(-0.4)^2+0.36} =\frac{1.30}{1.68}=0.7738. $$

Multiplying this score by the loadings gives the reconstructed measurements \((0.619,0.310,0.464,-0.310)\), to three significant figures. The first two reconstructed values are for block 1 and the last two for block 2. These are model-based predictions of the centered measurements, not the subject’s raw observations or estimates of causal effects.

Worked Example: One Conditional Loading Update and Its Residuals

Consider a second hypothetical, centered three-subject matrix with rows \((-2,-1,-1.4,1)\), \((0.2,0,-0.2,0)\), and \((1.8,1,1.6,-1)\). Use the current score vector \(z=(-\sqrt{1.5},0,\sqrt{1.5})'\), which has mean zero and \(z'z=3=n\). This example performs a loading update conditional on these scores; it is not claimed to be a converged SVD fit.

The feature-wise loading update is \(\hat{\lambda}=X'z/3\). Since \(\sqrt{1.5}/3=1/\sqrt{6}\), this gives

$$ \hat{\lambda}= \left(\frac{3.8}{\sqrt{6}},\frac{2}{\sqrt{6}}, \frac{3}{\sqrt{6}},-\frac{2}{\sqrt{6}}\right)' \approx (1.551,0.8165,1.225,-0.8165)'. $$

The reconstructed rows are \((-1.9,-1,-1.5,1)\), \((0,0,0,0)\), and \((1.9,1,1.5,-1)\). Subtracting these from the observations gives residual rows \((-0.1,0,0.1,0)\), \((0.2,0,-0.2,0)\), and \((-0.1,0,0.1,0)\). Their squared values sum to \(0.02+0.08+0.02=0.12\). This residual calculation evaluates this conditional update; a complete alternating fit would also update the scores and iterate until the objective stops changing.

Assumptions, Diagnostics, and Alternatives

A useful interpretation depends on more than a successful numerical fit. Check that the rows in both blocks refer to the same subjects, that the features were centered consistently, and that scaling has not allowed a high-variance block to dominate the joint fit. The spherical Gaussian model assumes independent residuals with a common variance across features and subjects. Correlated residuals, strong outliers, or markedly different feature-specific noise levels can make its scores and loadings misleading.

Inspect residuals \(X-\hat{X}\) by subject and feature, and compare residual variability between blocks. Look for structure remaining in the residuals, such as a feature group that consistently moves together or a subject with unusually large residuals. Check whether the score and loading patterns are stable to reasonable preprocessing choices. These checks help detect misspecification; a small SSE alone does not show that the factor is stable or that a one-factor model is adequate. The earlier material on residual diagnostics and overfitting in latent factor models provides broader context for these checks.

The rank-one least-squares fit is closely related to principal component analysis: both select a direction that explains as much total squared variation as possible. A probabilistic factor model adds an explicit error distribution and can support uncertainty calculations, but the simple spherical version still imposes restrictive residual assumptions. Alternatives may allow feature-specific residual variances, correlated residuals, or robust error distributions. Other integration methods can target cross-block association rather than total reconstruction error. They need not return the same scores: the result depends on the model and objective, not just on the data.

A common mistake is to treat a positive score as evidence that a biological process is “activated,” or to read a large loading as proof of a causal effect. The correction is to describe the fitted pattern in terms of the observed, processed features: for example, “subjects with higher scores tend to have higher centered values for these positively loaded features and lower values for these negatively loaded features.” A shared pattern across two blocks is an association in these measurements. It does not by itself establish a mechanism, direction of influence, or clinical meaning.

Key takeaway: A one-factor fit supplies a compact, shared reconstruction of matched measurements. Report the preprocessing, score and loading normalization, residual behavior, and limitations alongside the pattern’s interpretation.

Check Your Understanding

Try each question, then compare your reasoning with the brief solutions.

  1. Why must the rows of the two omics blocks be aligned by subject before fitting a shared score?
  2. What ambiguity is removed by imposing \(z'z=n\), and what ambiguity remains?
  3. For a fitted one-factor model, how do you calculate a feature’s reconstructed value for a subject?
  4. Why does a small residual sum of squares not prove that the Gaussian factor model is appropriate?
  5. If a feature has a negative loading, what does a positive subject score imply for its fitted centered value?

Solutions. (1) The common score is assigned to a subject, so mismatched rows would pair one subject’s measurements in one block with another subject’s measurements in the other. (2) The constraint fixes the scale trade-off between scores and loadings; changing both signs still leaves the fitted matrix unchanged. (3) Multiply the subject’s score by the feature’s loading. (4) The model may still have structured residuals, outliers, unequal noise, or an overfit factor; SSE alone does not test these assumptions. (5) The fitted centered value is negative, because it is the product of a positive score and a negative loading.

Clinical Biostats