Learn R Programming

kml (version 2.1.2)

calculMean: ~ Function: calculMean ~

Description

Given some longitudinal data and a Partition, calculMean compute the mean trajectories of each clusters.

Usage

calculMean(traj, xPart)

Arguments

traj
[matrix]: longitudinal data. Each line is an individual, each colomn is a time mesurement.
xPart
[Partition]: affectation of each individual.

Value

  • A matrix with k line and t column containning k clusters centers. Each line is a center, each column is a time mesurement.

Details

EM algorithm (like k-means) altern two phases : Esperance and Maximisation. During Esperance, the mean of each cluster is evaluated. This is what calculMean does. Note that calculMean does not work with ClusterizLongData object but with a matrix. affectIndiv used with calculMean does simulate one k-means step. This function is programmed in C, it is expect to be fast.

Examples

Run this code
#######################
### calculMean

### Some LongitudinalData
traj <- as.cld(gald())["traj"]

### A partition
part <- partition(floor(runif(200,1,5)),4)

### Clusters center
calculMean(traj,part)

Run the code above in your browser using DataLab