Learn R Programming

⚠️There's a newer version (1.6.3) of this package.Take me there.

latrend (version 1.6.0)

A Framework for Clustering Longitudinal Data

Description

A framework for clustering longitudinal datasets in a standardized way. The package provides an interface to existing R packages for clustering longitudinal univariate trajectories, facilitating reproducible and transparent analyses. Additionally, standard tools are provided to support cluster analyses, including repeated estimation, model validation, and model assessment. The interface enables users to compare results between methods, and to implement and evaluate new methods with ease. The 'akmedoids' package is available from .

Copy Link

Version

Install

install.packages('latrend')

Monthly Downloads

398

Version

1.6.0

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Niek Den Teuling

Last Published

February 18th, 2024

Functions in latrend (1.6.0)

externalMetric

Compute external model metric(s)
getCall.lcModel

Get the model call
getArgumentExclusions

Arguments to be excluded from the specification
interface-dtwclust

dtwclust interface
defineInternalMetric

Define an internal metric for lcModels
lcModels

Construct a list of lcModel objects
evaluate.lcMethod

Substitute the call arguments for their evaluated values
APPA

Average posterior probability of assignment (APPA)
OCC

Odds of correct classification (OCC)
formula.lcModel

Extract the formula of a lcModel
test

Test a condition
latrend-estimation

Overview of lcMethod estimation functions
createTestDataFolds

Create all k test folds from the training data
interface-mixAK

mixAK interface
preFit

lcMethod estimation step: method preparation logic
lcMethodLMKM

Two-step clustering through linear regression modeling and k-means
logLik.lcModel

Extract the log-likelihood of a lcModel
lcMethodLcmmGBTM

Specify GBTM method
clusterTrajectories

Extract cluster trajectories
latrendBatch

Cluster longitudinal data for a list of method specifications
getCitation

Get citation info
interface-mixtools

mixtools interface
lcMethodMixAK_GLMM

Specify a GLMM iwht a normal mixture in the random effects
latrend-data

Longitudinal dataset representation
nClusters

Number of clusters
interface-crimCV

crimCV interface
compose

lcMethod estimation step: compose an lcMethod object
update.lcModel

Update a lcModel
coef.lcModel

Extract lcModel coefficients
validate

lcMethod estimation step: method argument validation logic
nIds

Number of trajectories
defineExternalMetric

Define an external metric for lcModels
time.lcModel

Sampling times of a lcModel
confusionMatrix

Compute the posterior confusion matrix
lcModel

Longitudinal cluster result (lcModel)
interface-featureBased

featureBased interface
getInternalMetricDefinition

Get the internal metric definition
as.lcMethods

Convert a list of lcMethod objects to a lcMethods list
as.data.frame.lcModels

Generate a data.frame containing the argument values per method per row
clusterSizes

Number of trajectories per cluster
generateLongData

Generate longitudinal test data
as.lcModels

Convert a list of lcModels to a lcModels list
interface-mclust

mclust interface
interface-mixtvem

mixtvem interface
lcMethods

Generate a list of lcMethod objects
as.list.lcMethod

Extract the method arguments as a list
interface-funFEM

funFEM interface
PAP.adh1y

