trajectories: Cluster longitudinal trajectories over time.

Description Usage Arguments Value Author(s)

View source: R/trajectories.R

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

1
2
3
4
5
6
7
8
9
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.

Value

A list with components

Author(s)

George Ostrouchov and David Gagnon


clustra documentation built on Jan. 16, 2022, 9:06 a.m.