Clustering longitudinal multivariate trajectories using an ensemble of principal component trees Authors: Bastian Pfeifer, Simon Grabner, Andrea Berghold, Markus Loecher Published: 2026 ABSTRACT PurposeClustering longitudinal data is challenging, particularly when measurements are high-dimensional, irregularly sampled, or noisy. We aim to provide a flexible and interpretable framework for identifying meaningful temporal subgroups and their key features.MethodsWe introduce TAPIO, an ensemble-based clustering approach with longitudinal extensions, including longTAPIOtrajectories, longTAPIOsample, and longTAPIOMLD. These variants integrate dimension reduction and cluster-specific feature importance, allowing robust clustering of univariate and multivariate trajectories, as well as regularly and irregularly sampled longitudinal data.ResultsSimulation studies demonstrate that TAPIO accurately recovers cluster structure, identifies relevant features, and performs competitively with existing methods. longTAPIOtrajectories excels on regularly sampled data, while longTAPIOMLD outperforms alternatives for irregular measurements. Applications on a clinical cohort reveal patient subgroups with distinct survival patterns driven by key cardiac measures, and analyses of high-dimensional longitudinal proteomics data uncover molecularly distinct clusters with interpretable protein-level importance profiles.ConclusionTAPIO offers a scalable, interpretable framework for longitudinal clustering that accommodates complex multivariate trajectories and high-dimensional data. Its ability to identify both meaningful clusters and their defining features has potential to advance patient stratification, biomarker discovery, and longitudinal data analysis in biomedical research. Introduction The increasing dimensionality and complexity of biomedical data pose significant challenges for identifying interpretable and clinically meaningful patterns. Clustering is an essential technique for high-dimensional data analysis because it can reveal novel patterns in complex, noisy datasets [1]. In biomedical applications, clustering biomarkers or clinical variables across patients helps to identify shared molecular or phenotypic profiles, enabling the detection of clinically meaningful subgroups and uncovering sources of patient-level heterogeneity [2–4]. In longitudinal multivariate settings, where multiple biomarkers or clinical variables are measured repeatedly over time, advanced clustering techniques are particularly important. The capability to cluster temporal trajectories, enables the identification of dynamic patterns of disease progression and treatment response over time. These trajectory-based clusters support precision medicine by delineating biologically and clinically meaningful subgroups, facilitating disease-subtype discovery and improving risk stratification [5–7]. However, the number of available methods remain small, and existing methods frequently lack sufficient interpretability to support reliable clinical or biological insight [8] and/or are not well-suited for high-dimensional data analysis. Here, we present our novel methodology called TAPIO (Tree Affinities with Principal Components) and its extension longTAPIO for clustering multivariate longitudinal trajectories. TAPIO is an ensemble clustering framework developed for high-dimensional data that repeatedly samples small subsets of features, embeds them via Principal Component Analysis (PCA), and aggregates multi-level hierarchical partitions into a stable affinity matrix. This feature-sampling strategy enhances robustness while avoiding the curse of dimensionality, and the loadings of the principal components naturally provide cluster-specific feature importance scores, giving the method strong interpretability. The longTAPIO method extends this idea to longitudinal data by extracting one-dimensional representations of irregular or regularly sampled trajectories and constructing subject-wise distances before ensemble clustering, enabling interpretable patient stratification directly from temporal biomarker profiles. It should be noted that the core TAPIO algorithm has already been shown to perform well on high-dimensional omics data for disease subtype discovery (see [9]). In the presented paper, we focus primarily on extending TAPIO to longitudinal settings and improving the overall interpretability of the resulting cluster solutions. The manuscript is organized as follows. Related work section reviews related work and motivates the proposed methodology. Proposed methods section introduces the proposed TAPIO algorithm and its extensions to the longitudinal data setting. Evaluation strategy section describes the evaluation strategy on synthetic and real-world data, and Results and discussion section presents and discusses the obtained results. Summary and outlook section concludes with a summary, a discussion of the limitations of the proposed methods and potential avenues for future work. Related work A comprehensive review of available methods for longitudinal feature clustering is presented in [5]. The authors review and evaluate model-based [10–12] as well as algorithmic-based [13–15] clustering techniques. Our longTAPIO algorithm falls within the class of algorithmic-based approaches, which offer several advantages, particularly for high-dimensional longitudinal data analyses. They typically do not require assumptions about the functional form of trajectories or random-effect distributions, making them highly flexible for complex patterns. They are also computationally efficient and scale well with a large number of features, repeated measurements, and individuals. When the number of clusters is known a priori, algorithmic methods such as k-means can provide strong clustering performance while maintaining high computational efficiency. In [14], for instance, the KmL3D framework was introduced, employing a specialized version of k-means to cluster joint multivariate trajectories. The distance metric between individuals is defined as the Minkowski distance between their respective trajectory matrices. For example, the distance between subjects 1 and 2 is simply11\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} \textrm{Dist}\!\left( y_{1\cdot \cdot },\, y_{2\cdot \cdot }\right) = \left( \sum \limits _{t,j} \left| y_{1tj} - y_{2tj} \right| ^{p} \right) ^{1/p}, \end{aligned}$$\end{document}where in the case of multivariate time series for each subject i, and time t we denote the j-th measured outcome by \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$y_{itj}$$\end{document} and use the short form \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$y_{i . .}$$\end{document} to represent the entire joint variable trajectory of subject i. Note that we can drop the third index for the case of scalar time series. We point out that Eq. 1 necessarily assumes (i) perfect time alignment and (ii) no missing values for all measured outcomes for all subjects. Furthermore, analogously to k-means clustering, individual trajectories \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$y_{i t .}$$\end{document} need to be on similar scales so that the sum in Eq. 1 is not dominated by some components j. In [13], an algorithmic-based hierarchical agglomerative clustering method for multivariate longitudinal data, called clusterMLD, was introduced. Its dissimilarity metric is inspired by the Chow test statistic and employs B-splines to quantify the merging cost between two groups of trajectories. Notably, unlike KmL3D [14], clusterMLD can efficiently handle sparse and irregular repeated measurements. However, both approaches lack interpretability, as they do not identify the features that characterize each cluster. This limitation is particularly critical in domains such as medicine and constitutes one of the core contributions of our manuscript. Proposed methods The proposed TAPIO method consists of three novel developments. First, instead of performing clustering based on the entire dataset, including the full set of features, we suggest that a certain amount of features are sampled without replacement and to compute the first principal component based on this data subset. Hierarchical clustering is then executed on this embedded single feature to construct a dendrogram, which ultimately is split at multiple levels to derive multiple cluster partitions. These partitions are utilized to generate an affinity matrix. This process is iterated multiple times, resulting in an ensemble of affinity matrices, which are aggregated into a single matrix on which hierarchical clustering is performed. Second, based on the above described scheme, we evaluate cluster-specific feature relevance by computing the contribution of each feature to the principal components. For each ensemble member, the feature contribution to the principal component is scaled by the pair-wise affinity of the elements of the considered cluster. Third, we propose longTAPIO which extends TAPIO to longitudinal multivariate data by extracting one-dimensional representations of irregular or regularly sampled trajectories. The TAPIO algorithm Let’s denote the input tabular data as X, where X is an n × p matrix, with n samples (patients) and p features. Each row of X represents a patient, and each column represents a feature. Our developed algorithm consists of five steps: Feature Sampling: Randomly select a subset of k features from the dataset X to construct a new n × k matrix termed X'.Principal Component Analysis (PCA): Reduce the dimensionality of the matrix X' via PCA. This entails performing eigendecomposition of the covariance matrix \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\Sigma ' = \frac{1}{n} X'^T X'$$\end{document} to obtain its eigenvectors \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$v_i$$\end{document} and corresponding eigenvalues \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\lambda _i$$\end{document} (with i ranging from 1 to k), selecting the q eigenvectors corresponding to the q largest eigenvalues to form the matrix \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$V_q$$\end{document}, and projecting the matrix X' onto the subspace spanned by the first q principal components: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Z = X'V_q$$\end{document}. Here, Z is the n × q matrix of the first q principal components of X'. In this context, q = 1 as only the very first principal component is considered.Hierarchical Clustering: Apply hierarchical clustering on the reduced data Z to obtain a dendrogram.Dendrogram Cutting: Cut the dendrogram at the first d levels, resulting in a set of d partitions \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathcal {C}^e$$\end{document}, with e ranging from 1 to d, where each partition \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathcal {C}^e = \{ C_1, C_2, .., C_s\}$$\end{document} assigns each of the n data samples to a cluster C. Then, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$C^e(i) = C_f$$\end{document} indicates that, at level e, patient i is assigned to the cluster \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$C_f \in \mathcal {C}^e$$\end{document}.Affinity Matrix Construction: Construct the n × n affinity matrix A based on the resulting partitions, such that each entry \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$A_{ij}$$\end{document} represents the strength of the affinity between patient i and patient j across the partitions. This is computed as the proportion of samples that fall in the same cluster: 2\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} A_{ij} = \frac{1}{d} \sum \limits _{e=1}^{d} \left\{ \begin{array}{ll} 1 & \text {if } C^e(i) = C^e(j) \\ 0 & \text {otherwise} \end{array}\right. \end{aligned}$$\end{document} Feature Sampling: Randomly select a subset of k features from the dataset X to construct a new n × k matrix termed X'. Feature Sampling: Randomly select a subset of k features from the dataset X to construct a new n × k matrix termed X'. Principal Component Analysis (PCA): Reduce the dimensionality of the matrix X' via PCA. This entails performing eigendecomposition of the covariance matrix \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\Sigma ' = \frac{1}{n} X'^T X'$$\end{document} to obtain its eigenvectors \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$v_i$$\end{document} and corresponding eigenvalues \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\lambda _i$$\end{document} (with i ranging from 1 to k), selecting the q eigenvectors corresponding to the q largest eigenvalues to form the matrix \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$V_q$$\end{document}, and projecting the matrix X' onto the subspace spanned by the first q principal components: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Z = X'V_q$$\end{document}. Here, Z is the n × q matrix of the first q principal components of X'. In this context, q = 1 as only the very first principal component is considered. Principal Component Analysis (PCA): Reduce the dimensionality of the matrix X' via PCA. This entails performing eigendecomposition of the covariance matrix \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\Sigma ' = \frac{1}{n} X'^T X'$$\end{document} to obtain its eigenvectors \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$v_i$$\end{document} and corresponding eigenvalues \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\lambda _i$$\end{document} (with i ranging from 1 to k), selecting the q eigenvectors corresponding to the q largest eigenvalues to form the matrix \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$V_q$$\end{document}, and projecting the matrix X' onto the subspace spanned by the first q principal components: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Z = X'V_q$$\end{document}. Here, Z is the n × q matrix of the first q principal components of X'. In this context, q = 1 as only the very first principal component is considered. Hierarchical Clustering: Apply hierarchical clustering on the reduced data Z to obtain a dendrogram. Hierarchical Clustering: Apply hierarchical clustering on the reduced data Z to obtain a dendrogram. Dendrogram Cutting: Cut the dendrogram at the first d levels, resulting in a set of d partitions \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathcal {C}^e$$\end{document}, with e ranging from 1 to d, where each partition \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathcal {C}^e = \{ C_1, C_2, .., C_s\}$$\end{document} assigns each of the n data samples to a cluster C. Then, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$C^e(i) = C_f$$\end{document} indicates that, at level e, patient i is assigned to the cluster \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$C_f \in \mathcal {C}^e$$\end{document}. Dendrogram Cutting: Cut the dendrogram at the first d levels, resulting in a set of d partitions \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathcal {C}^e$$\end{document}, with e ranging from 1 to d, where each partition \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathcal {C}^e = \{ C_1, C_2, .., C_s\}$$\end{document} assigns each of the n data samples to a cluster C. Then, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$C^e(i) = C_f$$\end{document} indicates that, at level e, patient i is assigned to the cluster \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$C_f \in \mathcal {C}^e$$\end{document}. Affinity Matrix Construction: Construct the n × n affinity matrix A based on the resulting partitions, such that each entry \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$A_{ij}$$\end{document} represents the strength of the affinity between patient i and patient j across the partitions. This is computed as the proportion of samples that fall in the same cluster: 2\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} A_{ij} = \frac{1}{d} \sum \limits _{e=1}^{d} \left\{ \begin{array}{ll} 1 & \text {if } C^e(i) = C^e(j) \\ 0 & \text {otherwise} \end{array}\right. \end{aligned}$$\end{document} Affinity Matrix Construction: Construct the n × n affinity matrix A based on the resulting partitions, such that each entry \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$A_{ij}$$\end{document} represents the strength of the affinity between patient i and patient j across the partitions. This is computed as the proportion of samples that fall in the same cluster: 2\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} A_{ij} = \frac{1}{d} \sum \limits _{e=1}^{d} \left\{ \begin{array}{ll} 1 & \text {if } C^e(i) = C^e(j) \\ 0 & \text {otherwise} \end{array}\right. \end{aligned}$$\end{document} The above described procedure is executed M times for the construction of an ensemble consisting of M affinity matrices \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathcal {A} = \{ A^{(1)}, A^{(2)}, \ldots , A^{(M)}\}.$$\end{document} We aggregate these affinity matrices into a single matrix A using element-wise summation:3\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} A_{agg} = \sum \limits _{m=1}^M A^{(m)}, \end{aligned}$$\end{document} To obtain the final clustering solution, we apply hierarchical agglomerative clustering using Ward’s minimum variance criterion [16]. First, the aggregated affinity matrix is transformed into a dissimilarity representation defined as4\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} D_{agg} = 1 - \frac{A_{agg}}{\max _{i,j} A_{agg}}. \end{aligned}$$\end{document} Ward’s method is then applied to this dissimilarity matrix, where the linkage criterion defines the distance between two clusters A and B as the increase in within-cluster variance resulting from their merger:5\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} \Delta (A,B) = \frac{|A|\,|B|}{|A|+|B|} \, \Vert \mu _A - \mu _B\Vert _2^2, \end{aligned}$$\end{document}where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mu _A$$\end{document} and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mu _B$$\end{document} denote the centroids of clusters A and B, respectively. At each step, the pair of clusters minimizing Δ (A,B) is merged, yielding a hierarchical clustering tree. The final partition is obtained by cutting this dendrogram at the desired level. The longTAPIO algorithm for longitudinal data We propose and investigate three different adaptations of TAPIO to longitudinal data. Starting with multivariate longitudinal data X of dimension \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$(n\cdot T) \times p$$\end{document} in a long format (each row is a subject \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$i \in \{1, \ldots , n\}$$\end{document} observed at a time \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$t \in \{1, \ldots , T\}$$\end{document}), we add one more sampling step to the algorithm described in The TAPIO algorithm section: At each iteration, we sample not only k features but also one row (time of measurement) from each patient. For sufficiently large numbers of M iterations we would actually cover all the multiple time trajectories from each user. In this way, the clustering algorithm would take the entire variability of each user into account and not just the first moment. It is evident that averaging replicated data for each subject, or even the first principal component, results in a loss of information as intra-subject variation is effectively smoothed out. In the remainder of this manuscript, we refer to this method as longTAPIOsample. The most similar approach to our method that we found in the literature is the subject-level bootstrapping strategy [17, 18], where bootstrap resampling is conducted at the subject level, and all observations from the chosen subjects are treated as in-bag samples. It should be noted that longTAPIOsample ignores any temporal ordering of the repeated measures.To account for the temporal ordering, we execute the first two steps of the TAPIO algorithm and convert this univariate \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$(n\cdot T) \times 1$$\end{document} matrix Z to a subject-wise wide format n × T and compute a distance matrix \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$D_{n \times n}$$\end{document} according to Eq. 12. We then continue with step 3 of the TAPIO algorithm using D as the input to the hierarchical clustering algorithm. As commented earlier, this method needs perfect time alignment of the observed variables. In the remainder of this manuscript, we refer to this method as longTAPIOtrajectories.We now allow for irregularly sampled time series, i.e. we assume that the ith subject has \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$n_i$$\end{document} (multivariate) observations \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$X_{i 1 l}, \ldots , X_{i n_i l}$$\end{document} (l = 1, … , p), made at times \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\textbf{t}_i=\left\{ t_{i j}\right\} _{j=1}^{n_i}$$\end{document}. The observation times are subject-specific, and they do not have to be common across subjects. As above, we execute the first two steps of the TAPIO algorithm to obtain a univariate matrix \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Z_{(\sum _i{n_i}) \times 1}$$\end{document} from which we extract the univariate longitudinal trajectory for the ith subject denoted by \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Y_{i j}$$\end{document}. Immediately following [13], we decompose each trajectory as \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Y_{i j}=f_i\left( t_{i j}\right) +e_i\left( t_{i j}\right)$$\end{document}, where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f_i(t_{i j}) = \mathbf {X_{ij}} \cdot \mathbf {\beta _i}$$\end{document} is the fixed component approximated by P (default P=7) B-spline basis functions, and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$e_i(\cdot )$$\end{document} is the random component with mean zero. As a metric of dissimilarity between two sets of longitudinal data we adapt equation 4 from [13] as is: 6\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} \mathscr {D}\left( \mathscr {C}_u, \mathscr {C}_v\right) =\frac{\left( \textrm{SSR}\left( \mathscr {C}_{u, v}\right) -\textrm{SSR}\left( \mathscr {C}_u\right) -\textrm{SSR}\left( \mathscr {C}_v\right) \right) / P}{\left( \textrm{SSR}\left( \mathscr {C}_u\right) +\textrm{SSR}\left( \mathscr {C}_v\right) \right) /\left( n_u+n_v-2 P\right) } \end{aligned}$$\end{document} where we denote the observed data associated with cluster \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$c_k$$\end{document} as \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathscr {C}_k:=\left\{ \left( \textbf{X}_{i j}, Y_{i j}\right) _{i \in c_k, j=1, \ldots , r_i}\right\} , \quad k=1,2, \ldots , K$$\end{document}. The structure of Eq. 6 mirrors that of the Chow-test statistic [19], which was originally introduced to determine whether two datasets originate from the same linear model. Here, the sum of squared residuals (SSR) are obtained as 7\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} \textrm{SSR}\left( \mathscr {C}_k\right) =\sum \limits _{i \in c_k} \sum \limits _{j=1}^{n_i}\left( Y_{i j}-\hat{Y}_{i j}\right) ^2, n_u=\sum \limits _{i \in c_u} n_i, \end{aligned}$$\end{document} with \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\hat{Y}_{i j} = \hat{f}_{c_k}(t_{i j}) = \mathbf {X_{ij}} \cdot \hat{\beta _{\textbf{k}}}$$\end{document}, where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\hat{\beta _{\textbf{k}}}$$\end{document} is the ordinary least-squares estimate for \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathbf {\beta _k}$$\end{document}, the identical B-spline coefficients for all \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$i \in c_k$$\end{document}, using all the data in \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathscr {C}_k$$\end{document}. The central idea of this approach is to compare longitudinal trajectories based on their overall shapes rather than individual observation times. To this end, each subject-specific trajectory is approximated using a spline-based representation, which allows us to compare groups based on smooth fitted curves instead of raw data points. Equation (6) formalizes this comparison by measuring how much the fit worsens when two clusters are combined. Specifically, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\textrm{SSR}(\mathscr {C}_{u,v})$$\end{document} measures the model error when both clusters are fitted together, while \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\textrm{SSR}(\mathscr {C}_u)$$\end{document} and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\textrm{SSR}(\mathscr {C}_v)$$\end{document} measure the errors when the clusters are modeled separately. The numerator captures the additional error introduced by forcing a shared model, and the denominator scales this value to make it comparable across different cluster sizes and variability levels. As a result, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathscr {D}(\mathscr {C}_u,\mathscr {C}_v)$$\end{document} can be interpreted as a normalized measure of how different the two groups are in their temporal patterns, with larger values indicating more distinct trajectories. In the remainder of this manuscript, we refer to this method as longTAPIOMLD. Starting with multivariate longitudinal data X of dimension \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$(n\cdot T) \times p$$\end{document} in a long format (each row is a subject \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$i \in \{1, \ldots , n\}$$\end{document} observed at a time \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$t \in \{1, \ldots , T\}$$\end{document}), we add one more sampling step to the algorithm described in The TAPIO algorithm section: At each iteration, we sample not only k features but also one row (time of measurement) from each patient. For sufficiently large numbers of M iterations we would actually cover all the multiple time trajectories from each user. In this way, the clustering algorithm would take the entire variability of each user into account and not just the first moment. It is evident that averaging replicated data for each subject, or even the first principal component, results in a loss of information as intra-subject variation is effectively smoothed out. In the remainder of this manuscript, we refer to this method as longTAPIOsample. The most similar approach to our method that we found in the literature is the subject-level bootstrapping strategy [17, 18], where bootstrap resampling is conducted at the subject level, and all observations from the chosen subjects are treated as in-bag samples. It should be noted that longTAPIOsample ignores any temporal ordering of the repeated measures. Starting with multivariate longitudinal data X of dimension \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$(n\cdot T) \times p$$\end{document} in a long format (each row is a subject \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$i \in \{1, \ldots , n\}$$\end{document} observed at a time \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$t \in \{1, \ldots , T\}$$\end{document}), we add one more sampling step to the algorithm described in The TAPIO algorithm section: At each iteration, we sample not only k features but also one row (time of measurement) from each patient. For sufficiently large numbers of M iterations we would actually cover all the multiple time trajectories from each user. In this way, the clustering algorithm would take the entire variability of each user into account and not just the first moment. It is evident that averaging replicated data for each subject, or even the first principal component, results in a loss of information as intra-subject variation is effectively smoothed out. In the remainder of this manuscript, we refer to this method as longTAPIOsample. The most similar approach to our method that we found in the literature is the subject-level bootstrapping strategy [17, 18], where bootstrap resampling is conducted at the subject level, and all observations from the chosen subjects are treated as in-bag samples. It should be noted that longTAPIOsample ignores any temporal ordering of the repeated measures. To account for the temporal ordering, we execute the first two steps of the TAPIO algorithm and convert this univariate \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$(n\cdot T) \times 1$$\end{document} matrix Z to a subject-wise wide format n × T and compute a distance matrix \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$D_{n \times n}$$\end{document} according to Eq. 12. We then continue with step 3 of the TAPIO algorithm using D as the input to the hierarchical clustering algorithm. As commented earlier, this method needs perfect time alignment of the observed variables. In the remainder of this manuscript, we refer to this method as longTAPIOtrajectories. To account for the temporal ordering, we execute the first two steps of the TAPIO algorithm and convert this univariate \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$(n\cdot T) \times 1$$\end{document} matrix Z to a subject-wise wide format n × T and compute a distance matrix \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$D_{n \times n}$$\end{document} according to Eq. 12. We then continue with step 3 of the TAPIO algorithm using D as the input to the hierarchical clustering algorithm. As commented earlier, this method needs perfect time alignment of the observed variables. In the remainder of this manuscript, we refer to this method as longTAPIOtrajectories. We now allow for irregularly sampled time series, i.e. we assume that the ith subject has \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$n_i$$\end{document} (multivariate) observations \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$X_{i 1 l}, \ldots , X_{i n_i l}$$\end{document} (l = 1, … , p), made at times \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\textbf{t}_i=\left\{ t_{i j}\right\} _{j=1}^{n_i}$$\end{document}. The observation times are subject-specific, and they do not have to be common across subjects. As above, we execute the first two steps of the TAPIO algorithm to obtain a univariate matrix \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Z_{(\sum _i{n_i}) \times 1}$$\end{document} from which we extract the univariate longitudinal trajectory for the ith subject denoted by \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Y_{i j}$$\end{document}. Immediately following [13], we decompose each trajectory as \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Y_{i j}=f_i\left( t_{i j}\right) +e_i\left( t_{i j}\right)$$\end{document}, where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f_i(t_{i j}) = \mathbf {X_{ij}} \cdot \mathbf {\beta _i}$$\end{document} is the fixed component approximated by P (default P=7) B-spline basis functions, and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$e_i(\cdot )$$\end{document} is the random component with mean zero. As a metric of dissimilarity between two sets of longitudinal data we adapt equation 4 from [13] as is: 6\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} \mathscr {D}\left( \mathscr {C}_u, \mathscr {C}_v\right) =\frac{\left( \textrm{SSR}\left( \mathscr {C}_{u, v}\right) -\textrm{SSR}\left( \mathscr {C}_u\right) -\textrm{SSR}\left( \mathscr {C}_v\right) \right) / P}{\left( \textrm{SSR}\left( \mathscr {C}_u\right) +\textrm{SSR}\left( \mathscr {C}_v\right) \right) /\left( n_u+n_v-2 P\right) } \end{aligned}$$\end{document} where we denote the observed data associated with cluster \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$c_k$$\end{document} as \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathscr {C}_k:=\left\{ \left( \textbf{X}_{i j}, Y_{i j}\right) _{i \in c_k, j=1, \ldots , r_i}\right\} , \quad k=1,2, \ldots , K$$\end{document}. The structure of Eq. 6 mirrors that of the Chow-test statistic [19], which was originally introduced to determine whether two datasets originate from the same linear model. Here, the sum of squared residuals (SSR) are obtained as 7\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} \textrm{SSR}\left( \mathscr {C}_k\right) =\sum \limits _{i \in c_k} \sum \limits _{j=1}^{n_i}\left( Y_{i j}-\hat{Y}_{i j}\right) ^2, n_u=\sum \limits _{i \in c_u} n_i, \end{aligned}$$\end{document} with \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\hat{Y}_{i j} = \hat{f}_{c_k}(t_{i j}) = \mathbf {X_{ij}} \cdot \hat{\beta _{\textbf{k}}}$$\end{document}, where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\hat{\beta _{\textbf{k}}}$$\end{document} is the ordinary least-squares estimate for \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathbf {\beta _k}$$\end{document}, the identical B-spline coefficients for all \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$i \in c_k$$\end{document}, using all the data in \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathscr {C}_k$$\end{document}. The central idea of this approach is to compare longitudinal trajectories based on their overall shapes rather than individual observation times. To this end, each subject-specific trajectory is approximated using a spline-based representation, which allows us to compare groups based on smooth fitted curves instead of raw data points. Equation (6) formalizes this comparison by measuring how much the fit worsens when two clusters are combined. Specifically, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\textrm{SSR}(\mathscr {C}_{u,v})$$\end{document} measures the model error when both clusters are fitted together, while \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\textrm{SSR}(\mathscr {C}_u)$$\end{document} and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\textrm{SSR}(\mathscr {C}_v)$$\end{document} measure the errors when the clusters are modeled separately. The numerator captures the additional error introduced by forcing a shared model, and the denominator scales this value to make it comparable across different cluster sizes and variability levels. As a result, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathscr {D}(\mathscr {C}_u,\mathscr {C}_v)$$\end{document} can be interpreted as a normalized measure of how different the two groups are in their temporal patterns, with larger values indicating more distinct trajectories. In the remainder of this manuscript, we refer to this method as longTAPIOMLD. We now allow for irregularly sampled time series, i.e. we assume that the ith subject has \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$n_i$$\end{document} (multivariate) observations \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$X_{i 1 l}, \ldots , X_{i n_i l}$$\end{document} (l = 1, … , p), made at times \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\textbf{t}_i=\left\{ t_{i j}\right\} _{j=1}^{n_i}$$\end{document}. The observation times are subject-specific, and they do not have to be common across subjects. As above, we execute the first two steps of the TAPIO algorithm to obtain a univariate matrix \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Z_{(\sum _i{n_i}) \times 1}$$\end{document} from which we extract the univariate longitudinal trajectory for the ith subject denoted by \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Y_{i j}$$\end{document}. Immediately following [13], we decompose each trajectory as \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Y_{i j}=f_i\left( t_{i j}\right) +e_i\left( t_{i j}\right)$$\end{document}, where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f_i(t_{i j}) = \mathbf {X_{ij}} \cdot \mathbf {\beta _i}$$\end{document} is the fixed component approximated by P (default P=7) B-spline basis functions, and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$e_i(\cdot )$$\end{document} is the random component with mean zero. As a metric of dissimilarity between two sets of longitudinal data we adapt equation 4 from [13] as is: 6\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} \mathscr {D}\left( \mathscr {C}_u, \mathscr {C}_v\right) =\frac{\left( \textrm{SSR}\left( \mathscr {C}_{u, v}\right) -\textrm{SSR}\left( \mathscr {C}_u\right) -\textrm{SSR}\left( \mathscr {C}_v\right) \right) / P}{\left( \textrm{SSR}\left( \mathscr {C}_u\right) +\textrm{SSR}\left( \mathscr {C}_v\right) \right) /\left( n_u+n_v-2 P\right) } \end{aligned}$$\end{document} where we denote the observed data associated with cluster \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$c_k$$\end{document} as \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathscr {C}_k:=\left\{ \left( \textbf{X}_{i j}, Y_{i j}\right) _{i \in c_k, j=1, \ldots , r_i}\right\} , \quad k=1,2, \ldots , K$$\end{document}. The structure of Eq. 6 mirrors that of the Chow-test statistic [19], which was originally introduced to determine whether two datasets originate from the same linear model. Here, the sum of squared residuals (SSR) are obtained as 7\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} \textrm{SSR}\left( \mathscr {C}_k\right) =\sum \limits _{i \in c_k} \sum \limits _{j=1}^{n_i}\left( Y_{i j}-\hat{Y}_{i j}\right) ^2, n_u=\sum \limits _{i \in c_u} n_i, \end{aligned}$$\end{document} with \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\hat{Y}_{i j} = \hat{f}_{c_k}(t_{i j}) = \mathbf {X_{ij}} \cdot \hat{\beta _{\textbf{k}}}$$\end{document}, where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\hat{\beta _{\textbf{k}}}$$\end{document} is the ordinary least-squares estimate for \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathbf {\beta _k}$$\end{document}, the identical B-spline coefficients for all \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$i \in c_k$$\end{document}, using all the data in \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathscr {C}_k$$\end{document}. The central idea of this approach is to compare longitudinal trajectories based on their overall shapes rather than individual observation times. To this end, each subject-specific trajectory is approximated using a spline-based representation, which allows us to compare groups based on smooth fitted curves instead of raw data points. Equation (6) formalizes this comparison by measuring how much the fit worsens when two clusters are combined. Specifically, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\textrm{SSR}(\mathscr {C}_{u,v})$$\end{document} measures the model error when both clusters are fitted together, while \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\textrm{SSR}(\mathscr {C}_u)$$\end{document} and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\textrm{SSR}(\mathscr {C}_v)$$\end{document} measure the errors when the clusters are modeled separately. The numerator captures the additional error introduced by forcing a shared model, and the denominator scales this value to make it comparable across different cluster sizes and variability levels. As a result, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathscr {D}(\mathscr {C}_u,\mathscr {C}_v)$$\end{document} can be interpreted as a normalized measure of how different the two groups are in their temporal patterns, with larger values indicating more distinct trajectories. In the remainder of this manuscript, we refer to this method as longTAPIOMLD. Feature importance Feature importance is derived from the contribution of the original features to the principal components computed within each ensemble member. For a subset of k sampled features and q principal components, the PCA yields feature contribution values that measure how strongly each feature contributes to the corresponding component. Within the constructed ensemble, let8\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} \textbf{w}^{(m)} = (w^{(m)}_{1}, \ldots , w^{(m)}_{p})^\top \end{aligned}$$\end{document}denote the vector of feature contributions obtained for the \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$m^{\text {th}}$$\end{document} member of the ensemble. Since only the first principal component is considered in our setting (q = 1), each vector \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\textbf{w}^{(m)}$$\end{document} represents the contributions of all features to the first principal component, where only the sampled features have non-zero values. More precisely, the contribution of a single feature \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f \in \{1,\ldots , p\}$$\end{document} in the \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$m^{\text {th}}$$\end{document} ensemble member is defined based on its squared correlation with the first principal component. The feature contribution is computed as9\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} w^{(m)}_{f} = \frac{\left( \textrm{corr}^{(m)}(f,\text {PCA}_{1})\right) ^2}{\sum _{g \in S_m} \left( \textrm{corr}^{(m)}(g,\text {PCA}_{1})\right) ^2}, \end{aligned}$$\end{document}where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$S_m$$\end{document} denotes the subset of features sampled in the \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$m^{\text {th}}$$\end{document} ensemble member, and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$w^{(m)}_{f} = 0$$\end{document} for \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f \notin S_m$$\end{document}. Here, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\textrm{corr}^{(m)}(f,\text {PCA}_{1})$$\end{document} denotes the correlation between feature f and the first principal component in the \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$m^{\text {th}}$$\end{document} ensemble member. This correlation is computed from the PCA loadings as10\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} \textrm{corr}^{(m)}(f,\text {PCA}_{1}) = \ell ^{(m)}_{f,1} \, \sqrt{\lambda ^{(m)}_{1}}, \end{aligned}$$\end{document}where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\ell ^{(m)}_{f,1}$$\end{document} denotes the loading of feature f on the first principal component and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\lambda ^{(m)}_{1}$$\end{document} denotes the corresponding eigenvalue of the covariance matrix, such that \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\sqrt{\lambda ^{(m)}_{1}}$$\end{document} is the standard deviation of the first principal component. For a specific cluster C inferred from \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$A_{agg}$$\end{document} (see Eq. 3), the cluster-specific feature importance vector11\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} \mathcal {I}_{C} = (I_{C,1}, \ldots , I_{C,p})^\top \end{aligned}$$\end{document}is computed by aggregating feature contributions across all ensemble members and all pairwise sample affinities within the cluster. Specifically, the importance of a single feature \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f \in \{1,\ldots , p\}$$\end{document} for cluster C is defined as12\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} I_{C,f} = \frac{1}{|C|^{2}} \sum \limits _{m=1}^{M} w^{(m)}_{f} \sum \limits _{\begin{array}{c} i,j\in C \end{array}} A^{(m)}_{ij}. \end{aligned}$$\end{document} Consequently, features that contribute strongly to principal components and consistently associate highly affine sample pairs receive larger importance values. The resulting values in \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathcal {I}_{C}$$\end{document} are normalized by dividing by the maximum importance value observed across all clusters and features:13\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} \tilde{I}_{C,f} = \frac{I_{C,f}}{\max _{C,f} I_{C,f}}, \end{aligned}$$\end{document}where the maximum is taken over all clusters \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$C_1, \ldots , C_K$$\end{document} and features f = 1, … , p. This normalization ensures that the resulting feature importance values are comparable across clusters. Importantly, the described mechanism also applies to the longitudinal extensions of TAPIO without modification. Evaluation strategy Our evaluation strategy comprised four components. First, we assessed the performance of longTAPIO on simulated univariate trajectories (see next Synthetic longitudinal univariate data section) and compared it to the kml method [15]. It should be noted, however, that TAPIO was primarily developed for high-dimensional multivariate data, leveraging its built-in dimension reduction techniques. In the univariate case, no dimension reduction was required. In the second analysis, we compared longTAPIO and its variants to the KmL3D method [14], explicitly clustering multivariate trajectories (see Synthetic longitudinal multivariate data section). This evaluation was performed on both regularly and irregularly sampled repeated measures. However, in the case of irregularly repeated measures, KmL3D [15] was not applicable, and we instead compared against the clusterMLD method [13]. In both evaluation scenarios, we used the Adjusted Rand Index (ARI) [20] to compare the clustering performance of longTAPIO with that of the competing methods. The ARI Index measures the agreement between two partitions while correcting for agreement expected by chance. Let U denote the true partition (ground-truth) and V the computed partition of n samples. Let \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$n_{rs}$$\end{document} denote the number of samples assigned to cluster r in U and cluster s in V, with marginal cluster sizes \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$a_r = \sum _s n_{rs}$$\end{document} and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$b_s = \sum _r n_{rs}$$\end{document}. For readability, we define the following quantities: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$A = \sum _{r,s} \left( {\begin{array}{c}n_{rs}\\ 2\end{array}}\right)$$\end{document}, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$B = \sum _r \left( {\begin{array}{c}a_r\\ 2\end{array}}\right)$$\end{document}, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$C = \sum _s \left( {\begin{array}{c}b_s\\ 2\end{array}}\right)$$\end{document}, and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$D = \left( {\begin{array}{c}n\\ 2\end{array}}\right)$$\end{document}. The ARI Index is then defined as\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} \textrm{ARI} = \frac{ A - \frac{BC}{D} }{ \frac{1}{2}(B + C) - \frac{BC}{D} }. \end{aligned}$$\end{document} The ARI takes values in the interval [-1,1], where 1 indicates perfect agreement between the computed clustering solution and the ground-truth partitions. Values close to 0 indicate random agreement, and negative values indicate agreement less than expected by chance. Third, we evaluated TAPIO’s and longTAPIO’s ability to compute reliable feature importance attributes (see Cluster-specific feature importance section). Finally, we applied our algorithm to real-world data to demonstrate its practical utility (see Applications section). Unless otherwise stated, we set the number of randomly selected features to \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$k = \lfloor \sqrt{p} \rfloor$$\end{document}, following a commonly used heuristic in ensemble learning and random forest models. The number of dendrogram cut levels was set to d = K, where K denotes the true number of clusters in the simulated data. In case no ground-truth was available the number of clusters was determined by the silhouette coefficient [21]. The number of ensemble iterations was fixed to M = 500 to ensure stability of the aggregated affinity matrix while keeping computational costs manageable. Synthetic longitudinal univariate data Following the simulation set-up in [14], we define three clusters \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$C_1$$\end{document}, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$C_2$$\end{document}, and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$C_3$$\end{document}, each containing \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$n_i = 50$$\end{document} individuals. The mean trajectories of the clusters over time t are\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} \mu _1(t) = 0, \quad \mu _2(t) = -t, \quad \mu _3(t) = t. \end{aligned}$$\end{document} The function generateArtificialLongData() from the kml package includes a personal variation term that introduces between-individual variability within clusters. For an individual j in cluster i, a cluster-specific random deviation is drawn:\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} \eta _{ij} \sim \mathcal {N}(0, \tau ), \end{aligned}$$\end{document}where τ controls the magnitude of this individual-level variability. This deviation shifts the entire trajectory of individual j upward or downward while preserving the shape of the cluster trajectory. The resulting underlying trajectory for individual j becomes\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} \tilde{\mu }_{ij}(t) = \mu _i(t) + \eta _{ij}. \end{aligned}$$\end{document} The residual (within-individual) variation is modeled as\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} \varepsilon _{ij}(t) \sim \mathcal {N}(0, \sigma ). \end{aligned}$$\end{document} Thus, the observed measurement is the sum of the cluster mean, the personal deviation, and the residual noise:\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} Y_{ij}(t) = \mu _i(t) + \eta _{ij} + \varepsilon _{ij}(t). \end{aligned}$$\end{document} Explicitly, this yields\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} &Y_{1j}(t) = 0 + \eta _{1j} + \varepsilon _{1j}(t), \quad \\&Y_{2j}(t) = -t + \eta _{2j} + \varepsilon _{2j}(t), \quad \\&Y_{3j}(t) = t + \eta _{3j} + \varepsilon _{3j}(t). \end{aligned}$$\end{document} Thus, the dataset consists of three clusters of 50 individuals each, with cluster-specific linear trajectories, individual-level random deviations, and Gaussian residual noise. Synthetic longitudinal multivariate data For the multivariate part of our simulation study we followed the strategy described in [13]. A multivariate longitudinal model of the form\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} Y_{ij}^{(h)} = f_i^{(h)}(t_{ij}) + r_i(t_{ij}) + \sigma _{ih} + \varepsilon _{ijh}, \end{aligned}$$\end{document}was exploited, where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Y_{ij}^{(h)}$$\end{document} denotes the h-th outcome for subject i at measurement occasion j, and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f_i^{(h)}(\cdot )$$\end{document} represents the h-th fixed component or mean trajectory for subject i. We specified H = 5 outcomes and four underlying clusters. The cluster-specific mean trajectories \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(h)}(\cdot )$$\end{document}, h = 1,… ,5, are summarized in Table 1 and visualized in Fig. 1. The subject-specific random temporal component in Eq. (12) is modeled by a quadratic random function\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} r_i(t) = b_{i0} + b_{i1} t + b_{i2} t^2, \end{aligned}$$\end{document}where\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} (b_{i0},\, b_{i1},\, b_{i2})^\top \sim N\!\left( \textbf{0},\, \Sigma _b \right) . \end{aligned}$$\end{document} The function \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$r_i(t)$$\end{document} represents a latent subject-level trajectory that is shared across all outcomes h = 1,… ,5, thereby inducing correlation among the multivariate longitudinal responses within each subject. In the described setting, the clusters are primarily distinguished by outcomes \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Y^{(1)}$$\end{document} and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Y^{(2)}$$\end{document}, moderately by \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Y^{(3)}$$\end{document} and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Y^{(4)}$$\end{document}, while \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Y^{(5)}$$\end{document} is completely non-informative for cluster separation.Table 1Cluster-specific mean trajectoriesOutcome hMean trajectoriesh=1cluster 1: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(1)}_{c1}(t) = 8t - 0.6t^{2}$$\end{document}cluster 2: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(1)}_{c2}(t) = 20 - 6t + 0.3t^{2}$$\end{document}cluster 3: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(1)}_{c3}(t) = 0$$\end{document}cluster 4: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(1)}_{c4}(t) = 20$$\end{document}h=2cluster 1: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(2)}_{c1}(t) = t$$\end{document}cluster 2: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(2)}_{c2}(t) = -t$$\end{document}cluster 3: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(2)}_{c3}(t) = -7t + 0.5t^{2}$$\end{document}cluster 4: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(2)}_{c4}(t) = -20 + t$$\end{document}h=3cluster 1: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(3)}_{c1}(t) = -10 + 6t - 0.4t^{2}$$\end{document}cluster 2: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(3)}_{c2}(t) = -10 + 6t - 0.4t^{2}$$\end{document}cluster 3: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(3)}_{c3}(t) = 0.2t$$\end{document}cluster 4: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(3)}_{c4}(t) = 0.2t$$\end{document}h=4cluster 1: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(4)}_{c1}(t) = -1 + t$$\end{document}cluster 2: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(4)}_{c2}(t) = -1 + t$$\end{document}cluster 3: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(4)}_{c3}(t) = -1 + t$$\end{document}cluster 4: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(4)}_{c4}(t) = 10 + 2t - 0.2t^{2}$$\end{document}h=5cluster 1: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(5)}_{c1}(t) = -2t + 0.1t^{2}$$\end{document}cluster 2: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(5)}_{c2}(t) = -2t + 0.1t^{2}$$\end{document}cluster 3: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(5)}_{c3}(t) = -2t + 0.1t^{2}$$\end{document}cluster 4: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(5)}_{c4}(t) = -2t + 0.1t^{2}$$\end{document} Table 1Cluster-specific mean trajectoriesOutcome hMean trajectoriesh=1cluster 1: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(1)}_{c1}(t) = 8t - 0.6t^{2}$$\end{document}cluster 2: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(1)}_{c2}(t) = 20 - 6t + 0.3t^{2}$$\end{document}cluster 3: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(1)}_{c3}(t) = 0$$\end{document}cluster 4: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(1)}_{c4}(t) = 20$$\end{document}h=2cluster 1: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(2)}_{c1}(t) = t$$\end{document}cluster 2: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(2)}_{c2}(t) = -t$$\end{document}cluster 3: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(2)}_{c3}(t) = -7t + 0.5t^{2}$$\end{document}cluster 4: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(2)}_{c4}(t) = -20 + t$$\end{document}h=3cluster 1: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(3)}_{c1}(t) = -10 + 6t - 0.4t^{2}$$\end{document}cluster 2: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(3)}_{c2}(t) = -10 + 6t - 0.4t^{2}$$\end{document}cluster 3: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(3)}_{c3}(t) = 0.2t$$\end{document}cluster 4: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(3)}_{c4}(t) = 0.2t$$\end{document}h=4cluster 1: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(4)}_{c1}(t) = -1 + t$$\end{document}cluster 2: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(4)}_{c2}(t) = -1 + t$$\end{document}cluster 3: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(4)}_{c3}(t) = -1 + t$$\end{document}cluster 4: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(4)}_{c4}(t) = 10 + 2t - 0.2t^{2}$$\end{document}h=5cluster 1: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(5)}_{c1}(t) = -2t + 0.1t^{2}$$\end{document}cluster 2: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(5)}_{c2}(t) = -2t + 0.1t^{2}$$\end{document}cluster 3: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(5)}_{c3}(t) = -2t + 0.1t^{2}$$\end{document}cluster 4: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$f^{(5)}_{c4}(t) = -2t + 0.1t^{2}$$\end{document} Cluster-specific mean trajectories The random effects \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\sigma _{ih}$$\end{document}, h = 1,… ,5, captured correlations among the outcomes and were generated from the multivariate normal distribution\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned}\left( \begin{array}{c} \sigma _{i1}\\ \sigma _{i2}\\ \sigma _{i3}\\ \sigma _{i4}\\ \sigma _{i5} \end{array}\right) \sim \text {MVN}\!\left( 0,\; \Sigma \right) , \qquad \Sigma =\left( \begin{array}{ccccc} 1 & 0.5 & 0.3 & -0.1 & 0 \\ 0.5 & 1 & 0.2 & 0.1 & 0 \\ 0.3 & 0.2 & 1 & 0.1 & 0 \\ -0.1 & 0.1 & 0.1 & 1 & 0 \\ 0 & 0 & 0 & 0 & 1 \end{array}\right) \sigma , \end{aligned}$$\end{document}with \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\sigma = \textrm{diag}(\sigma _{1},\sigma _{2},\sigma _{3},\sigma _{4},\sigma _{5})$$\end{document}. The outcome variable \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Y^{(5)}$$\end{document} served as pure noise and was constructed to be independent of the others. Measurement errors \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\varepsilon _{ijh}$$\end{document} were sampled from either a normal distribution,\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} \varepsilon _{ijh} \sim \mathcal {N}(0,\eta ^{2}). \end{aligned}$$\end{document} The sparse and irregular observation times were generated as follows. For each subject i, the number of measurements \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$n_i$$\end{document} was drawn from a discrete uniform distribution on \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\{4,\ldots ,12\}$$\end{document}. The measurement times \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$t_{ij}$$\end{document}, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$j = 1,\ldots ,n_i$$\end{document}, were then obtained by sampling \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$n_i$$\end{document} random points from the interval (0, 11) and taking their order statistics, with the first observation time fixed at \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$t_{i1} = 0$$\end{document}. In the case of regular observation times, no random sampling was performed; instead, subjects were assigned time-aligned, consecutive measurement times. To ensure adequate temporal spacing, the interval between any two adjacent observation times was constrained to be greater than 0.5. Representative sample trajectories, color-coded by cluster, are shown in Fig. 1 for each outcome.Fig. 1Longitudinal simulated multivariate data. For each outcome variable the mean trajectories for each cluster are displayed (see Synthetic longitudinal multivariate data section for details) Longitudinal simulated multivariate data. For each outcome variable the mean trajectories for each cluster are displayed (see Synthetic longitudinal multivariate data section for details) Cluster-specific feature importance To evaluate the ability of TAPIO to produce reliable feature–importance estimates, we employed the following strategy. For each simulated cluster, features are categorised into three groups: cluster-specific (features that can uniquely identify the cluster), sub-relevant (features that collectively aid in identifying the cluster), and irrelevant (features that do not discriminate the cluster). To systematically evaluate the ability of our cluster-specific feature values to differentiate among these categories, we generated synthetic datasets that include features representing each type. Specifically, we generated 50 synthetic datasets, each comprising 13 features (4 relevant and 9 irrelevant) and sampled around cluster centers using a normal distribution \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\mathcal {N}$$\end{document} with μ =1 for the cluster-specific informative features and μ =0 for the irrelevant feature values. The standard deviation was set to 0.2 in both cases (see matrix Cluster-specific feature importance).\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} \begin{array}{lccccccccc} & V_1 & V_2 & V_3 & V_4 & V_5 & . & . & . & V_{13} \\ \text {cluster 1:} & \mathcal{N}(\mathbf{1,0.2}) & \mathcal{N}(0,0.2) & . & . & . & . & . & . & \mathcal{N}(0,0.2) \\ \text{cluster 2:} & \mathcal{N}(0,0.2) & \mathcal{N}(\mathbf{1,0.2}) & \mathcal{N}(0,0.2) & . & . & . & . & . & \mathcal{N}(0,0.2) \\ \text{cluster 3:} & \mathcal{N}(0,0.2) & \mathcal{N}(0,0.2) & \mathcal{N}(\mathbf{1,0.2}) & \mathcal{N}(0,0.2) & . & . & . & . & \mathcal{N}(0,0.2) \\ \text{cluster 4:} & \mathcal{N}(0,0.2) & \mathcal{N}(0,0.2) & \mathcal{N}(0,0.2) & \mathcal{N}(\mathbf{1,0.2}) & \mathcal{N}(0,0.2) & . & . & . & \mathcal{N}(0,0.2) \\ \end{array} \end{aligned}$$\end{document} According to this configuration, for each cluster, one of the relevant features is cluster-specific as it can uniquely distinguish the cluster from all others (e.g., \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$V_1$$\end{document} for cluster 1). On the other hand, the other relevant features are sub-relevant, as they can distinguish the cluster but only when taken together (e.g., \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$V_2$$\end{document}, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$V_3$$\end{document}, and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$V_4$$\end{document} for cluster 1). The remaining features (\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$V_5$$\end{document} through \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$V_{13}$$\end{document}) are irrelevant for all clusters. Applications Clinical cohort and longitudinal measurements We evaluated our method on the heart.valve dataset, a benchmark commonly used in the R ecosystem to demonstrate longitudinal and survival joint-modeling methods. It is included in several packages dedicated to mixed-effects and joint modeling frameworks, such as joineR [22] and joineRML[6], where it serves as an example for fitting multivariate longitudinal models, joint models, and survival analyses. The dataset originates from a prospective observational cohort of patients undergoing surgical aortic valve replacement at the Royal Brompton Hospital, London, between 1991 and 2001 [23]. The study collected repeated postoperative measurements of cardiac structure and function alongside key baseline clinical information to investigate recovery trajectories after valve surgery. For each patient, the dataset includes a unique identifier (NUM) and multiple follow-up examinations recorded at irregular time intervals (TIME), together with the maximum postoperative follow-up duration in years (FUYRS) and vital status at the end of follow-up (status; 1 = death, 0 = censored). Longitudinal outcomes considered in our analysis were left-ventricular mass index (LVMI) and ejection fraction (EF), representing structural and functional cardiac remodeling, respectively. Additional baseline covariates included body surface area (BSA) and preoperative serum creatinine (CREAT), the latter serving as a marker of renal function. The dataset is unbalanced, as the number and timing of follow-up measurements vary across individuals, making it well-suited for multivariate longitudinal clustering techniques that accommodate irregular measurement schedules and heterogeneous follow-up profiles. Longitudinal high-dimensional omics data To showcase the capability of longTAPIOtrajectories to handle high-dimensional data we retrieved data analyzed in [24]. The authors provide data of repeated measurements from the same human participants across multiple molecular layers, including bulk plasma proteomics, complete blood counts (CBC), single-cell transcriptomics (scRNA-seq), and single-cell chromatin accessibility (scATAC-seq). Longitudinal sampling in these data allows tracking within-individual temporal dynamics of proteins, gene expression, and chromatin states, capturing how molecular systems change over time due to biological processes, environmental exposures, or disease progression. By measuring multiple molecular modalities repeatedly, the study enables identification of coordinated temporal patterns, stable versus variable features, and dynamic subgroups that would remain hidden in cross-sectional analyses. Here, we put our focus on the clustering of the longitudinal bulk proteomics data to detect cluster-specific key driver genes. The data set consists of 1,156 proteins which were regularly measured from six donors over ten time-points. Results and discussion Synthetic longitudinal univariate data The simulated data on univariate trajectories (Synthetic longitudinal univariate data section) comprised three clusters, each containing \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$n_i=50$$\end{document} subjects observed on a common grid of 11 time points. Residual noise was fixed at \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\varepsilon _{ij}(t)\sim \mathcal {N}(0,1)$$\end{document}. Within-cluster variability was varied via \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\tau \in \{0.5, 1, 2, 3\}$$\end{document}, controlling the magnitude of subject-specific random shifts. The number of clusters was set to the known ground truth K = 3 for all methods. The results displayed in Fig. 2 indicate that longTAPIOtrajectories is competitive with the kml [15] method, although it is more sensitive to the introduced within-sample noise. In contrast, the longTAPIOsample approach performs worse than longTAPIOtrajectories even under moderate noise levels. It should be noted that in the univariate case, longTAPIO does not perform any dimensionality reduction nor feature sampling. The results are therefore based solely on the raw univariate longitudinal variable, which is clustered using hierarchical agglomerative clustering using Ward’s method [16].Fig. 2Results on simulated longitudinal univariate data. a Representative sample trajectories, color-coded by cluster. b Comparison of longTAPIOsample and longTAPIOtrajectories with KML while subsequently increasing the within-cluster variation (see Synthetic longitudinal univariate data section) Results on simulated longitudinal univariate data. a Representative sample trajectories, color-coded by cluster. b Comparison of longTAPIOsample and longTAPIOtrajectories with KML while subsequently increasing the within-cluster variation (see Synthetic longitudinal univariate data section) Synthetic longitudinal multivariate data The evaluation based on longitudinal multivariate trajectories was two-fold. First, we assessed the performance of the methods under investigation on regular, time-aligned observations (see Fig. 3a), comparing longTAPIOsample and longTAPIOtrajectories with KmL3D [14]. Since these methods cannot be applied to irregular time measurements, we conducted a second experiment to evaluate longTAPIOMLD and compared it with the clusterMLD [13] method. In both experiments, the subject- and variable-specific noise levels were set to \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\sigma _{i} = 3$$\end{document}, where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$i \in \{1,\ldots ,5\}$$\end{document}, and the global measurement error was set to η = 3. Each simulation was repeated 50 times. For the experiment on regular measurements shown in Fig. 3a, we randomly replaced a single \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\sigma _i$$\end{document} with a value from the interval [3, 20] in each iteration. As a result, in each iteration one feature is selected and perturbed with random noise. The number of clusters was set to the known ground truth, K = 4. The results indicate that longTAPIOsample is most affected by the introduced noise, while longTAPIOtrajectories and KmL3D [14] perform equally well. In a subsequent experiment where noise affected the entire feature space, KmL3D [14] performed slightly better than longTAPIOtrajectories. This performance drop may originate from the fact that longTAPIOtrajectories relies solely on the first principal component for each tree, which in these extreme cases may contain primarily noise. In the experiment with irregular observation times, we observed that longTAPIOMLD clearly outperformed clusterMLD [13] (see Fig. 3b). This advantage persists even when the number of clusters k is unknown and must be inferred using each method’s heuristic; in our case the silhouette coefficient [21]. However, there is a slight overall performance drop, indicating that the ground-truth value k=4 was not correctly identified in every iteration. Finally, longTAPIO correctly identifies the relevant longitudinal features (see Fig. 4). As specified in the simulation design described in Synthetic longitudinal multivariate data section, the clusters are primarily distinguished by the outcomes \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Y^{(1)}$$\end{document} and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Y^{(2)}$$\end{document}, moderately by \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Y^{(3)}$$\end{document} and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Y^{(4)}$$\end{document}, whereas \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Y^{(5)}$$\end{document} is entirely non-informative for cluster separation.Fig. 3Clustering performance on synthetic longitudinal multivariate trajectories (see Synthetic longitudinal multivariate data section). The subject and variable-specific noise levels were set to \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\sigma _{i} = 3$$\end{document}, where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$i \in \{1,...,5\}$$\end{document}. The global measurement error was set to η =3. a We randomly replaced a single \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\sigma _{i}$$\end{document} with a value out of [3, 20] in each iteration. The number of clusters is set to the known ground-truth K=4. The results are based on 50 iterations. b The longTAPIOMLD variant for irregular observation times is compared with the clusterMLD [13] method, once with K=4 fixed according to the ground truth, and once with K treated as unknown. The results are based on 50 iterations Clustering performance on synthetic longitudinal multivariate trajectories (see Synthetic longitudinal multivariate data section). The subject and variable-specific noise levels were set to \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\sigma _{i} = 3$$\end{document}, where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$i \in \{1,...,5\}$$\end{document}. The global measurement error was set to η =3. a We randomly replaced a single \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\sigma _{i}$$\end{document} with a value out of [3, 20] in each iteration. The number of clusters is set to the known ground-truth K=4. The results are based on 50 iterations. b The longTAPIOMLD variant for irregular observation times is compared with the clusterMLD [13] method, once with K=4 fixed according to the ground truth, and once with K treated as unknown. The results are based on 50 iterations Fig. 4Cluster-specific feature importance on simulated longitudinal multivariate data based on longTAPIOMLD (see Synthetic longitudinal multivariate data section and Fig. 1) Cluster-specific feature importance on simulated longitudinal multivariate data based on longTAPIOMLD (see Synthetic longitudinal multivariate data section and Fig. 1) Cluster-specific feature importance Results from the sanity checks evaluating the ability of TAPIO to compute reliable feature-importance values are shown in Fig. 5. For each cluster, TAPIO identifies the correct relevant features by assigning higher importance to the first four features. It also accurately detects the feature characteristic of each cluster, namely, feature \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$V_{1}$$\end{document} for cluster 1, feature \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$V_{2}$$\end{document} for cluster 2, feature \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$V_{3}$$\end{document} for cluster 3, and feature \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$V_{4}$$\end{document} for cluster 4.Fig. 5Cluster-specific feature importance. The results are based on the simulation outlined in Cluster-specific feature importance section Cluster-specific feature importance. The results are based on the simulation outlined in Cluster-specific feature importance section Applications Application on clinical cohort Clustering of the data described in Clinical cohort and longitudinal measurements section was conducted using the longTAPIOMLD for irregular repeated measurements. We identified two distinct clusters of patients utilizing the silhouette coefficient [21] on the aggregated affinity matrix (see Eq. 3). A Cox proportional hazards model was fitted to verify whether survival differs between these clusters (see Fig. 6a). We also report on the p-value using the score test that compares survival curves by assessing whether the observed number of events in each group differs from what would be expected under the null hypothesis of no association between the grouping variable and survival. Among the longitudinal measures, ejection fraction emerged as the most important feature distinguishing these clusters (see Fig. 6b). This likely reflects its role as a direct indicator of left ventricular systolic function, which varies substantially between patients after aortic valve replacement. Patients with preserved ejection fraction tend to follow a more favorable recovery trajectory, while those with reduced ejection fraction are at higher risk for adverse outcomes, resulting in distinct survival patterns. Ejection fraction thus captures both functional cardiac status and prognostic information, making it a key driver of the observed clustering. However, these findings are intended solely to illustrate the clustering methodology and its interpretability and do not provide definitive clinical insights.Fig. 6Application on clinical cohort. a Kaplan-Meier survival curves displayed for the two detected patient clusters. Time is the maximum follow up time, with surgery date as the time origin (years) b Feature importance values of the analyzed biomarker Application on clinical cohort. a Kaplan-Meier survival curves displayed for the two detected patient clusters. Time is the maximum follow up time, with surgery date as the time origin (years) b Feature importance values of the analyzed biomarker Application on high-dimensional bulk proteomics data We analyzed the proteomics data described in Longitudinal high-dimensional omics data section using the longTAPIOtrajectories algorithm. The number of trees was set to 10,000 and the number of clusters to K=3, as determined by the silhouette coefficient [21]. The resulting clustering dendrogram in Fig. 7a shows that clusters 2 and 3 are closer to each other and separate well from cluster 1. The corresponding cluster-specific feature importance values are shown in Fig. 7b. For interpretation, we selected the top 10 proteins for each cluster based on their importance values and took their union, resulting in 20 proteins in total. The importance profiles differ noticeably across the detected clusters. For example, from Fig. 7b, proteins FOLR3 and NDRG1 appear characteristic of cluster 3, whereas FGF23 is particularly important for cluster 1, although it also shows relevance for cluster 3.Fig. 7Application on proteomics data. a Resulting dendrogram of the hierarchical clustering using longTAPIOtrajectories with the three detected clusters colored in red, green, and blue. b Cluster-specific feature/protein importance values Application on proteomics data. a Resulting dendrogram of the hierarchical clustering using longTAPIOtrajectories with the three detected clusters colored in red, green, and blue. b Cluster-specific feature/protein importance values Summary and outlook In this work we introduced TAPIO and its longitudinal extensions, demonstrating their ability to cluster complex multivariate trajectories while providing interpretable, cluster-specific feature importance. Simulation studies showed that the method reliably identifies relevant features and performs competitively across univariate and multivariate settings. In particular, longTAPIOtrajectories performed on par with existing trajectory-based clustering methods, while longTAPIOMLD showed clear advantages for irregularly sampled data. Surprisingly, longTAPIOsample was quite competitive, despite not accounting for any temporal ordering of the repeated measurements. Applications to a clinical cohort and high-dimensional proteomics data further illustrated the practical utility of our approach. In the clinical dataset, longTAPIOMLD identified patient subgroups with distinct survival patterns driven mainly by ejection fraction. In the proteomics analysis, longTAPIOtrajectories uncovered clusters with distinct molecular signatures and provided interpretable protein-level importance. Overall, TAPIO offers a flexible and transparent framework for longitudinal clustering. Its enhanced interpretability makes it a promising tool for biomedical research, with potential to support improved patient stratification and biomarker discovery. Promising future directions of research include refinements of both the dimensionality reduction step and the selection of clustering hyperparameters within the proposed framework. For instance, projecting onto the first principal component is appealing due to its enhanced interpretability; however, in very noisy datasets, this component may capture variance that is not necessarily informative for clustering. As a potential extension of the proposed framework, we therefore investigate a stochastic variant of the dimensionality reduction step. Instead of deterministically selecting the first principal component, we consider sampling a principal component according to its explained variance. Let \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\lambda _1, \ldots , \lambda _k$$\end{document} denote the eigenvalues of the covariance matrix \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\Sigma ' = \frac{1}{n}X'^T X'$$\end{document} obtained from the sampled feature subset. We define a categorical distribution over the principal components as\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\begin{aligned} P(S = i) = \frac{\lambda _i}{\sum _{j=1}^{k}\lambda _j}, \quad i \in \{1,\ldots ,k\}. \end{aligned}$$\end{document} A principal component index S is then drawn according to this distribution, and the corresponding one-dimensional representation is obtained as \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$Z = X' v_S$$\end{document}, where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$v_S$$\end{document} denotes the eigenvector associated with the sampled eigenvalue \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\lambda _S$$\end{document}. This probabilistic selection mechanism introduces additional variability into the ensemble while maintaining a preference for components explaining larger proportions of variance, potentially improving robustness and clustering stability. First results (see Fig. 8) indicate that this approach can improve performance while being less sensitive to hyperparameter choices, such as the number of selected features and the number of dendrogram cuts. Although preliminary results indicate improved performance, the interpretability of this stochastic principal component selection remains an open question, as sampling a component introduces an additional source of randomness into the ensemble. Furthermore, future work could explore alternatives to the silhouette coefficient not only for determining the optimal number of clusters, but also for guiding the selection of additional hyperparameters such as the number of sampled features k or the dendrogram cut depth d. While such criteria are in principle applicable, their direct use in the proposed ensemble setting is non-trivial due to the stochastic nature of the algorithm. Consensus-based combinations of multiple evaluation metrics or perturbation-based approaches for identifying noise-robust partitions may therefore be promising directions. However, we empirically observed that clustering performance was not strongly affected by moderate variations in k and d, suggesting limited sensitivity to fine-tuning (see Fig. 8).Fig. 8Clustering performance on synthetic longitudinal multivariate trajectories (see Synthetic longitudinal multivariate data and Synthetic longitudinal multivariate data sections) comparing the deterministic first principal component (PC1) approach with the variance-weighted random principal component selection (PCwr). The subject and variable-specific noise levels were set to \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\sigma _{i} = 3$$\end{document}, where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$i \in \{1,...,5\}$$\end{document}. The global measurement error was set to η =3. We randomly replaced a single \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\sigma _{i}$$\end{document} with a value out of [3, 20] in each iteration. The number of clusters is set to the known ground-truth K=4. The results are based on 50 iterations varying the (a) number of dendrogram cuts and (b) the number of randomly selected features building an ensemble member Clustering performance on synthetic longitudinal multivariate trajectories (see Synthetic longitudinal multivariate data and Synthetic longitudinal multivariate data sections) comparing the deterministic first principal component (PC1) approach with the variance-weighted random principal component selection (PCwr). The subject and variable-specific noise levels were set to \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\sigma _{i} = 3$$\end{document}, where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$i \in \{1,...,5\}$$\end{document}. The global measurement error was set to η =3. We randomly replaced a single \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\sigma _{i}$$\end{document} with a value out of [3, 20] in each iteration. The number of clusters is set to the known ground-truth K=4. The results are based on 50 iterations varying the (a) number of dendrogram cuts and (b) the number of randomly selected features building an ensemble member Finally, a rigorous theoretical investigation of the proposed framework, including formal analysis of its individual components and convergence properties under suitable assumptions, represents an important direction for future work.