Abstract
Longitudinal study designs are indispensable for studying disease progression. Inferring covariate effects from longitudinal data, however, requires interpretable methods that can model complicated covariance structures and detect nonlinear effects of both categorical and continuous covariates, as well as their interactions. Detecting disease effects is hindered by the fact that they often occur rapidly near the disease initiation time, and this time point cannot be exactly observed. An additional challenge is that the effect magnitude can be heterogeneous over the subjects. We present lgpr, a widely applicable and interpretable method for nonparametric analysis of longitudinal data using additive Gaussian processes. We demonstrate that it outperforms previous approaches in identifying the relevant categorical and continuous covariates in various settings. Furthermore, it implements important novel features, including the ability to account for the heterogeneity of covariate effects, their temporal uncertainty, and appropriate observation models for different types of biomedical data. The lgpr tool is implemented as a comprehensive and user-friendly R-package.
Introduction
Longitudinal studies, which track the same individuals over multiple time points, represent the gold standard for understanding the trajectory of chronic diseases. However, the statistical analysis of such data is fraught with challenges. Standard tools, such as Linear Mixed Models (LMMs), typically assume linear relationships that rarely reflect the complexity of biological systems. Furthermore, biological data is often characterized by heterogeneity—where disease signals appear only in a subset of the cohort—and temporal uncertainty, where the biological onset of a disease precedes clinical diagnosis by an unknown duration.
To address these limitations, we introduce lgpr, an R package that utilizes additive Gaussian Processes (GPs) to provide a flexible, interpretable, and robust framework for longitudinal data analysis. By decomposing signals into interpretable components, lgpr allows researchers to distinguish between normal physiological changes (e.g., aging) and disease-specific deviations.
The lgpr Framework
The core of lgpr is the Additive Gaussian Process. Rather than treating the data as a black box, the model decomposes the signal into a sum of distinct, interpretable components:
$$f(x) = f_{age}(x) + f_{id}(x) + f_{disease}(x) + \dots$$
Key Methodological Innovations
- Novel Kernels: The framework introduces a "variance masking" kernel to model effects that only manifest after a specific event (like disease onset) and a "heterogeneity" kernel that allows the magnitude of an effect to vary across individuals.
- Zero-Sum Constraints: To ensure identifiability and interpretability,
lgpruses specialized kernels that constrain category-specific deviations (e.g., sex or group) to sum to zero around the shared mean. - Non-Gaussian Likelihoods: Recognizing that modern "omics" data often consists of counts,
lgprsupports Poisson, Binomial, and Negative Binomial observation models, moving beyond the standard Gaussian noise assumption. - Bayesian Inference via Stan: The model utilizes Hamiltonian Monte Carlo (HMC) through the Stan programming language. This provides full posterior distributions for all parameters, allowing for a rigorous quantification of uncertainty.
Addressing Heterogeneity and Temporal Uncertainty
A significant hurdle in clinical studies is that the "true" biological onset of a disease is rarely observed. lgpr treats the disease initiation time as a latent variable with its own prior distribution. This allows the model to "align" the biological clocks of different subjects even when their clinical diagnosis dates are inconsistent.
Furthermore, to handle heterogeneity, lgpr employs a sparsity-inducing Beta(0.2, 0.2) prior on individual effect magnitudes. This prior encourages the model to categorize individuals as either "affected" or "unaffected," effectively performing automated subgroup discovery within the longitudinal framework.
Experimental Validation
The authors validated lgpr across three distinct scenarios:
- Simulated Benchmarks: In controlled environments,
lgprachieved near-perfect variable selection performance (AUC ≈ 0.99) as sample sizes increased. Notably, it was approximately 5x faster than the previous state-of-the-art GP method,LonGP, while maintaining higher accuracy. - Longitudinal Proteomics: In a study of 1,538 proteins in children at risk for Type 1 Diabetes (T1D), the heterogeneous model identified 66 proteins associated with the disease. In contrast, a standard homogeneous model identified only 38, suggesting that traditional methods frequently overlook signals that do not manifest uniformly across all patients.
- Longitudinal RNA-seq: The model demonstrated robustness in sparse, noisy CD4+ T cell gene expression data, successfully identifying 12 high-interest genes linked to T1D progression where traditional methods often struggle.
Conclusion
lgpr represents a significant advancement in the nonparametric analysis of longitudinal data. By prioritizing interpretability and accounting for the inherent messiness of biological data—specifically heterogeneity and temporal uncertainty—it provides a powerful tool for clinical discovery. While the current implementation faces the standard $O(N^3)$ scaling limitations of Gaussian Processes, it remains highly efficient for typical biomedical study sizes. Future work involving basis function approximations may further extend its utility to larger-scale "Big Data" applications.
The lgpr package is available at jtimonen.github.io/lgpr-usage with comprehensive documentation and tutorials.
Summary updated