GitHub - philips-software/latrend: An R package for clustering longitudinal datasets in a standardized way, providing interfaces to various R packages for longitudinal clustering, and facilitating the rapid implementation and evaluation of new methods (original) (raw)

latrend

R-CMD-check CRAN Lifecycle: maturing Codecov test coverage Downloads

The latrend package provides a framework for clustering longitudinal datasets in a standardized way. The name is short for latent-class trend (analysis), referring to the discovery of hidden trends in the data. The package provides interfaces to various R packages for conducting this type of analysis.

The package is described in detail in the pre-print available at https://arxiv.org/abs/2402.14621

Features

See the release notes page for the latest updates.

Installation

The latest release of latrend can be installed from CRAN by running:

install.packages("latrend")

It can also be installed from Github directly using:

remotes::install_github('philips-software/latrend', ref = remotes::github_release())

include vignettes

remotes::install_github('philips-software/latrend', ref = remotes::github_release(), build_vignettes = TRUE)

Usage

Load and view example data.

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

image

Cluster the trajectories and plot the results.

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

image

Identify solutions for 1 to 5 clusters.

kmlMethods <- lcMethods(kmlMethod, nClusters = 1:5) models <- latrendBatch(kmlMethods, data = latrendData)

Determine the number of clusters through one or more internal cluser metrics.

metric(models, c("WMAE", "BIC")) plotMetric(models, c("Dunn", "ASW", "WMAE", "WRSS", "BIC", "estimationTime"))

image

Supported packages

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

Contributing

We appreciate any contributions in the form of ideas, feature requests, bug reports, bug fixes, documentation improvements, code reformatting, and code submissions. Please see the Contributing guide.