Learn R Programming

latrend (version 1.6.1)

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

405

Version

1.6.1

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Niek Den Teuling

Last Published

May 15th, 2024

Functions in latrend (1.6.1)

as.data.frame.lcModels

Generate a data.frame containing the argument values per method per row
as.list.lcMethod

Extract the method arguments as a list
APPA

Average posterior probability of assignment (APPA)
OCC

Odds of correct classification (OCC)
PAP.adh1y

Biweekly Mean PAP Therapy Adherence of OSA Patients over 1 Year
clusterSizes

Number of trajectories per cluster
compose

lcMethod estimation step: compose an lcMethod object
as.data.frame.lcMethod

Convert lcMethod arguments to a list of atomic types
as.lcMethods

Convert a list of lcMethod objects to a lcMethods list
confusionMatrix

Compute the posterior confusion matrix
clusterNames<-

Update the cluster names
clusterTrajectories

Extract cluster trajectories
clusterProportions

Proportional size of each cluster
converged

Check model convergence
createTrainDataFolds

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

Define the distance metrics for multiple types at once
PAP.adh

Weekly Mean PAP Therapy Usage of OSA Patients in the First 3 Months
latrend-assert

latrend-specific assertions
defineInternalMetric

Define an internal metric for lcModels
clusterNames

Get the cluster names
coef.lcModel

Extract lcModel coefficients
.trajSubset

Select trajectories
createTestDataFold

Create the test fold data for validation
df.residual.lcModel

Extract the residual degrees of freedom from a lcModel
createTestDataFolds

Create all k test folds from the training data
.guessResponseVariable

Guess the response variable
evaluate.lcMethod

Substitute the call arguments for their evaluated values
deviance.lcModel

lcModel deviance
estimationTime

Estimation time
formula.lcModel

Extract the formula of a lcModel
formula.lcMethod

Extract formula
generateLongData

Generate longitudinal test data
getArgumentDefaults

Default argument values for the given method specification
fittedTrajectories

Extract the fitted trajectories
fitted.lcModel

Extract lcModel fitted values
getLcMethod

Get the method specification
defineExternalMetric

Define an external metric for lcModels
fit

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

Get the names of the available external metrics
getInternalMetricDefinition

Get the internal metric definition
externalMetric

Compute external model metric(s)
getCitation

Get citation info
interface-crimCV

crimCV interface
getName

Object name
getInternalMetricNames

Get the names of the available internal metrics
idVariable

Extract the trajectory identifier variable
interface-akmedoids

akmedoids interface
ids

Get the trajectory ids on which the model was fitted
getLabel

