/latrend

An R package for clustering longitudinal datasets in a standardized way, providing interfaces to various R packages for longitudinal clustering.

Primary LanguageRGNU General Public License v2.0GPL-2.0

latrend

The latrend package provides a framework for clustering longitudinal datasets in a standardized way. It provides interfaces to various R packages for longitudinal clustering.

Features

  • Unified cluster analysis, independent of the underlying algorithms used. Enabling users to compare the performance of various longitudinal cluster methods on the case study at hand.
  • Supports many different methods for longitudinal clustering out of the box (see the list of supported packages below).
  • The framework consists of extensible S4 methods based on an abstract model class, enabling rapid prototyping of new cluster methods or model specifications.
  • Standard plotting tools for model evaluation across methods (e.g., trajectories, cluster trajectories, model fit, metrics)
  • Support for many cluster metrics through the packages clusterCrit, mclustcomp, and igraph.
  • The structured and unified analysis approach enables simulation studies for comparing methods.
  • Standardized model validation for all methods through bootstrapping or k-fold cross-validation.

Installation

remotes::install_github("https://github.com/philips-software/latrend")

Including vignettes:

remotes::install_github("https://github.com/philips-software/latrend", build_vignettes = TRUE)

Usage

library(latrend)

Load and view example data.

data(latrendData)
head(latrendData)
options(latrend.id = "Id", latrend.time = "Time")
plotTrajectories(latrendData, response = "Y")

Cluster the trajectories and plot the results.

kmlMethod <- lcMethodKML("Y", nClusters = 3)
model <- latrend(kmlMethod, data = latrendData)
summary(model)
plot(model)

Supported packages

The latrend package provides interfaces to the relevant methods for longitudinal clustering for the following packages: