~ Functions: calculTrajMean & calculTrajMeanC ~
Given some longitudinal data and a cluster affectation,
calculTrajMean and calculTrajMeanC compute the mean trajectories of each cluster.
calculTrajMean(traj, clust, centerMethod = function(x){mean(x, na.rm =TRUE)})
calculTrajMeanC(traj, clust)traj |
|
clust |
|
centerMethod |
|
Given a vector of affectation to a cluster, the function
calculTrajMean compute the "central" trajectory of each
clusters. The "center" can be define using the argument centerMethod.
calculTrajMeanC does the same but
assume that the center definition is the classic "mean".
calculTrajMeanC is writen in C (and is therefor much faster).
affectIndiv used with calculTrajMean simulates one k-means step.
A matrix with k line and t column containing k clusters centers. Each line is a center, each column is a time measurement.
####################### ### calculMean ### Some trajectories traj <- gald()["traj"] ### A cluster affectation clust <- initializePartition(3,200,"randomAll") ### Computation of the cluster's centers system.time(centers <- calculTrajMean(traj,clust)) system.time(centers <- calculTrajMeanC(traj,clust))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.