Object label
[[,lcMethod-method

Retrieve and evaluate a lcMethod argument by name
initialize,lcMethod-method

lcMethod initialization
interface-flexmix

flexmix interface
getArgumentExclusions

Arguments to be excluded from the specification
getExternalMetricDefinition

Get the external metric definition
interface-featureBased

featureBased interface
interface-mixtools

mixtools interface
getCall.lcModel

Get the model call
latrend-is

Check if object is of Class
interface-mixtvem

mixtvem interface
interface-funFEM

funFEM interface
clusterTrajectories,lcModelPartition-method

function interface
getArgumentDefaults,lcMethodLcmmGMM-method

lcmm interface
interface-kml

kml interface
interface-dtwclust

dtwclust interface
isArgDefined

Check whether the argument of a lcMethod has a defined value.
latrend-approaches

High-level approaches to longitudinal clustering
latrend-methods

Supported methods for longitudinal clustering
latrend-metrics

Metrics
latrend-data

Longitudinal dataset representation
interface-mixAK

mixAK interface
interface-metaMethods

lcMetaMethod abstract class
latrend

Cluster longitudinal data using the specified method
latrendBatch

Cluster longitudinal data for a list of method specifications
interface-mclust

mclust interface
latrendBoot

Cluster longitudinal data using bootstrapping
latrend-package

latrend: A Framework for Clustering Longitudinal Data
latrend-generics

Generics used by latrend for different classes
lcFitMethods

Method fit modifiers
latrend-estimation

Overview of lcMethod estimation functions
lcApproxModel-class

lcApproxModel class
lcMethodFunction

Specify a custom method based on a function
lcMethod-estimation

Longitudinal cluster method (lcMethod) estimation procedure
lcMethodAkmedoids

Specify AKMedoids method
lcMethodCrimCV

Specify a zero-inflated repeated-measures GBTM method
lcMethodFeature

Feature-based clustering
lcMethodFlexmix

Method interface to flexmix()
latrendCV

Cluster longitudinal data over k folds
lcMethodDtwclust

Specify time series clustering via dtwclust
lcMatrixMethod-class

lcMatrixMethod
lcMethod-class

lcMethod class
latrendRep

Cluster longitudinal data repeatedly
latrendData

Artificial longitudinal dataset comprising three classes
latrend-parallel

Parallel computation using latrend
lcMethodFlexmixGBTM

Group-based trajectory modeling using flexmix
lcMethodMclustLLPA

Longitudinal latent profile analysis
lcMethodMixAK_GLMM

Specify a GLMM iwht a normal mixture in the random effects
lcMethodFunFEM

Specify a FunFEM method
lcMethodLcmmGBTM

Specify GBTM method
lcMethodLcmmGMM

Specify GMM method using lcmm
lcMethodMixtoolsGMM

Specify mixed mixture regression model using mixtools
lcMethodGCKM

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

Specify a MixTVEM
lcModel-class

lcModel class
lcModels-class

lcModels: a list of lcModel objects
lcModels

Construct a list of lcModel objects
lcModel-data-filters

Data filters for lcModel
lcMethodKML

Specify a longitudinal k-means (KML) method
lcModelPartition

Create a lcModel with pre-defined partitioning
lcModelWeightedPartition

Create a lcModel with pre-defined weighted partitioning
min.lcModels

Select the lcModel with the lowest metric value
lcMethodRandom

Specify a random-partitioning method
max.lcModels

Select the lcModel with the highest metric value
nClusters

Number of clusters
lcModel-make

Cluster-handling functions for lcModel implementations.
lcMethodMixtoolsNPRM

Specify non-parametric estimation for independent repeated measures
lcModel

Longitudinal cluster result (lcModel)
metric

Compute internal model metric(s)
lcMethodLMKM

Two-step clustering through linear regression modeling and k-means
nIds

Number of trajectories
model.data

Extract the model training data
model.frame.lcModel

Extract model training data
names,lcMethod-method

lcMethod argument names
model.data.lcModel

Extract the model data that was used for fitting
plotTrajectories

Plot the data trajectories
lcMethodStratify

Specify a stratification method
plotFittedTrajectories

Plot the fitted trajectories
plotMetric

Plot one or more internal metrics for all lcModels
lcMethods

Generate a list of lcMethod objects
logLik.lcModel

Extract the log-likelihood of a lcModel
match.call.all

Argument matching with defaults and parent ellipsis expansion
nobs.lcModel

Number of observations used for the lcModel fit
plot-lcModel-method

Plot a lcModel
meanNA

Mean ignoring NAs
plotClusterTrajectories

Plot cluster trajectories
plot-lcModels-method

Grid plot for a list of models
postprob

Posterior probability per fitted trajectory
postProbFromObs

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

Create a posterior probability matrix from a vector of cluster assignments.
preFit

lcMethod estimation step: method preparation logic
predictAssignments

Predict the cluster assignments for new trajectories
predict.lcModel

lcModel predictions
postFit

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

Extract lcModel residuals
predictPostprob

Posterior probability for new data
predictForCluster

Predict trajectories conditional on cluster membership
print.lcMethod

Print the arguments of an lcMethod object
print.lcModels

Print lcModels list concisely
qqPlot

Quantile-quantile plot
prepareData

lcMethod estimation step: logic for preparing the training data
test

Test a condition
subset.lcModels

Subsetting a lcModels list based on method arguments
summary.lcModel

Summarize a lcModel
test.latrend

Test the implementation of an lcMethod and associated lcModel subclasses
time.lcModel

Sampling times of a lcModel
responseVariable

Extract response variable
timeVariable

Extract the time variable
strip

Reduce the memory footprint of an object for serialization
sigma.lcModel

Extract residual standard deviation from a lcModel
tsframe

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

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

lcMethod estimation step: method argument validation logic
trajectoryAssignments

Get the cluster membership of each trajectory
tsmatrix

Convert a longitudinal data.frame to a matrix
update.lcModel

Update a lcModel
update.lcMethod

Update a method specification
trajectories

Get the trajectories
weighted.meanNA

Weighted arithmetic mean ignoring NAs
transformPredict

Helper function for custom lcModel classes implementing predict.lcModel()
which.weight

Sample an index of a vector weighted by the elements
as.data.frame.lcMethods

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

Convert a list of lcModels to a lcModels list