Biweekly Mean PAP Therapy Adherence of OSA Patients over 1 Year
[[,lcMethod-method

Retrieve and evaluate a lcMethod argument by name
getInternalMetricNames

Get the names of the available internal metrics
latrend-is

Check if object is of Class
latrend-assert

latrend-specific assertions
latrendRep

Cluster longitudinal data repeatedly
as.data.frame.lcMethod

Convert lcMethod arguments to a list of atomic types
isArgDefined

Check whether the argument of a lcMethod has a defined value.
PAP.adh

Weekly Mean PAP Therapy Usage of OSA Patients in the First 3 Months
getExternalMetricNames

Get the names of the available external metrics
tsmatrix

Convert a longitudinal data.frame to a matrix
latrend-generics

Generics used by latrend for different classes
latrend-methods

Supported methods for longitudinal clustering
lcMethodKML

Specify a longitudinal k-means (KML) method
df.residual.lcModel

Extract the residual degrees of freedom from a lcModel
lcMethodGCKM

Two-step clustering through latent growth curve modeling and k-means
lcMethod-estimation

Longitudinal cluster method (lcMethod) estimation procedure
model.frame.lcModel

Extract model training data
as.data.frame.lcMethods

Convert a list of lcMethod objects to a data.frame
converged

Check model convergence
model.data.lcModel

Extract the model data that was used for fitting
ids

Get the trajectory ids on which the model was fitted
formula.lcMethod

Extract formula
createTrainDataFolds

Create the training data for each of the k models in k-fold cross validation evaluation
lcMethodAkmedoids

Specify AKMedoids method
lcApproxModel-class

lcApproxModel class
getArgumentDefaults

Default argument values for the given method specification
interface-flexmix

flexmix interface
lcModelPartition

Create a lcModel with pre-defined partitioning
deviance.lcModel

lcModel deviance
getLabel

Object label
lcModelWeightedPartition

Create a lcModel with pre-defined weighted partitioning
getExternalMetricDefinition

Get the external metric definition
plotClusterTrajectories

Plot cluster trajectories
lcMethodMixtoolsGMM

Specify mixed mixture regression model using mixtools
plotTrajectories

Plot the data trajectories
getLcMethod

Get the method specification
latrend-approaches

High-level approaches to longitudinal clustering
interface-metaMethods

lcMetaMethod abstract class
lcMethodMixtoolsNPRM

Specify non-parametric estimation for independent repeated measures
lcMethod-class

lcMethod class
lcMethodDtwclust

Specify time series clustering via dtwclust
latrendBoot

Cluster longitudinal data using bootstrapping
lcMethodMixTVEM

Specify a MixTVEM
lcMethodCrimCV

Specify a zero-inflated repeated-measures GBTM method
lcMethodFeature

Feature-based clustering
metric

Compute internal model metric(s)
latrendCV

Cluster longitudinal data over k folds
plotMetric

Plot one or more internal metrics for all lcModels
postprob

Posterior probability per fitted trajectory
timeVariable

Extract the time variable
strip

Reduce the memory footprint of an object for serialization
lcModels-class

lcModels: a list of lcModel objects
meanNA

Mean ignoring NAs
predictPostprob

Posterior probability for new data
plotFittedTrajectories

Plot the fitted trajectories
which.weight

Sample an index of a vector weighted by the elements
predict.lcModel

lcModel predictions
plot-lcModels-method

Grid plot for a list of models
responseVariable

Extract response variable
prepareData

lcMethod estimation step: logic for preparing the training data
trajectories

Extract the trajectories
lcModel-class

lcModel class
match.call.all

Argument matching with defaults and parent ellipsis expansion
latrend-metrics

Metrics
.trajSubset

Select trajectories
latrendData

Artificial longitudinal dataset comprising three classes
initialize,lcMethod-method

lcMethod initialization
subset.lcModels

Subsetting a lcModels list based on method arguments
weighted.meanNA

Weighted arithmetic mean ignoring NAs
clusterNames<-

Update the cluster names
latrend-package

latrend: A Framework for Clustering Longitudinal Data
fitted.lcModel

Extract lcModel fitted values
estimationTime

Estimation time
lcMethodRandom

Specify a random-partitioning method
fit

lcMethod estimation step: logic for fitting the method to the processed data
model.data

Extract the model training data
lcFitMethods

Method fit modifiers
max.lcModels

Select the lcModel with the highest metric value
fittedTrajectories

Extract the fitted trajectories
lcMethodFunFEM

Specify a FunFEM method
names,lcMethod-method

lcMethod argument names
qqPlot

Quantile-quantile plot
postprobFromAssignments

Create a posterior probability matrix from a vector of cluster assignments.
clusterTrajectories,lcModelPartition-method

function interface
clusterNames

Get the cluster names
interface-kml

kml interface
getArgumentDefaults,lcMethodLcmmGMM-method

lcmm interface
interface-akmedoids

akmedoids interface
residuals.lcModel

Extract lcModel residuals
lcMatrixMethod-class

lcMatrixMethod
lcMethodFunction

Specify a custom method based on a function
clusterProportions

Proportional size of each cluster
getName

Object name
sigma.lcModel

Extract residual standard deviation from a lcModel
update.lcMethod

Update a method specification
.defineInternalDistanceMetrics

Define the distance metrics for multiple types at once
latrend-parallel

Parallel computation using latrend
idVariable

Extract the trajectory identifier variable
predictAssignments

Predict the cluster assignments for new trajectories
lcMethodFlexmix

Method interface to flexmix()
lcModel-data-filters

Data filters for lcModel
latrend

Cluster longitudinal data using the specified method
lcMethodStratify

Specify a stratification method
lcMethodLcmmGMM

Specify GMM method using lcmm
summary.lcModel

Summarize a lcModel
lcModel-make

Cluster-handling functions for lcModel implementations.
min.lcModels

Select the lcModel with the lowest metric value
plot-lcModel-method

Plot a lcModel
print.lcMethod

Print the arguments of an lcMethod object
trajectoryAssignments

Get the cluster membership of each trajectory
predictForCluster

Predict trajectories conditional on cluster membership
tsframe

Convert a multiple time series matrix to a data.frame
transformFitted

Helper function for custom lcModel classes implementing fitted.lcModel()
lcMethodFlexmixGBTM

Group-based trajectory modeling using flexmix
print.lcModels

Print lcModels list concisely
lcMethodMclustLLPA

Longitudinal latent profile analysis
postFit

lcMethod estimation step: logic for post-processing the fitted lcModel
nobs.lcModel

Number of observations used for the lcModel fit
postProbFromObs

Compute the id-specific postprob matrix from a given observation-level postprob matrix
transformPredict

Helper function for custom lcModel classes implementing predict.lcModel()
createTestDataFold

Create the test fold data for validation
test.latrend

Test the implementation of an lcMethod and associated lcModel subclasses