trajectories {clustra}R Documentation

Cluster longitudinal trajectories over time.

Description

Performs k-means clustering on continuous response measured over time, where each mean is defined by a thin plate spline fit to all points in a cluster. Typically, this function is called by clustra.

Usage

trajectories(
  data,
  k,
  group,
  maxdf,
  conv = c(10, 0),
  mccores = 1,
  verbose = FALSE,
  ...
)

Arguments

data

Data table or data frame with response measurements, one per observation. Column names are id, time, response, group. Note that ids must be sequential starting from 1. This affects expanding group numbers to ids.

k

Number of clusters (groups)

group

Vector of initial group numbers corresponding to ids.

maxdf

Integer. Basis dimension of smooth term. See s function parameter k, in package mgcv.

conv

A vector of length two, c(iter, minchange), where iter is the maximum number of EM iterations and minchange is the minimum percentage of subjects changing group to continue iterations. Setting minchange to zero continues iterations until no more changes occur or maxiter is reached.

mccores

Integer number of cores to use by mclapply sections. Parallelization is over k, the number of clusters.

verbose

Logical, whether to produce debug output. A value > 1 will plot tps fit lines in each iteration.

...

See clustra for allowed ... parameters.

Value

A list with components

Author(s)

George Ostrouchov and David Gagnon


[Package clustra version 0.2.1 Index]