Learn R Programming

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

latrend (version 1.5.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.

Copy Link

Version

Install

install.packages('latrend')

Monthly Downloads

354

Version

1.5.0

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Niek Den Teuling

Last Published

November 10th, 2022

Functions in latrend (1.5.0)

converged

Check model convergence
latrend-assert

latrend-specific assertions
coef.lcModel

Extract lcModel coefficients
confusionMatrix

Compute the posterior confusion matrix
clusterTrajectories

Extract the cluster trajectories
clusterSizes

Number of trajectories per cluster
clusterNames<-

Update the cluster names
clusterNames

Get the cluster names
deviance.lcModel

lcModel deviance
createTrainDataFolds

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

Create the test fold data for validation
.defineInternalDistanceMetrics

Define the distance metrics for multiple types at once
df.residual.lcModel

Extract the residual degrees of freedom from a lcModel
defineInternalMetric

Define an internal metric for lcModels
compose

lcMethod fit process: compose an lcMethod object
clusterProportions

Proportional size of each cluster
defineExternalMetric

Define an external metric for lcModels
estimationTime

Get the model estimation time
.trajSubset

Select trajectories
createTestDataFolds

Create all k test folds from the training data
formula.lcMethod

Extract formula
fittedTrajectories

Extract the fitted trajectories for all strata
fit

lcMethod fit process: logic for fitting the method to the processed data
fitted.lcModel

Extract lcModel fitted values
generateLongData

Generate longitudinal test data
formula.lcModel

Extract the formula of a lcModel
getLabel

Extract the method label.
getLcMethod

Get the method specification of a lcModel
getName

Get the (short) name of the lcMethod or Model
getInternalMetricNames

Get the names of the available internal metrics
getArgumentExclusions

Arguments to be excluded for lcMethod subclass
getArgumentDefaults

Default argument values for lcMethod subclass
getExternalMetricDefinition

Get the external metric definition
evaluate.lcMethod

Substitute the call arguments for their evaluated values
externalMetric,lcModel,lcModel-method

Compute external model metric(s)
getInternalMetricDefinition

Get the internal metric definition
getExternalMetricNames

Get the names of the available external metrics
getCall.lcModel

Get the model call
interface-dtwclust

dtwclust interface
clusterTrajectories,lcModelPartition-method

function interface
interface-kml

kml interface
interface-funFEM

funFEM interface
[[,lcMethod-method

Retrieve and evaluate a lcMethod argument by name
interface-flexmix

flexmix interface
interface-featureBased

featureBased interface
ids

Get the trajectory ids on which the model was fitted
idVariable

Extract the trajectory identifier variable
latrend-is

Check if object is of Class
interface-crimCV

crimCV interface
interface-akmedoids

akmedoids interface
initialize,lcMethod-method

lcMethod initialization
getArgumentDefaults,lcMethodLcmmGMM-method

lcmm interface
interface-mclust

mclust interface
isArgDefined

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

latrend: A Framework for Clustering Longitudinal Data
latrend-generics

Method- and model-specific generics defined by the latrend package
interface-metaMethods

lcMetaMethod abstract class
interface-mixAK

mixAK interface
lcFitMethods

Method fit modifiers
lcMatrixMethod-class

lcMatrixMethod
latrend-parallel

Parallel computing using latrend
latrend

Cluster longitudinal data
latrendBoot

Cluster longitudinal data using bootstrapping
latrendBatch

Cluster longitudinal data for a list of method specifications
lcApproxModel-class

lcApproxModel class
interface-mixtvem

mixtvem interface
latrendRep

Cluster longitudinal data repeatedly
latrendCV

Cluster longitudinal data over k folds
latrendData

Artificial longitudinal dataset comprising three classes
interface-mixtools

mixtools interface
lcMethod-class

lcMethod class
lcMethodFlexmix

Method interface to flexmix()
lcMethodFeature

Feature-based clustering
lcMethodFunction

Specify a custom method based on a function
lcMethodGCKM

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

Specify AKMedoids method
lcMethodRandom

Specify a random-partitioning method
lcMethodMixtoolsNPRM

Specify non-parametric estimation for independent repeated measures
lcMethodMclustLLPA

Longitudinal latent profile analysis
lcMethodMixAK_GLMM

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

Specify GMM method using lcmm
lcMethodFlexmixGBTM

Group-based trajectory modeling using flexmix
lcMethodFunFEM

Specify a FunFEM method
lcMethodLcmmGBTM

Specify GBTM method
lcMethodKML

Specify a longitudinal k-means (KML) method
lcMethodCrimCV

Specify a zero-inflated repeated-measures GBTM method
lcMethodDtwclust

Specify time series clustering via dtwclust
lcMethodLMKM

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

lcModel class
logLik.lcModel

Extract the log-likelihood of a lcModel
lcMethodMixtoolsGMM

Specify mixed mixture regression model using mixtools
lcMethodMixTVEM

Specify a MixTVEM
lcMethodStratify

Specify a stratification method
lcMethods

Generate a list of lcMethod objects
lcModel-data-filters

Data filters for lcModel
model.frame.lcModel

Extract model training data
lcModelWeightedPartition

Create a lcModel with pre-defined weighted partitioning
lcModels

Construct a flat (named) list of lcModel objects
lcModelPartition

Create a lcModel with pre-defined partitioning
lcModel-make

Cluster-handling functions for lcModel implementations.
min.lcModels

Select the lcModel with the lowest metric value
metric

Compute internal model metric(s)
max.lcModels

Select the lcModel with the highest metric value
meanNA

Mean ignoring NAs
match.call.all

Argument matching with defaults and parent ellipsis expansion
model.data.lcModel

Extract the model data that was used for fitting
nobs.lcModel

Number of observations used for the lcModel fit
model.data

Extract the model training data
plot-lcModels-method

Grid plot for a list of models
plot-lcModel-method

Plot a lcModel
nIds

Number of trajectories
postFit

lcMethod fit process: logic for post-processing the fitted lcModel
names,lcMethod-method

lcMethod argument names
plotTrajectories

Plot the data trajectories
nClusters

Number of clusters
plotFittedTrajectories

Plot fitted trajectories of a lcModel
plotClusterTrajectories

Plot cluster trajectories
postprobFromAssignments

Create a posterior probability matrix from a vector of cluster assignments.
print.lcModels

Print lcModels list concisely
prepareData

lcMethod fit process: logic for preparing the training data
plotMetric

Plot one or more internal metrics for all lcModels
predictForCluster

lcModel prediction conditional on a cluster
print.lcMethod

Print the arguments of an lcMethod object
qqPlot

Quantile-quantile plot
predictPostprob

lcModel posterior probability prediction
postprob

Posterior probability per fitted trajectory
postProbFromObs

Compute the id-specific postprob matrix from a given observation-level postprob matrix
predict.lcModel

lcModel predictions
predictAssignments

Predict the cluster assignments for new trajectories
responseVariable

Extract the response variable
test

Test a condition
timeVariable

Extract the time variable
summary.lcModel

Summarize a lcModel
strip

Reduce the lcModel memory footprint for serialization
subset.lcModels

Subsetting a lcModels list based on method arguments
sigma.lcModel

Extract residual standard deviation from a lcModel
preFit

lcMethod fit process: method preparation logic
residuals.lcModel

Extract lcModel residuals
time.lcModel

Sampling times of a lcModel
test.latrend

Test the implementation of an lcMethod and associated lcModel subclasses
trajectoryAssignments

Get the cluster membership of each trajectory
trajectories

Extract the trajectories
tsmatrix

Convert a longitudinal data.frame to a matrix
tsframe

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

lcMethod fit process: method argument validation logic
weighted.meanNA

Weighted arithmetic mean ignoring NAs
update.lcMethod

Update a method specification
which.weight

Sample an index of a vector weighted by the elements
transformPredict

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

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

Update a lcModel
as.lcMethods

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

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

Extract the method arguments as a list
as.lcModels

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

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

Odds of correct classification (OCC)
APPA

Average posterior probability of assignment (APPA)
PAP.adh

Biweekly Mean Therapy Adherence of OSA Patients over 1 Year
as.data.frame.lcMethod

Convert lcMethod arguments to a list of atomic types
OSA.adherence

Biweekly Mean Treatment Adherence of OSA Patients over 1 Year