{"id":46736,"date":"2025-09-30T11:22:13","date_gmt":"2025-09-30T11:22:13","guid":{"rendered":"https:\/\/www.newsbeep.com\/il\/46736\/"},"modified":"2025-09-30T11:22:13","modified_gmt":"2025-09-30T11:22:13","slug":"boosting-k-nearest-neighbor-regression-performance-for-longitudinal-data-through-a-novel-learning-approach-bmc-bioinformatics","status":"publish","type":"post","link":"https:\/\/www.newsbeep.com\/il\/46736\/","title":{"rendered":"Boosting K-nearest neighbor regression performance for longitudinal data through a novel learning approach | BMC Bioinformatics"},"content":{"rendered":"<p>Variable-trajectory<\/p>\n<p>Let \\(y_{it} \\in {\\mathbb{R}}\\) denote the observed response value for the subject \\(i \\in \\left\\{ {1, \\ldots ,n} \\right\\}\\) at the time point \\(t \\in \\left\\{ {1,&#8230;,T_{i} } \\right\\}\\), where \\(T_{i}\\) is the number of observations for subject i. The response trajectory for subject i can be represented as the vector.\\(Y_{i} = (y_{i1} ,y_{i2} , \\ldots ,y_{{iT_{i} }} )^{{\\text{T}}} .\\)<\/p>\n<p>The collection of these trajectories for all subjects can be organized in a response matrix.<\/p>\n<p>\\(Y = [Y_{1} ,Y_{2} ,&#8230;,Y_{n} ]^{{\\text{T}}}\\), with each row corresponding to a subject\u2019s longitudinal response profile.<\/p>\n<p>$$ Y = \\left( \\begin{gathered} Y_{1} \\hfill \\\\ Y_{2} \\hfill \\\\ \\vdots \\hfill \\\\ Y_{n} \\hfill \\\\ \\end{gathered} \\right) = \\left[ {\\begin{array}{*{20}c} \\begin{gathered} y_{11} \\hfill \\\\ y_{21} \\hfill \\\\ \\end{gathered} &amp; \\begin{gathered} \\ldots \\hfill \\\\ \\ldots \\hfill \\\\ \\end{gathered} &amp; \\begin{gathered} y_{{1T_{1} }} \\hfill \\\\ y_{{2T_{2} }} \\hfill \\\\ \\end{gathered} \\\\ \\vdots &amp; \\ddots &amp; \\vdots \\\\ {y_{n1} } &amp; \\cdots &amp; {y_{{nT_{n} }} } \\\\ \\end{array} } \\right] $$<\/p>\n<p>\n                    (1)\n                <\/p>\n<p>Distances in the D quantitative covariates and the T measurement times<\/p>\n<p>Let \\(X_{it}\\) denote the covariate vector for subject i at time t, and \\(X_{it}^{\\left( k \\right)}\\) denote the k-th as the covariate component. We use \\(X_{i.}\\) to represent the longitudinal covariate matrix for subject i and \\(X_{..}\\) to denote the full covariate matrix for all subjects across all time points.<\/p>\n<p>Therefore \\(X_{it} = (X_{it}^{\\left( 1 \\right)} ,{\\text{ X}}_{it}^{\\left( 2 \\right)} , \\, \\ldots ,{\\text{ X}}_{it}^{\\left( D \\right)} ) \\in {\\mathbb{R}}^{D}\\), denote the D-dimensional covariate vector for subject i at time point t. To quantify the similarity between two such observations, a distance metric can be used. A common choice is the Euclidean distance, defined as follows:<\/p>\n<p>$$ d_{t} (X_{it} ,X_{jt} ) = \\sqrt {\\sum\\limits_{k = 1}^{D} {\\left( {X_{it}^{(k)} &#8211; X_{jt}^{(k)} } \\right)^{2} } } $$<\/p>\n<p>\n                    (2)\n                <\/p>\n<p>Or Mahalanobis distance accounting for correlation in predictors:<\/p>\n<p>$$ d\\left( {X_{it} ,X_{jt} } \\right) = \\sqrt {(X_{it} &#8211; X_{jt} )^{T} \\Sigma^{ &#8211; 1} (X_{it} &#8211; X_{jt} )} $$<\/p>\n<p>\n                    (3)\n                <\/p>\n<p>where \u03a3 is the covariance matrix of covariance matrix of the D-dimensional covariates across subjects.<\/p>\n<p>Let \\( X_{i..} ,X_{j..} \\in {\\mathbb{R}}^{T \\times D}\\) denote the longitudinal covariate matrices for subjects i and j, respectively. Then, it \\(d(X_{i..} ,X_{j..} )\\) represents the distance between these two matrices, computed based on a suitable aggregation of temporal or feature-wise distances. Two methods were used to determine this distance between two matrices. The two matrices\u2019 T columns are considered first, followed by the calculation of distances between the T couples of columns, and, lastly, the combination of these T distances using a function combining the column distances. The second method involves considering the D lines of the two matrices, calculating the distances between the D line pairs, and then using a function that combines the line distances, to sum up these D distances.<\/p>\n<p>More formally, to compute a distance between \\(X_{i..}\\) and \\(X_{j..}\\) according to the first method, for each fixed time point t, let \\(X_{it} ,X_{jt} \\in {\\mathbb{R}}^{D}\\) denote the covariate vectors for subjects i and j, respectively, at time t. The distance between these vectors is defined as:<\/p>\n<p>$$ d_{t} (X_{it} ,X_{jt} ) = \\sqrt {\\sum\\limits_{k = 1}^{D} {\\left( {X_{it}^{(k)} &#8211; X_{jt}^{(k)} } \\right)^{2} } } $$<\/p>\n<p>\n                    (4)\n                <\/p>\n<p>This corresponds to the Euclidean distance between the covariate vectors at time t for subjects i and j, extracted from their respective longitudinal matrices \\(X_{i.}\\) and \\(X_{j.}\\). The result is a vector of T distances \\(\\left( {d_{1} \\left( {X_{i1} ,X_{j1} } \\right),d_{2} \\left( {X_{i2} ,X_{j2} } \\right), \\ldots ,d_{T} \\left( {X_{iT} ,X_{jT} } \\right)} \\right)\\). Then, these T distances can be combined using a function that algebraically corresponds to a norm \\(\\left\\| \\cdot \\right\\|\\) of the distance vector. Finally, the distance between \\(X_{i.}\\) and \\(X_{j..}\\)<\/p>\n<p>$$ d\\left( {X_{i..} ,X_{j..} } \\right) = \\left\\| {d_{1} \\left( {X_{i1} ,X_{j1} } \\right),d_{2} \\left( {X_{i2} ,X_{j2} } \\right), \\ldots ,d_{T} \\left( {X_{iT} ,X_{2T} } \\right)} \\right\\| $$<\/p>\n<p>\n                    (5)\n                <\/p>\n<p>To compute the distance \\(d^{\\prime}\\) between the longitudinal data matrices \\(X_{i..}\\) \\(X_{j..}\\) according to the second approach, we define the distance \\(d_{k} \\left( {X_{i.}^{\\left( k \\right)} ,{\\text{ X}}_{j.}^{\\left( k \\right)} } \\right)\\) between the time series of the k-th variable for both subjects. Here, they \\(X_{i.}^{\\left( k \\right)} ,X_{j.}^{\\left( k \\right)} \\in {\\mathbb{R}}^{T}\\) represent the temporal trajectories of covariate k for subjects i and j, respectively. The overall distance is then computed by aggregating over all variables:<\/p>\n<p>$$ d^{\\prime}(X_{i..} ,X_{j..} ) = \\sum\\limits_{k = 1}^{D} d (X_{i.}^{\\left( k \\right)} ,X_{j.}^{\\left( k \\right)} ) $$<\/p>\n<p>\n                    (6)\n                <\/p>\n<p>This results in a vector of D distances. \\(d_{1} \\left( {X_{i.}^{\\left( 1 \\right)} ,X_{j.}^{\\left( 1 \\right)} } \\right),d_{2} \\left( {X_{i.}^{\\left( 2 \\right)} ,X_{j.}^{\\left( 2 \\right)} } \\right), \\ldots ,d_{D} \\left( {X_{i.}^{\\left( D \\right)} ,X_{j.}^{\\left( D \\right)} } \\right)\\).<\/p>\n<p>Then, we combine these D distances using a function that algebraically corresponds to a norm \\(\\left\\| \\cdot \\right\\|\\) of the distance vector. Finally,<\/p>\n<p>$$ d^{\\prime}(X_{i..} ,X_{j..} ) = \\left\\| {d_{1} \\left( {X_{i.}^{\\left( 1 \\right)} ,X_{j.}^{\\left( 1 \\right)} } \\right),d_{2} \\left( {X_{i.}^{\\left( 2 \\right)} ,X_{j.}^{\\left( 2 \\right)} } \\right), \\ldots ,d_{D} \\left( {X_{i.}^{\\left( D \\right)} ,X_{j.}^{\\left( D \\right)} } \\right)} \\right\\| $$<\/p>\n<p>\n                    (7)\n                <\/p>\n<p>The choice of the norm \\(\\left\\| \\cdot \\right\\|\\) can lead to the definition of many distances. On the contrary, in the case where \\(\\left\\| \\cdot \\right\\|\\) the standard p-norm is the Minkowski distance with parameter p, choosing either method \\(d\\) \\(d^{\\prime}\\) leads to the same result:<\/p>\n<p>$$ d(X_{i..} ,X_{j..} ) = d^{\\prime}(X_{i..} ,X_{j..} ) $$<\/p>\n<p>The proof is based on [<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 20\" title=\"Genolini C, Alacoque X, Sentenac M, Arnaud C. kml and kml3d: R packages to cluster longitudinal data. J Stat Softw. 2015;65:1\u201334.\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#ref-CR20\" id=\"ref-link-section-d157103094e1458\" rel=\"nofollow noopener\" target=\"_blank\">20<\/a>]:<\/p>\n<p>$$ d(X_{i..} ,X_{j..} ) = \\sqrt[p]{{\\sum\\limits_{t} {\\left( {d\\left( {X_{it} ,X_{jt} } \\right)} \\right)^{p} } }} = \\sqrt[p]{{\\sum\\limits_{t} {\\left( {\\sqrt[p]{{\\sum\\limits_{k} {\\left( {\\left| {X_{it}^{\\left( K \\right)} &#8211; X_{jt}^{\\left( k \\right)} } \\right|^{p} } \\right)^{p} } }}} \\right)^{p} } }} $$<\/p>\n<p>$$ \\sqrt[p]{{\\sum\\limits_{t} {\\sum\\limits_{k} {\\left| {X_{it}^{\\left( k \\right)} &#8211; X_{jt}^{\\left( k \\right)} } \\right|^{P} = \\sqrt[p]{{\\sum\\limits_{t} {\\left( {\\sqrt[P]{{\\sum\\limits_{K} {\\left( {\\left| {X_{it}^{\\left( k \\right)} &#8211; X_{jt}^{\\left( k \\right)} } \\right|^{P} } \\right)} }}} \\right)} }}} } }} $$<\/p>\n<p>$$ = \\sqrt[p]{{\\sum\\limits_{k} {\\left( {d\\left( {X_{i.}^{\\left( k \\right)} &#8211; X_{j.}^{\\left( k \\right)} } \\right)} \\right)^{p} } }} = d^{\\prime}\\left( {X_{i..} ,X_{j..} } \\right) $$<\/p>\n<p>\n                    (8)\n                <\/p>\n<p>Therefore, the Minkowski distance, a generalization of the Euclidean distance, is used in this study as the basis for computing similarity between multivariate profiles [<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 20\" title=\"Genolini C, Alacoque X, Sentenac M, Arnaud C. kml and kml3d: R packages to cluster longitudinal data. J Stat Softw. 2015;65:1\u201334.\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#ref-CR20\" id=\"ref-link-section-d157103094e1496\" rel=\"nofollow noopener\" target=\"_blank\">20<\/a>].<\/p>\n<p>$$ d\\left( {X_{i..} ,X_{j..} } \\right) = \\sqrt[p]{{\\sum\\limits_{t,k} {\\left| {X_{it}^{\\left( k \\right)} &#8211; X_{jt}^{\\left( k \\right)} } \\right|^{p} } }} $$<\/p>\n<p>\n                    (9)\n                <\/p>\n<p>The Euclidean distance is obtained by setting p\u2009=\u20092, the Manhattan distance by setting p\u2009=\u20091, and the maximum distance by passing to the limit \\(p \\to + \\infty\\)[<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 20\" title=\"Genolini C, Alacoque X, Sentenac M, Arnaud C. kml and kml3d: R packages to cluster longitudinal data. J Stat Softw. 2015;65:1\u201334.\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#ref-CR20\" id=\"ref-link-section-d157103094e1531\" rel=\"nofollow noopener\" target=\"_blank\">20<\/a>].<\/p>\n<p>K-Nearest Neighbors (KNN) regression<\/p>\n<p>KNN is a non-parametric method for regression and classification, which is part of the non-parametric approach of local averaging. In this non-parametric approach, the estimation \\(m(x_{i} ) = E(Y_{i} \\left| {x_{i} )} \\right.\\) is obtained by averaging the values of data points \\(y_{j}\\) whose corresponding \\(x_{j}\\) predictors are close to \\(x_{i}\\) the target point. It means that<\/p>\n<p>$$ \\hat{m}\\left( {x_{i} } \\right) = \\sum\\limits_{j = 1}^{n} {w_{j} } \\left( {x_{i} ;x_{1} ,&#8230;,x_{n} } \\right)y_{j} = \\left( {w_{1} (X),w_{2} (X),&#8230;,w_{n} (X)} \\right)\\left( \\begin{gathered} y_{1} \\hfill \\\\ y_{2} \\hfill \\\\ \\vdots \\hfill \\\\ y_{n} \\hfill \\\\ \\end{gathered} \\right) $$<\/p>\n<p>\n                    (10)\n                <\/p>\n<p>where the weights \\(w_{j} \\left( {x_{i} ;x_{1} ,&#8230;,x_{n} } \\right)\\)\u200b are non-negative and decrease as the distance between \\(x_{j} ;j = 1,&#8230;,n\\) and \\(x_{i}\\) increases. This approach helps estimate the value \\(y_{i}\\) corresponding to \\(x_{i}\\) a target point by borrowing information from nearby observations. It assigns greater weight to observations closer to the target point \\(x_{i}\\) and less weight to those farther away [<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 22\" title=\"Sohil F, Sohali MU, Shabbir J. An introduction to statistical learning with applications in R: by Gareth James, Daniela Witten, Trevor Hastie, and Robert Tibshirani, New York: Springer Science and Business Media; 2013, $41.98. 2022.\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#ref-CR22\" id=\"ref-link-section-d157103094e1667\" rel=\"nofollow noopener\" target=\"_blank\">22<\/a>].<\/p>\n<p>KNN regression for longitudinal data<\/p>\n<p>In longitudinal studies, Y values for each individual consist of multiple measurements taken over time. However, the main problem of examining the effect of independent variables on the response remains. As stated in Eq.\u00a0(1), \\(Y\\) is a matrix containing a quantitative variable trajectory whose i-th row represents the trajectory response variable for the i-th individual to estimate the variable-trajectory vector of a new individual using KNN regression; we denote this by \\(\\hat{y}_{it}\\). In this case, the nearest neighbors of covariate trajectory \\(X_{i.}\\) are using the distance metric in Eq.\u00a0(9). The predicted response trajectory is computed as the weighted average of the neighbors\u2019 outcomes [<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 23\" title=\"Xiang D, Qiu P, Pu X. Nonparametric regression analysis of multivariate longitudinal data. Stat Sin. 2013;769\u201389.\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#ref-CR23\" id=\"ref-link-section-d157103094e1727\" rel=\"nofollow noopener\" target=\"_blank\">23<\/a>]. To predict the value of the response variable for subject i at time t, we use the average response of its k-nearest neighbors, identified based on longitudinal distances between their covariate trajectories \\(X_{i.}\\):<\/p>\n<p>$$ \\hat{y}_{it} = \\sum\\limits_{{j \\in N_{k} \\left( i \\right)}} {\\frac{1}{k}y_{jt} } $$<\/p>\n<p>\n                    (11)\n                <\/p>\n<p>where \\(\\hat{y}_{it}\\) denotes the predicted response for subject i at time t, obtained via local averaging over the responses of the k-nearest neighbors. The prediction is computed as the average of the outcomes of the nearest neighbors at time t.<\/p>\n<p>Where N(i) denotes the set of indices corresponding to the k-nearest neighbors of subject i, based on the longitudinal distance between their covariate trajectories.<\/p>\n<p>Alternatively, it can be used as weighted averaging:<\/p>\n<p>$$ \\overset{\\lower0.5em\\hbox{$\\smash{\\scriptscriptstyle\\frown}$}}{m} (X_{it} ) = \\sum\\limits_{{j \\in N_{k} \\left( i \\right)}} {w_{j} \\underline {y}_{jt} } $$<\/p>\n<p>$$ with \\, weights\\;\\;w_{j} = \\frac{{1\/d\\left( {X_{i \\cdot } ,X_{j \\cdot } } \\right)}}{{\\sum\\limits_{l\\smallint N\\left( i \\right)} 1 \/d\\left( {X_{i \\cdot } ,X_{l \\cdot } } \\right)}} $$<\/p>\n<p>\n                    (12)\n                <\/p>\n<p>where \\(d(X_{it} ,X_{jt} )\\) denotes the longitudinal distance between subjects i and j at time t, and weights are normalized inverse distances to emphasize closer neighbors. The above method requires that the covariates \\(X_{i.}\\) be time-dependent and can sufficiently explain Y. We will refer to this method as KNNRLD (KNN Regression for Longitudinal Data).<\/p>\n<p>Some drawbacks related to KNN regression<\/p>\n<p>Although KNN has proved to be a ubiquitous classification or regression tool with good scalability, it has some drawbacks. One of its most significant drawbacks is that it is a lazy learner, i.e., it uses all the training data at runtime [<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 2\" title=\"Dubey H, Pudi V. CLUEKR: Clustering based efficient k NN regression. In: Advances in knowledge discovery and data mining: 17th Pacific-Asia conference, PAKDD 2013, Gold Coast: Springer; 2013. April 14\u201317, 2013, Proceedings, Part I 17. p. 450\u20138.\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#ref-CR2\" id=\"ref-link-section-d157103094e1865\" rel=\"nofollow noopener\" target=\"_blank\">2<\/a>]. Another issue is that KNN regression is prone to the curse of dimensionality. KNN estimators are universally consistent, which means.<\/p>\n<p>$$ {\\rm E}(\\hat{m}_{k} &#8211; m)^{2} \\to 0\\;as\\;n \\to \\infty $$<\/p>\n<p>\n                    (13)\n                <\/p>\n<p>However, KNN regression estimators may perform poorly if the input space dimension is high (i.e., the number of covariates, p). This is simply because the nearest neighbors must be close to the target point, which can lead to significant errors in high-dimensional spaces. So, it can be proved that<\/p>\n<p>$$ {\\rm E}(\\hat{m}_{k} \\left( x \\right) &#8211; m\\left( x \\right))^{2} \\le n^{{ &#8211; \\frac{2}{2 + P}}} $$<\/p>\n<p>\n                    (14)\n                <\/p>\n<p>This is a relatively weak error rate because it depends weakly on the dimension p. Therefore if we want the maximum estimation error to be less than or equal to \\(\\varepsilon \\ge 0\\) that is<\/p>\n<p>$$ {\\rm E}(\\hat{m}_{k} \\left( x \\right) &#8211; m\\left( x \\right))^{2} \\le \\varepsilon $$<\/p>\n<p>\n                    (15)\n                <\/p>\n<p>Therefore, the number of samples n should be chosen so that<\/p>\n<p>$$ n \\ge \\varepsilon^{{ &#8211; \\frac{2}{2 + P}}} $$<\/p>\n<p>\n                    (16)\n                <\/p>\n<p>Which increases exponentially with the increase of P [<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 24\" title=\"Kpotufe S. k-NN regression adapts to local intrinsic dimension. Adv Neural Inf Process Syst. 2011;24.\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#ref-CR24\" id=\"ref-link-section-d157103094e1949\" rel=\"nofollow noopener\" target=\"_blank\">24<\/a>].<\/p>\n<p>To generalize KNN regression in longitudinal data, first consider the assumption that none of the independent variables change over time, so the sample size can be established based on Eq.\u00a0(<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"equation anchor\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#Equ11\" rel=\"nofollow noopener\" target=\"_blank\">11<\/a>) for KNN regression in longitudinal data because, in this case, the original k-nearest neighbor is the same as a P-dimensional KNN regression for cross-sectional data. However, we will assume that all the independent variables used in KNN regression with longitudinal data are time-dependent. In this case, we first return to Eq.\u00a0(<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"equation anchor\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#Equ8\" rel=\"nofollow noopener\" target=\"_blank\">8<\/a>), where<\/p>\n<p>$$ \\sqrt[p]{{\\sum\\limits_{t} {\\left( {d\\left( {X_{it} ,X_{jt} } \\right)} \\right)^{p} } }} = \\sqrt[p]{{\\sum\\limits_{t} {\\left( {\\sqrt[p]{{\\sum\\limits_{k} {\\left( {\\left| {X_{it}^{\\left( k \\right)} &#8211; X_{jt}^{\\left( k \\right)} } \\right|^{p} } \\right)^{p} } }}} \\right)^{p} } }} $$<\/p>\n<p>\n                    (17)\n                <\/p>\n<p>That is, the problem of the distance coefficient between subjects i and j can be separated into the problem of finding the distance coefficient in the shortest possible time. Therefore, \\(t = 1,2, \\ldots ,T\\) the required sample volume will be obtained at any measurement time, similar to the previous state. The required sample size for the case where some independent variables depend on time is between these two cases.<\/p>\n<p>As mentioned, the curse of dimensionality in a KNN estimator is that the nearest neighbors must be close to the target point. High dimensionality can lead to significant errors. This problem can be partially mitigated by clustering the data before running the K-Nearest Neighbors (KNN) algorithm. Clustering helps by grouping similar subjects, thereby confining the nearest-neighbor search to localized regions in the feature space. As a result, the influence of high dimensionality is reduced because distance computations are performed within smaller, denser subsets rather than across the entire space. This strategy is particularly effective for longitudinal data, where local structures often carry more meaningful temporal relationships. By clustering subjects based on proximity in the P-dimensional space, the KNN algorithm operates within more homogeneous groups. Additionally, distance calculations are performed on smaller subsets of data (as opposed to full n-dimensional matrices), which improves computational efficiency\u2014especially for large-scale longitudinal datasets [<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 20\" title=\"Genolini C, Alacoque X, Sentenac M, Arnaud C. kml and kml3d: R packages to cluster longitudinal data. J Stat Softw. 2015;65:1\u201334.\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#ref-CR20\" id=\"ref-link-section-d157103094e1999\" rel=\"nofollow noopener\" target=\"_blank\">20<\/a>, <a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 25\" title=\"Sheetal A, Jiang Z, Di Milia L. Using machine learning to analyze longitudinal data: a tutorial guide and best-practice recommendations for social science researchers. Appl Psychol. 2023;72:1339\u201364.\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#ref-CR25\" id=\"ref-link-section-d157103094e2002\" rel=\"nofollow noopener\" target=\"_blank\">25<\/a>].<\/p>\n<p>Enhancing KNN regression accuracy through clustering in longitudinal data<\/p>\n<p>By clustering individuals based on similar temporal patterns and covariate structures, the overall variability within each group is reduced. This approach ensures that subjects with comparable characteristics are analyzed together, leading to a more consistent intra-cluster correlation. As a result, applying KNN regression within each cluster becomes more stable and reliable. Rather than implementing KNN across the entire dataset, restricting it to pre-defined clusters allows the algorithm to find neighbors with more similar longitudinal structures. This localized approach improves predictive accuracy by ensuring comparisons among more relevant observations. When individuals within a cluster exhibit shared underlying characteristics, such as similar baseline values or progression trends\u2014clustering effectively accounts for these latent factors. It reduces the necessity for explicitly modeling random effects, simplifying the regression process while capturing subject-specific influences [<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 12\" title=\"Fitzmaurice GM, Laird NM, Ware JH. Applied longitudinal analysis. Hoboken: John; 2012.\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#ref-CR12\" id=\"ref-link-section-d157103094e2013\" rel=\"nofollow noopener\" target=\"_blank\">12<\/a>, <a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 21\" title=\"Genolini C, Ecochard R, Benghezal M, Driss T, Andrieu S, Subtil F. kmlShape: an efficient method to cluster longitudinal data (time-series) according to their shapes. PLoS ONE. 2016;11: e0150738.\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#ref-CR21\" id=\"ref-link-section-d157103094e2016\" rel=\"nofollow noopener\" target=\"_blank\">21<\/a>, <a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 25\" title=\"Sheetal A, Jiang Z, Di Milia L. Using machine learning to analyze longitudinal data: a tutorial guide and best-practice recommendations for social science researchers. Appl Psychol. 2023;72:1339\u201364.\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#ref-CR25\" id=\"ref-link-section-d157103094e2019\" rel=\"nofollow noopener\" target=\"_blank\">25<\/a>].<\/p>\n<p>The objective of CKNNRLD is to estimate the value of a longitudinal outcome, yit, using observed covariates, Xit, through a cluster-based nearest-neighbor regression framework. This framework aggregates information from similar time-aligned individuals to produce continuous-valued predictions.<\/p>\n<p>Clustering-based KNN regression for longitudinal data<\/p>\n<p>The algorithm comprises both preprocessing and processing steps, as outlined below.<\/p>\n<p>Preprocessing steps<\/p>\n<p>                    1.<\/p>\n<p>Clustering variable trajectories with the help of K-means for longitudinal data (KML) method [<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 19\" title=\"Genolini C, Falissard B. KmL: k-means for longitudinal data. Comput Stat. 2010;25:317\u201328.\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#ref-CR19\" id=\"ref-link-section-d157103094e2058\" rel=\"nofollow noopener\" target=\"_blank\">19<\/a>, <a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 20\" title=\"Genolini C, Alacoque X, Sentenac M, Arnaud C. kml and kml3d: R packages to cluster longitudinal data. J Stat Softw. 2015;65:1\u201334.\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#ref-CR20\" id=\"ref-link-section-d157103094e2061\" rel=\"nofollow noopener\" target=\"_blank\">20<\/a>]<\/p>\n<p>                    2.<\/p>\n<p> Finding the optimal number of clusters using the Calinski criterion [<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 26\" title=\"Cali\u0144ski T, Harabasz J. A dendrite method for cluster analysis. Commun Stat Methods. 1974;3:1\u201327.\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#ref-CR26\" id=\"ref-link-section-d157103094e2075\" rel=\"nofollow noopener\" target=\"_blank\">26<\/a>] or the other criteria in the kml package [<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 19\" title=\"Genolini C, Falissard B. KmL: k-means for longitudinal data. Comput Stat. 2010;25:317\u201328.\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#ref-CR19\" id=\"ref-link-section-d157103094e2081\" rel=\"nofollow noopener\" target=\"_blank\">19<\/a>, <a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 20\" title=\"Genolini C, Alacoque X, Sentenac M, Arnaud C. kml and kml3d: R packages to cluster longitudinal data. J Stat Softw. 2015;65:1\u201334.\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#ref-CR20\" id=\"ref-link-section-d157103094e2084\" rel=\"nofollow noopener\" target=\"_blank\">20<\/a>] (in this step, users can determine the number of clusters according to their taste based on prior information about the data).<\/p>\n<p>                    3.<\/p>\n<p>Determining the optimal K for KNN regression by k-fold cross-validation method (If the clusters are homogeneous, one same K can be used for all the clusters.)<\/p>\n<p>                    4.<\/p>\n<p>Finding the representative of each cluster (the mean vector (matrix for time-dependent data) of the corresponding covariate variables in each cluster).<\/p>\n<p>                    5.<\/p>\n<p>Saving the information from the previous four steps.<\/p>\n<p>Processing steps<\/p>\n<p>                    6.<\/p>\n<p>Finding the cluster where the query point (query vector for non-time-dependent data and query matrix for time-dependent data) has the highest probability of occurrence (the smallest distance to the representative of each cluster).<\/p>\n<p>                    7.<\/p>\n<p>KNNRLD is applied based on the weighted average of K nearest neighbors of query variables in the desired cluster.<\/p>\n<p>                    8.<\/p>\n<p>The value calculated in the previous step is a new variable trajectory provided as an output.<\/p>\n<p>According to the above steps, the KNN regression algorithm, based on clustering for longitudinal data, is illustrated in Fig.\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#Fig1\" rel=\"nofollow noopener\" target=\"_blank\">1<\/a>. The kml package includes functions for imputing missing values, a detailed description of which is given in the related article [<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 20\" title=\"Genolini C, Alacoque X, Sentenac M, Arnaud C. kml and kml3d: R packages to cluster longitudinal data. J Stat Softw. 2015;65:1\u201334.\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#ref-CR20\" id=\"ref-link-section-d157103094e2179\" rel=\"nofollow noopener\" target=\"_blank\">20<\/a>]. If there are trajectories with missing values among the data, a decision can be made before step 1 with the help of the functions introduced in the kml R package. In our implementation, the optimal number of clusters was selected using internal validation indices such as the Calinski-Harabasz and silhouette scores available in the kml R package. This data-driven strategy helped ensure that the chosen C aligned with the actual data structure.<\/p>\n<p>Fig.\u00a01<a class=\"c-article-section__figure-link\" data-test=\"img-link\" data-track=\"click\" data-track-label=\"image\" data-track-action=\"view figure\" href=\"https:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1\/figures\/1\" rel=\"nofollow noopener\" target=\"_blank\"><img decoding=\"async\" aria-describedby=\"Fig1\" src=\"https:\/\/www.newsbeep.com\/il\/wp-content\/uploads\/2025\/09\/12859_2025_6205_Fig1_HTML.png\" alt=\"figure 1\" loading=\"lazy\" width=\"685\" height=\"394\"\/><\/a><\/p>\n<p>The algorithm flow plot of the CKNNLR. KNNRLD: KNN regression for Longitudinal data; CKNNRLD: clustering-Based KNN regression for longitudinal data; CV: cross-validation<\/p>\n<p>Relation to previous work<\/p>\n<p>CKNNRLD represents a significant advancement over existing clustering-based KNN methods by specifically addressing the unique challenges of longitudinal data analysis. While prior approaches such as CLUEKR (Dubey et al. [<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 2\" title=\"Dubey H, Pudi V. CLUEKR: Clustering based efficient k NN regression. In: Advances in knowledge discovery and data mining: 17th Pacific-Asia conference, PAKDD 2013, Gold Coast: Springer; 2013. April 14\u201317, 2013, Proceedings, Part I 17. p. 450\u20138.\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#ref-CR2\" id=\"ref-link-section-d157103094e2216\" rel=\"nofollow noopener\" target=\"_blank\">2<\/a>]) have demonstrated the utility of combining clustering and KNN in cross-sectional settings, they lack the mechanisms necessary to handle temporal dependencies, intra-subject correlations, and irregular time points [<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 2\" title=\"Dubey H, Pudi V. CLUEKR: Clustering based efficient k NN regression. In: Advances in knowledge discovery and data mining: 17th Pacific-Asia conference, PAKDD 2013, Gold Coast: Springer; 2013. April 14\u201317, 2013, Proceedings, Part I 17. p. 450\u20138.\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#ref-CR2\" id=\"ref-link-section-d157103094e2222\" rel=\"nofollow noopener\" target=\"_blank\">2<\/a>]. A concise comparison between CLUEKR and CKNNRLD is presented in Supplementary Table <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"supplementary material anchor\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#MOESM1\" rel=\"nofollow noopener\" target=\"_blank\">S1<\/a>, summarizing key methodological differences in data type, clustering logic, and regression strategy [<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 2\" title=\"Dubey H, Pudi V. CLUEKR: Clustering based efficient k NN regression. In: Advances in knowledge discovery and data mining: 17th Pacific-Asia conference, PAKDD 2013, Gold Coast: Springer; 2013. April 14\u201317, 2013, Proceedings, Part I 17. p. 450\u20138.\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#ref-CR2\" id=\"ref-link-section-d157103094e2228\" rel=\"nofollow noopener\" target=\"_blank\">2<\/a>].<\/p>\n<p>Our method builds upon longitudinal clustering techniques, such as KML (k-means for longitudinal data), by introducing several key innovations.<\/p>\n<p>Time-sensitive distance metrics: CKNNRLD employs trajectory-level distance calculations that capture both the shape and timing of individual trajectories, ensuring meaningful comparisons across subjects with sparse or irregular measurements.<\/p>\n<p>Cluster-specific local regression models: By fitting regression models within clusters of similar temporal patterns, CKNNRLD adapts to heterogeneity across subgroups and improves prediction accuracy.<\/p>\n<p>Scalability and flexibility: The method remains computationally efficient and non-parametric, making it suitable for large-scale longitudinal datasets without relying on strict model assumptions. <\/p>\n<p>To our knowledge, no previous method has combined these components into a unified, interpretable framework for KNN-based regression on longitudinal data. Our theoretical and empirical results demonstrate that CKNNRLD offers superior performance to standard KNN approaches in terms of both accuracy and robustness in the presence of temporal complexity.<\/p>\n<p>Simulation methods<\/p>\n<p>The data-generating procedure first defined the number of clusters (C) that characterized the longitudinal change to be modeled into the data. Three or four clusters (C\u2009=\u20093, 4) with distinct longitudinal patterns (trajectories) were specified. A \\(y_{ij}\\) model in the general linear form below denotes a trajectory belonging to group C:<\/p>\n<p>$$ y_{ij} = \\beta_{0c} + \\beta_{1c} t_{j} + \\beta_{2jcd} X_{ijcd} + Z_{0i} + e_{ij} \\;\\;i = 1,&#8230;,N;j = 0,&#8230;,T $$<\/p>\n<p>\n                    (18)\n                <\/p>\n<p>Here \\(\\beta_{oc}\\), \\(\\beta_{1c}\\) are the intercept and slope for cluster\u00a0C, respectively. Furthermore, \\(Z_{0i}\\) it denotes the trajectory-specific random intercept; its deviation from the cluster trajectory \\(Z_{0i} \\sim N(0,R)\\) \\(e_{ij}\\) represents independent random noise \\(e_{ij} \\sim N\\;(0,E)\\) In this context, tj denotes the j-th time point at which the longitudinal measurements (either for response or covariates) are observed for a given subject. In balanced data, tj can be interpreted as a fixed and common time index across subjects; in unbalanced settings, it may vary across individuals.<\/p>\n<p>The simulation subsequently varied the data sets across a fixed number of repeated measurements or time points (T\u2009=\u20093, 5, 10) and the number of simulated subjects (N\u2009=\u2009100, 500, 2000), which \\(X_{ijcd}\\) is a fictitious covariate that depends on time j and cluster c for the i-th subject. The simulation scenarios included different values for the true number of clusters (C\u2009=\u20093 and C\u2009=\u20094) to examine the model\u2019s sensitivity to the clustering structure. The index d refers to the d-th covariate. The dimension of covariates is also considered equal to D\u2009=\u20092 or 3. So, the N refers to the number of subjects (or trajectories) at each time point in each cluster, yielding a total of data points in each T\u2009\u00d7\u2009C\u2009\u00d7\u2009N\u2009\u00d7\u2009D data set. For all time points and subjects error (\\(e_{ij}\\)) and random noise (\\(Z_{0i}\\)) were added to the data, taken from a normal distribution with either mean\u2009=\u20090 and SD\u2009=\u20091 (E\u2009=\u20091, R\u2009=\u20091) for the low measurement error and random noise condition, or (E\u2009=\u20095, R\u2009=\u20091), for the high measurement error and low random noise condition, or (E\u2009=\u20091, R\u2009=\u20095), for the low measurement error and high random noise condition to simulate both differences in cluster homogeneity and deviation from linearity (See Table\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"table anchor\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#Tab1\" rel=\"nofollow noopener\" target=\"_blank\">1<\/a>).<\/p>\n<p>Table\u00a01 Summarizing the simulation scenarios<\/p>\n<p>The total number of scenarios in the simulated design was 2 (clusters)\u2009\u00d7\u20093 (time points)\u2009\u00d7\u20093 (number of subjects)\u2009\u00d7\u20092 (dimension of covariate)\u2009\u00d7\u20093 (levels of error and random noise)\u2009=\u2009108. A new series of simulated datasets was constructed for each of the three predicting methods. The number of replicated data sets per scenario was r\u2009=\u200910,000. The R-package latrend (Version 1.6.1) was used for this study, which can generate data according to this model using a utility function named\u00a0generateLongData() included in the package [<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 27\" title=\"Teuling N Den, Pauws S, Heuvel E van den. Latrend: a framework for clustering longitudinal data. arXiv Prepr arXiv240214621. 2024.\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#ref-CR27\" id=\"ref-link-section-d157103094e2663\" rel=\"nofollow noopener\" target=\"_blank\">27<\/a>]. This function generates datasets based on a mixture of linear mixed models (see Table\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"table anchor\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#Tab1\" rel=\"nofollow noopener\" target=\"_blank\">1<\/a>).<\/p>\n<p>Figure 2 illustrates three scenarios with common parameters, N\u2009=\u2009500, T\u2009=\u200910, D\u2009=\u20093, and C\u2009=\u20094, to compare the effects of random noise and measurement error under three conditions (Fig.\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#Fig2\" rel=\"nofollow noopener\" target=\"_blank\">2<\/a>)<\/p>\n<p>Fig.\u00a02<a class=\"c-article-section__figure-link\" data-test=\"img-link\" data-track=\"click\" data-track-label=\"image\" data-track-action=\"view figure\" href=\"https:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1\/figures\/2\" rel=\"nofollow noopener\" target=\"_blank\"><img decoding=\"async\" aria-describedby=\"Fig2\" src=\"https:\/\/www.newsbeep.com\/il\/wp-content\/uploads\/2025\/09\/12859_2025_6205_Fig2_HTML.png\" alt=\"figure 2\" loading=\"lazy\" width=\"685\" height=\"380\"\/><\/a><\/p>\n<p> An examples of Simulated data with T = 10, D = 3, C = 4, N = 500 and E = 1, R = 1 (A panel) , E = 1, R = 5 (B panel) and E = 5, R = 1 (C panel) <\/p>\n<p>The simulation study was designed to reflect the structure and conditions of the real-world longitudinal dataset analyzed in the application section. In particular, the choice of the number of covariates (D\u2009=\u20092 and D\u2009=\u20093) was motivated by the typical dimensionality observed in clinical data, where a limited number of predictors are measured repeatedly over time. Accordingly, the scenarios were constructed to mimic realistic noise levels, time structures, and clustering patterns encountered in longitudinal respiratory datasets.<\/p>\n<p>The criteria for evaluating different methods for predicting new observationsAssessment of BIAS<\/p>\n<p>Bias is a deviation in an estimate from the true quantity, indicating the performance of the assessed methods. One assessment of bias is the difference between the average estimate and the true value, which in this study was equal to \\(BIAS = \\hat{y}_{ij} &#8211; y_{ij}\\) where \\(\\hat{y}_{ij}\\) the predicted variable trajectory of the i-th person at time j is estimated using covariates under each method \\(y_{ij}\\) to its actual value [<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 28\" title=\"Burton A, Altman DG, Royston P, Holder RL. The design of simulation studies in medical statistics. Stat Med. 2006;25:4279\u201392.\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#ref-CR28\" id=\"ref-link-section-d157103094e2751\" rel=\"nofollow noopener\" target=\"_blank\">28<\/a>].<\/p>\n<p>Assessment of accuracy<\/p>\n<p>The classical Mean Squared Error (MSE) is typically computed as:<\/p>\n<p>$$ MSE = \\frac{1}{n}\\sum\\limits_{i = 1}^{n} {\\left( {\\hat{y}_{i} &#8211; y_{i} } \\right)}^{2} $$<\/p>\n<p>\n                    (17)\n                <\/p>\n<p>However, in this study, a theoretical version of MSE was used to decompose the error into squared bias and variance components:<\/p>\n<p>$$ Theoretical\\;MSE = BIAS^{2} + SE^{2} $$<\/p>\n<p>\n                    (18)\n                <\/p>\n<p>SE is the standard error, representing the empirical standard deviation of the estimator across simulations. This formulation, adapted from Burton [<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 26\" title=\"Cali\u0144ski T, Harabasz J. A dendrite method for cluster analysis. Commun Stat Methods. 1974;3:1\u201327.\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#ref-CR26\" id=\"ref-link-section-d157103094e2797\" rel=\"nofollow noopener\" target=\"_blank\">26<\/a>], captures both systematic and random error components in the estimator\u2019s performance [<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 28\" title=\"Burton A, Altman DG, Royston P, Holder RL. The design of simulation studies in medical statistics. Stat Med. 2006;25:4279\u201392.\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#ref-CR28\" id=\"ref-link-section-d157103094e2800\" rel=\"nofollow noopener\" target=\"_blank\">28<\/a>].<\/p>\n<p>Assessment of coverage probability (CP)<\/p>\n<p>The coverage of a confidence interval is the proportion of times that the obtained confidence interval contains the true specified parameter value. The coverage should be approximately equal to the nominal coverage rate, e.g., 95 percent of samples for 95 percent confidence intervals, to properly control the type I error rate for testing a null hypothesis of no effect. In this study, CP refers to the proportion of times the \\(100(1 &#8211; \\alpha )\\%\\) \\(\\alpha = 0.05\\) confidence interval \\(\\hat{y}_{ij} \\pm Z_{{1 &#8211; \\frac{\\alpha }{2}}} SE\\left( {\\hat{y}_{ij} } \\right)\\) includes \\(y_{ij}\\), for i\u2009=\u20091,\u2026, N, j\u2009=\u20090,\u2026, T. If the parameter estimates are relatively unbiased, then narrower confidence intervals imply more precise estimates, suggesting gains in efficiency and power [<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 28\" title=\"Burton A, Altman DG, Royston P, Holder RL. The design of simulation studies in medical statistics. Stat Med. 2006;25:4279\u201392.\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#ref-CR28\" id=\"ref-link-section-d157103094e2855\" rel=\"nofollow noopener\" target=\"_blank\">28<\/a>].<\/p>\n<p>The criteria for the evaluation of clustering<\/p>\n<p>We used four criteria to check the relationship between the accuracy of the estimates and the correct detection of clusters in the CKNNRLD method. Three of these are well-known criteria for evaluating the accuracy of clusters, including the Rand index [<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 29\" title=\"Rand WM. Objective criteria for the evaluation of clustering methods. J Am Stat Assoc. 1971;66:846\u201350.\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#ref-CR29\" id=\"ref-link-section-d157103094e2869\" rel=\"nofollow noopener\" target=\"_blank\">29<\/a>], the Adjusted Rand index [<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 30\" title=\"Hubert L, Arabie P. Comparing partitions. J Classif. 1985;2:193\u2013218.\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#ref-CR30\" id=\"ref-link-section-d157103094e2875\" rel=\"nofollow noopener\" target=\"_blank\">30<\/a>], and the Nowak index [<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 31\" title=\"Nowak E. Wska\u017anik podobie\u0144stwa wynik\u00f3w podzia\u0142\u00f3w. Przegl\u0105d. Stat. 1985;32:41\u20138.\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#ref-CR31\" id=\"ref-link-section-d157103094e2882\" rel=\"nofollow noopener\" target=\"_blank\">31<\/a>]. To calculate these three indices, the clusterSim R package (version 0.51\u20135) and the comparing partitions function available in this package were used [<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 32\" title=\"Walesiak M, Dudek A. Searching for optimal clustering procedure for a data set. 2015.\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#ref-CR32\" id=\"ref-link-section-d157103094e2891\" rel=\"nofollow noopener\" target=\"_blank\">32<\/a>]. In each simulation scenario, the number of clusters (C) was selected using standard internal validation indices such as the Calinski-Harabasz scores to ensure meaningful and stable clustering [<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 26\" title=\"Cali\u0144ski T, Harabasz J. A dendrite method for cluster analysis. Commun Stat Methods. 1974;3:1\u201327.\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#ref-CR26\" id=\"ref-link-section-d157103094e2897\" rel=\"nofollow noopener\" target=\"_blank\">26<\/a>]. Moreover, one of the criteria is related to the correct detection of the algorithm in determining the number of clusters as a proportion of the matched number of clusters, which is the proportion of the number of simulation iterations in which the CKNNRLD algorithm correctly recognized the number of clusters to the total number of iterations in each simulation scenario.<\/p>\n<p>Finally, Pearson\u2019s correlation was used to assess the impact of the clustering step in the CKNNRLD algorithm on the accuracy and correctness of its estimates across all 108 scenarios.<\/p>\n<p>Execution time<\/p>\n<p>In the two prediction scenarios\u20141 predicting just one new observation and 2 predicting a random sample of observations equal to 50% of N\u2014the execution time ratios of the KNNRLD and LMM to CKNNRLD were taken into account. These ratios were considered while comparing the execution times of the various methodologies.<\/p>\n<p>Table\u00a02 BIAS, MSE, and CP for 108 scenarios and three methodsResults on simulated data<\/p>\n<p>Table <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"table anchor\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#Tab2\" rel=\"nofollow noopener\" target=\"_blank\">2<\/a> presents the values of BIAS, Mean Squared Error (MSE), and coverage probability (CP) related to all three CKNNRLD, KNNRLD, and LMM methods for 108 simulation scenarios.<\/p>\n<p>Figure\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#Fig3\" rel=\"nofollow noopener\" target=\"_blank\">3<\/a> compares three methods\u2014CKNNRLD, KNNRLD, and LMM\u2014using boxplots for bias, MSE, and CP across various simulation scenarios. LMM consistently shows higher bias and MSE, particularly as the number of clusters, time points, and error levels increase. In contrast, CKNNRLD and KNNRLD exhibit lower bias and MSE, demonstrating more stable and accurate predictions. Coverage probability is also better maintained by CKNNRLD and KNNRLD. Increasing the number of subjects reduces the mean squared error (MSE) and bias for all methods, but CKNNRLD and KNNRLD remain more robust across different conditions. Higher measurement error and random noise have a more negative impact on LMM than on the KNN approaches.<\/p>\n<p>Fig.\u00a03<a class=\"c-article-section__figure-link\" data-test=\"img-link\" data-track=\"click\" data-track-label=\"image\" data-track-action=\"view figure\" href=\"https:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1\/figures\/3\" rel=\"nofollow noopener\" target=\"_blank\"><img decoding=\"async\" aria-describedby=\"Fig3\" src=\"https:\/\/www.newsbeep.com\/il\/wp-content\/uploads\/2025\/09\/12859_2025_6205_Fig3_HTML.png\" alt=\"figure 3\" loading=\"lazy\" width=\"685\" height=\"291\"\/><\/a><\/p>\n<p>Boxplots for BIAS (top panel), MSE (middle panel), and CP (bottom panel) by simulation parameters (from left to right N, C, T, D, (R, E) and overall mean<\/p>\n<p>CKNNRLD yielded lower MSE values than KNNRLD in 89.9% of scenarios, a lower bias than the LMM approach in all scenarios, and a lower MSE than the LMM approach in 65% of the scenarios (Table\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"table anchor\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#Tab2\" rel=\"nofollow noopener\" target=\"_blank\">2<\/a>). In the CKNNRLD algorithm, an increase in the number of trajectories (N) resulted in a decrease in bias and MSE, while the CP became more consistent, approaching CP\u2009=\u20090.95. Conversely, the accuracy of estimates using the LMM method declined with increasing sample size (N). Similarly, the accuracy and precision of the KNNRLD approach improved as N increased, except for bias at N\u2009=\u2009500 compared to N\u2009=\u2009100 (Fig.\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#Fig3\" rel=\"nofollow noopener\" target=\"_blank\">3<\/a>).<\/p>\n<p>The average execution time of the CKNNRLD methodology was double that of the KNNRLD method for predicting a single new longitudinal observation. In comparison, the average pure calculation time for CKNNRLD (excluding clustering timings and proximity determination for fresh data) was less than half (0.35) of the time required for the KNNRLD technique. For a random sample with fifty percent N, the average execution time ratio of the KNNRLD algorithm was less than one (0.32) in comparison to the CKNNRLD technique for N\u2009=\u2009100; however, it was around 1.5 times (1.52) for N\u2009=\u2009500 and roughly three times (3.04) for N\u2009=\u20092000 (see Fig.\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#Fig4\" rel=\"nofollow noopener\" target=\"_blank\">4<\/a>).<\/p>\n<p>Fig.\u00a04<a class=\"c-article-section__figure-link\" data-test=\"img-link\" data-track=\"click\" data-track-label=\"image\" data-track-action=\"view figure\" href=\"https:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1\/figures\/4\" rel=\"nofollow noopener\" target=\"_blank\"><img decoding=\"async\" aria-describedby=\"Fig4\" src=\"https:\/\/www.newsbeep.com\/il\/wp-content\/uploads\/2025\/09\/12859_2025_6205_Fig4_HTML.png\" alt=\"figure 4\" loading=\"lazy\" width=\"685\" height=\"289\"\/><\/a><\/p>\n<p>Box plots of the ratio of the run time of KNNRLD and LMM algorithms compared to CKNNRLD for fifty percent of observations as a new set of observations, by simulation parameters (from left to right N, C, T, D, (R, E) and overall mean<\/p>\n<p>Supplementary Fig. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"supplementary material anchor\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#MOESM1\" rel=\"nofollow noopener\" target=\"_blank\">S1<\/a> illustrates the sensitivity of CKNNRLD to misspecification in the number of clusters (\u0394C). Specifically, it compares the mean squared error (MSE) when the true number of clusters is correctly selected (\u0394C\u2009=\u20090) versus when C is under or overestimated by one (\u0394C\u2009=\u2009\u2009\u00b1\u20091). Results show that in 73% of simulation scenarios, the optimal C was selected and yielded lower MSE. In the remaining 27%, a modest increase in MSE was observed.<\/p>\n<p>The Pearson correlation coefficients between clustering accuracy criteria and estimate accuracy criteria in the CKNNRLD method are presented in Table\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"table anchor\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#Tab3\" rel=\"nofollow noopener\" target=\"_blank\">3<\/a>. The results indicate significant negative correlations between clustering accuracy indices (Rand, Adjusted Rand, and Nowak) and bias and Mean Squared Error (MSE), suggesting that improved clustering accuracy is associated with lower estimation errors. The strongest correlations are observed for the Rand index, with bias (\u2212\u00a00.376) and MSE (\u2212\u00a00.320), highlighting its relevance in ensuring precise estimation. The proportion of matched clusters also shows a weaker but significant negative correlation with bias (\u2212\u00a00.199) and MSE (\u2212\u00a00.180). However, coverage probability (CP) does not exhibit strong correlations with clustering accuracy measures, indicating that while clustering quality impacts bias and mean squared error (MSE), it has a minimal influence on the coverage of confidence intervals. These findings underscore the significance of effective clustering in enhancing the predictive performance of CKNNRLD and demonstrate that the quality of clustering has a direct impact on the regression performance of CKNNRLD. However, the method remains robust when standard validation indices are used to determine cluster structure, even in the presence of moderate noise.<\/p>\n<p>Table\u00a03 Pearson correlation of clustering accuracy criteria by estimate accuracy criteria in CKNNRLD methodApplications to real data<\/p>\n<p>The severity and prognosis of respiratory diseases are primarily determined by the results of pulmonary function tests, particularly spirometry [<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 33\" title=\"Jian W, Gao Y, Hao C, Wang N, Ai T, Liu C, et al. Reference values for spirometry in Chinese aged 4\u201380 years. J Thorac Dis. 2017;9:4538.\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#ref-CR33\" id=\"ref-link-section-d157103094e10005\" rel=\"nofollow noopener\" target=\"_blank\">33<\/a>]. Accurate interpretation of spirometry results relies on standardized reference values that account for population-specific factors such as race, age, and height. However, respiratory scales derived from spirometry do not adhere to a linear model, as lung volumes exhibit a skewed distribution influenced by age-related and height-dependent variations. Understanding these complex patterns is crucial for precise diagnosis, monitoring disease progression, and evaluating the impact of environmental and occupational exposures on respiratory health [<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" title=\"Braun L, Wolfgang M, Dickersin K. Defining race\/ethnicity and explaining difference in research studies on lung function. Eur Respir J. 2013;41:1362\u201370.\" href=\"#ref-CR34\" id=\"ref-link-section-d157103094e10008\">34<\/a>,<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" title=\"Strippoli M-PF, Kuehni CE, Dogaru CM, Spycher BD, McNally T, Silverman M, et al. Etiology of ethnic differences in childhood spirometry. Pediatrics. 2013;131:e1842\u20139.\" href=\"#ref-CR35\" id=\"ref-link-section-d157103094e10008_1\">35<\/a>,<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" title=\"Quanjer PH, Stanojevic S, Cole TJ, Baur X, Hall GL, Culver BH, et al. Multi-ethnic reference values for spirometry for the 3\u201395-yr age range: the global lung function 2012 equations. 2012.\" href=\"#ref-CR36\" id=\"ref-link-section-d157103094e10008_2\">36<\/a>,<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 37\" title=\"Loeloe MS, Sefidkar R, Tabatabaei SM, Mehrparvar AH, Jambarsang S. Machine learning-based spirometry reference values for the iranian population: a cross-sectional study from the Shahedieh Persian Cohort. Front Med. 2025;12:1480931.\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#ref-CR37\" id=\"ref-link-section-d157103094e10011\" rel=\"nofollow noopener\" target=\"_blank\">37<\/a>]. Forced vital capacity (FVC) is a key indicator that reflects both restrictive and obstructive pulmonary impairments, making it essential for monitoring long-term respiratory health. Tracking changes in lung function over time is essential, particularly in occupational environments where workers may be exposed to airborne pollutants, dust, and other respiratory hazards that contribute to long-term pulmonary decline. Continuous monitoring enables the identification of early signs of impairment, facilitating timely interventions, workplace safety improvements, and the development of preventive measures to reduce the risk of chronic respiratory diseases [<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 37\" title=\"Loeloe MS, Sefidkar R, Tabatabaei SM, Mehrparvar AH, Jambarsang S. Machine learning-based spirometry reference values for the iranian population: a cross-sectional study from the Shahedieh Persian Cohort. Front Med. 2025;12:1480931.\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#ref-CR37\" id=\"ref-link-section-d157103094e10014\" rel=\"nofollow noopener\" target=\"_blank\">37<\/a>, <a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 38\" title=\"Ventilation AC of GIHC on I. Industrial ventilation: a manual of recommended practice. In: American Conference of Governmental Industrial Hygienists; 1995.\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#ref-CR38\" id=\"ref-link-section-d157103094e10017\" rel=\"nofollow noopener\" target=\"_blank\">38<\/a>].<\/p>\n<p>In this section, we investigate the longitudinal pattern of spirometry variables among Iran Bafq iron ore workers. The Forced Vital Capacity (FVC) variable, measured in liters, was assessed for 274 employees of this mine over three consecutive years: 2022, 2023, and 2024. Age, height, and exposure to tobacco (in pack-years; a pack-year is a clinical quantification of cigarette smoking used to measure a person\u2019s exposure to tobacco) were considered key features. These features can be used to predict the process of changing the indicators of a new person, as they play a crucial role in determining lung function trajectories over time. Given the non-linear nature of pulmonary changes, incorporating these variables into predictive models allows for a more personalized assessment of respiratory health. By leveraging machine learning techniques, such as CKNNRLD and KNNRLD, it becomes possible to estimate future spirometry values, identify individuals at risk of lung function decline, and implement early interventions to mitigate potential respiratory impairments. For this purpose, the data were divided into two sets: train and test. The number of variable trajectories for 30 subjects (11%) was considered the test set, and the remaining data was used as the training set to train the CKNNRLD and KNNRLD methods. In Fig.\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#Fig5\" rel=\"nofollow noopener\" target=\"_blank\">5<\/a>, the variable trajectories are specified for 244 training data subjects (Panel A), and the optimal number of clusters was determined using the kml package and various criteria (see Fig.\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#Fig5\" rel=\"nofollow noopener\" target=\"_blank\">5<\/a>, Panel B). Finally, for every 30 subjects in the test dataset, the predictions from both methods and the actual values of the variable trajectories are illustrated in Panel C of Fig.\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1#Fig5\" rel=\"nofollow noopener\" target=\"_blank\">5<\/a>. Internal cluster validation on the real spirometry dataset was performed using the Calinski-Harabasz criterion within the kml package. The maximum value was observed at C\u2009=\u20094 (CH \u2248 351.7), with C\u2009=\u20093 (CH \u2248 344.3) also yielding competitive scores, supporting the selection of a small number of well-separated longitudinal clusters.<\/p>\n<p>Fig.\u00a05<a class=\"c-article-section__figure-link\" data-test=\"img-link\" data-track=\"click\" data-track-label=\"image\" data-track-action=\"view figure\" href=\"https:\/\/bmcbioinformatics.biomedcentral.com\/articles\/10.1186\/s12859-025-06205-1\/figures\/5\" rel=\"nofollow noopener\" target=\"_blank\"><img decoding=\"async\" aria-describedby=\"Fig5\" src=\"https:\/\/www.newsbeep.com\/il\/wp-content\/uploads\/2025\/09\/12859_2025_6205_Fig5_HTML.png\" alt=\"figure 5\" loading=\"lazy\" width=\"685\" height=\"581\"\/><\/a><\/p>\n<p>A Trajectories for training data; B KML clustering trajectory for training data; C Prediction trajectory for test data. KML, K-means for longitudinal data; FVC, forced vital capacity<\/p>\n","protected":false},"excerpt":{"rendered":"Variable-trajectory Let \\(y_{it} \\in {\\mathbb{R}}\\) denote the observed response value for the subject \\(i \\in \\left\\{ {1, \\ldots&hellip;\n","protected":false},"author":2,"featured_media":46737,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[6592,4682,114,36692,36693,85,46,36690,36689,36688,1359,31618,36691],"class_list":["post-46736","post","type-post","status-publish","format-standard","has-post-thumbnail","category-business","tag-algorithms","tag-bioinformatics","tag-business","tag-computational-biology-bioinformatics","tag-computer-appl-in-life-sciences","tag-il","tag-israel","tag-k-means-clustering","tag-k-nearest-neighbors","tag-longitudinal-studies","tag-machine-learning","tag-microarrays","tag-processing-speed"],"_links":{"self":[{"href":"https:\/\/www.newsbeep.com\/il\/wp-json\/wp\/v2\/posts\/46736","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.newsbeep.com\/il\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.newsbeep.com\/il\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.newsbeep.com\/il\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.newsbeep.com\/il\/wp-json\/wp\/v2\/comments?post=46736"}],"version-history":[{"count":0,"href":"https:\/\/www.newsbeep.com\/il\/wp-json\/wp\/v2\/posts\/46736\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.newsbeep.com\/il\/wp-json\/wp\/v2\/media\/46737"}],"wp:attachment":[{"href":"https:\/\/www.newsbeep.com\/il\/wp-json\/wp\/v2\/media?parent=46736"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.newsbeep.com\/il\/wp-json\/wp\/v2\/categories?post=46736"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.newsbeep.com\/il\/wp-json\/wp\/v2\/tags?post=46736"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}