Longitudinal clustering in kinesiology 1: the bare essentials of the kml and kml3d packages in R
DOI:
https://doi.org/10.63750/nswme776Keywords:
repeated measures, longitudinal clustering, cluster analysis, multivariate repeated measures, R, longitudinal k-meansAbstract
Longitudinal designs are common in the field of kinesiology, where there can often be high variability due to varying response patterns between participants. In studies where outcome changes are seen, there may be hidden groups of non-responders. Alternatively, in studies where no overall changes are seen, there may be hidden groups of responders. Longitudinal clustering is a method that is used to find unique trajectories in longitudinal designs. Cluster trajectories are a result of data quality, and clustering is not meant to be hypothesis driven. However, It may complement hypothesis-driven methods to better understand overall and nuanced change patterns. The purpose of this article is to demonstrate how to analyze a synthetic dataset using the kml and kml3d packages in R. It is meant to be relatively non-technical, easy to use, and interpret for inexperienced coders.
Downloads
References
Calinski, T., & Harabasz, J. (1974). A dendrite method for cluster analysis. Communications in Statistics, 3(1), 1–27. https://doi.org/10.1080/03610927408827101
Choueiry, G. (2025). Statistical software popularity in 40,582 research papers. Quantifying Health. https://quantifyinghealth.com/statistical-software-popularity-in-research/
Den Teuling, N. G. P., Pauws, S. C., & van den Heuvel, E. R. (2021). Clustering of longitudinal data: A tutorial on a variety of approaches [Preprint]. arXiv. https://doi.org/10.48550/arXiv.2111.05469
Genolini, C., Alacoque, X., Sentenac, M., & Arnaud, C. (2015). kml and kml3d: R packages to cluster longitudinal data. Journal of Statistical Software, 65(4), 1–34. https://doi.org/10.18637/jss.v065.i04
Hartigan, J. A., & Wong, M. A. (1979). Algorithm AS 136: A K-means clustering algorithm. Journal of the Royal Statistical Society. Series C (Applied Statistics), 28(1), 100–108. https://doi.org/10.2307/2346830
Hubal, M. J., Gordish-Dressman, H., Thompson, P. D., Price, T. B., Hoffman, E. P., Angelopoulos, T. J., Gordon, P. M., Moyna, N. M., Pescatello, L. S., Visich, P. S., Zoeller, R. F., Seip, R. L., & Clarkson, P. M. (2005). Variability in muscle size and strength gain after unilateral resistance training. Medicine and Science in Sports and Exercise, 37(6), 964–972.
Jain, P., & Sengar, S. (2024). Unraveling the role of IBM SPSS: A comprehensive examination of usage patterns, perceived benefits, and challenges in research practice. Educational Administration: Theory and Practice, 30(5). https://doi.org/10.53555/kuey.v30i5.4609
Mota, J. A., Rajeb, M., Man, K., & Wohlgemuth, K. J. (2023). Linear mixed-effect modeling in kinesiology research: A tutorial in R. Biomedical Journal of Scientific & Technical Research, 49(3), 40613–40623. https://biomedres.us/fulltexts/BJSTR.MS.ID.007794.php
Mullin, S., Zola, J., Lee, R., Hu, J., MacKenzie, B., Brickman, A., Anaya, G., Sinha, S., Li, A., & Elkin, P. L. (2021). Longitudinal K-means approaches to clustering and analyzing EHR opioid use trajectories for clinical subtypes. Journal of Biomedical Informatics, 122, Article 103889. https://doi.org/10.1016/j.jbi.2021.103889
Ojeda-Aravena, A., Herrera-Valenzuela, T., Valdés-Badilla, P., Cancino-López, J., Zapata-Bastias, J., & García-García, J. M. (2021). Inter-individual variability of a high-intensity interval training with specific techniques vs. repeated sprints program in sport-related fitness of Taekwondo athletes. Frontiers in Physiology, 12, Article 766153. https://doi.org/10.3389/fphys.2021.766153
OpenAI. (2025). ChatGPT [Large language model]. https://chat.openai.com/chat
Posit. (2025). RStudio Desktop [Computer software]. https://posit.co/download/rstudio-desktop/
Proust-Lima, C., Philipps, V., & Liquet, B. (2017). Estimation of extended mixed models using latent classes and latent processes: The R package lcmm. Journal of Statistical Software, 78(2), 1–56. https://doi.org/10.18637/jss.v078.i02
Pryor, L. E., Tremblay, R. E., Boivin, M., Touchette, E., Dubois, L., Genolini, C., Liu, X., Falissard, B., & Côté, S. M. (2011). Developmental trajectories of body mass index in early childhood and their risk factors: An 8-year longitudinal study. Archives of Pediatrics & Adolescent Medicine, 165(10), 906–912. https://doi.org/10.1001/archpediatrics.2011.153
R Core Team. (2025). R: A language and environment for statistical computing [Computer software]. R Foundation for Statistical Computing. https://www.r-project.org/
Ross, R., Goodpaster, B. H., Koch, L. G., Sarzynski, M. A., Kohrt, W. M., Johannsen, N. M., Skinner, J. S., Castro, A., Irving, B. A., Noland, R. C., Sparks, L. M., Spielmann, G., Day, A. G., Pitsch, W., Hopkins, W. G., & Bouchard, C. (2019). Precision exercise medicine: Understanding exercise response variability. British Journal of Sports Medicine, 53(18), 1141–1153. https://doi.org/10.1136/bjsports-2018-100328
Schwarz, G. (1978). Estimating the dimension of a model. The Annals of Statistics, 6(2), 461–464. https://doi.org/10.1214/aos/1176344136
Touchette, E., Petit, D., Tremblay, R. E., Boivin, M., Falissard, B., Genolini, C., & Montplaisir, J. Y. (2008). Associations between sleep duration patterns and overweight/obesity at age 6. Sleep, 31(11), 1507–1514. https://doi.org/10.1093/sleep/31.11.1507
Zhou, J., Zhang, Y., & Tu, W. (2023). clusterMLD: An efficient hierarchical clustering method for multivariate longitudinal data. Journal of Computational and Graphical Statistics, 32(3), 1131–1144. https://doi.org/10.1080/10618600.2022.2149540
Downloads
Published
Issue
Section
License
Copyright (c) 2025 Keston Lindsay (Author)

This work is licensed under a Creative Commons Attribution 4.0 International License.
Copyright & Licensing Policy:
- Open Access Policy: This journal follows a fully Open Access model, which means all published research articles are freely available to readers without any subscription or access fees. Anyone can read, download, copy, distribute, print, and cite the published work without restrictions, as long as they comply with the journal’s licensing terms.
- Copyright & License:
- All articles published in this journal are licensed under the Creative Commons Attribution 4.0 International (CC BY 4.0).
- This license allows unrestricted reuse and distribution, provided that proper credit is given to the original author and source.
- Authors retain full copyright ownership of their work while granting the journal the right to publish it for the first time under this license.
- Author Responsibilities:
- Authors must agree to the journal’s licensing terms before publication.
- Submitted manuscripts must be original and not published or under consideration elsewhere during the review process.
- Any reuse of published content by third parties must comply with the CC BY 4.0 license, ensuring no additional restrictions are imposed on reuse.
- Publication Fees (free to publish):
- This journal does not charge authors any fees for submission, processing, peer review or publication, and does not charge readers for access to published research, supporting the principle of free and open scientific knowledge for all.