Learn R Programming

kml (version 1.1.3)

calculMean: ~ Function: calculCenterGeneralized ~

Description

Given some longitudinal data and a Partition, calculCenterGeneralized compute the center trajectories of each clusters.

Usage

calculCenterGeneralized(traj, xPart, centerMethod = meanNA)

Arguments

traj
[matrix]: longitudinal data. Each line is an individual, each colomn is a time mesurement.
xPart
[Partition]: affectation of each individual.
centerMethod
[function]: function use to calculate the center of each cluster.

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 center of each cluster is evaluated. This is what calculCenterGeneralized does. Note that calculCenterGeneralized does not work with ClusterizLongData object but with a matrix. affectIndivGenerized used with calculCenterGeneralized does simulate one step of EM-algorithm. This function is programmed in R, it is not expect to be as fast as calculMean.

Examples

Run this code
#######################
### calculCenterGeneralized

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

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

### Clusters center
calculCenterGeneralized(traj,part,medianNA)

Run the code above in your browser using DataLab