Fitting Multilevel Factor Models

Tetiana Parshakova, Trevor Hastie, Stephen Boyd · DOI

Abstract

We examine a special case of the multilevel factor model, with covariance given by multilevel low rank (MLR) matrix. We develop a novel, fast implementation of the expectation-maximization algorithm, tailored for multilevel factor models, to maximize the likelihood of the observed data. This method accommodates any hierarchical structure and maintains linear time and storage complexities per iteration. This is achieved through a new efficient technique for computing the inverse of the positive definite MLR matrix. We show that the inverse of positive definite MLR matrix is also an MLR matrix with the same sparsity in factors, and we use the recursive Sherman-Morrison-Woodbury matrix identity to obtain the factors of the inverse. Additionally, we present an algorithm that computes the Cholesky factorization of an expanded matrix with linear time and space complexities, yielding the covariance matrix as its Schur complement. This paper is accompanied by an open-source package that implements the proposed methods.

Introduction

In fields ranging from genomics to finance, data is rarely a flat table; it typically exhibits a nested hierarchy. For instance, cells belong to tissues, which belong to donors; stocks belong to industries, which belong to sectors. Capturing these relationships requires multilevel factor models (MFMs). While standard factor models explain variance through a few global latent factors, MFMs allow different factors to operate at various levels of a hierarchy.

Until now, fitting these models to massive datasets was a computational challenge. Traditional Maximum Likelihood Estimation (MLE) requires inverting covariance matrices and calculating determinants—operations that typically scale cubically ($O(n^3)$) with the number of variables $n$. For modern datasets, such as single-cell RNA sequencing with hundreds of thousands of cells, this is intractable. Parshakova, Hastie, and Boyd (2023) introduce a breakthrough algorithm that fits these complex models with linear time and storage complexity ($O(n)$), making "big hierarchy" data finally manageable.

The Multilevel Low Rank (MLR) Structure

The researchers base their work on the Multilevel Low Rank (MLR) matrix structure. An MLR matrix is essentially a sum of block-diagonal matrices, where each level of the hierarchy adds a new layer of refinement to the covariance structure.

Decomposition of a Multilevel Low Rank (MLR) matrix into a sum of block-diagonal components.

This structural definition allows the covariance of many observed variables to be represented efficiently. By exploiting this hierarchy, the authors can avoid the dense $n \times n$ matrix representations that usually lead to computational bottlenecks.

Efficient Fitting via EM and Matrix Inversion

The paper introduces three key innovations to achieve linear scaling:

  1. Tailored EM Algorithm: The authors adapt the Expectation-Maximization framework specifically for the MLR structure. By treating the latent factors as "missing data," they simplify the complex MLE problem into a series of smaller, solvable least-squares problems.
  2. Recursive Matrix Inversion: A central finding is that the inverse of a positive definite MLR matrix is also an MLR matrix with the same sparsity pattern. Using a recursive version of the Sherman-Morrison-Woodbury (SMW) identity, the inverse can be computed without ever forming a dense matrix.
  3. Expanded Matrix Cholesky: The authors present an algorithm to compute the Cholesky factorization of an "expanded" matrix. This allows them to find the determinant and the covariance matrix (as a Schur complement) in linear time and space.
Structural representation of the factors in a multilevel model, enabling linear-time computation.

Experimental Validation and Results

The approach was validated using three distinct datasets:

  • Asset Covariance Matrix: Financial data for $n=5,000$ assets over $N=300$ days, using the 6-level GICS hierarchy. The multilevel model improved the average log-likelihood by 158 units compared to a flat factor model.
  • Synthetic Data: A controlled environment with $n=10,000$ features and a 6-level random hierarchy to verify accuracy against ground truth.
  • Single-cell RNA Sequencing: A massive dataset containing immune cells ($n=280,535$ cells) and $N=500$ genes. The MLE-based method outperformed Frobenius-based approaches by 4,376 log-likelihood units.

The results demonstrate that MLE is superior to simple Frobenius norm-based fitting because it is "distribution-aware" and prevents the creation of models with unrealistic eigenvalues. Furthermore, the factors derived from the RNA dataset clearly mapped to known cell types (e.g., B cells, NK cells), confirming the model's interpretability.

Conclusion

The primary limitation of the current method is that the hierarchy and rank allocation must be pre-specified. Future work may focus on scalable heuristics to automatically discover these structures. Nevertheless, this algorithm provides a powerful tool for analyzing hierarchical data at scales previously considered impossible.

The authors have released an open-source Python package implementing these methods at: https://github.com/cvxgrp/multilevel_factor_model

Summary updated

BibTeX
@misc{parshakova2024fitting,
  author = {Tetiana Parshakova and Trevor Hastie and Stephen Boyd},
  title = {{Fitting Multilevel Factor Models}},
  year = {2024},
  eprint = {2409.12067},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2409.12067},
}
Figure