~ Function: calculTrajMean3d ~
Given some joint longitudinal data and a cluster affectation,
calculTrajMean3d
computes the mean joint-trajectories of each cluster.
calculTrajMean3d(traj, clust,centerMethod=function(x){mean(x,na.rm=TRUE)})
traj |
|
clust |
|
centerMethod |
|
Given a vector of affectation to a cluster, the function
calculTrajMean3d
compute the "central" trajectory of each
clusters. The "center" can be define using the argument centerMethod
.
affectIndiv3d
used with calculTrajMean3d
simulates one k-means step.
An array of dimension (k,t,v)
with k
number of groups, t
number of
time mesurement and v
number of variables.
####################### ### calculTrajMean3d ### Some LongitudinalData3d traj <- gald3d()["traj"] ### A partition part <- floor(runif(150,1,5)) plot(clusterLongData3d(traj),parTraj=parTRAJ(col=part+1)) ### Clusters center (center <- calculTrajMean3d(traj,part)) ################# ### K-means simulation (4 steps) plot(clusterLongData3d(traj),parTraj=parTRAJ(col=part+1)) for (i in 1:4){ part <- affectIndiv3d(traj,center) center <- calculTrajMean3d(traj,part) plot(clusterLongData3d(traj),parTraj=parTRAJ(col=part+1)) }
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.