~ Function: affectIndiv3d ~
Given some longitudinal data (trajectories) and k clusters centers, affectIndiv3d
affects each individual to the cluster whose center is the closest.
affectIndiv3d(traj, clustersCenter, distance = dist3d)
traj |
|
clustersCenter |
|
distance |
|
Given an array of clusters center clustersCenter
(each plan of
the first dimension is
a cluster center, that is clusterCenter[2,,] is the second cluster
center), the function affectIndiv3d
affect each
individual of the array traj
to the closest clusters,
according to distance
.
affectIndiv3d
used with calculTrajMean3d
simulates one k-means 3D step.
Object of classPartition
.
####################### ### affectIndiv ### Some trajectories traj <- gald3d()["traj"] ### 4 clusters centers center <- traj[runif(4,1,nrow(traj)),,] ### Affectation of each individual part <- affectIndiv3d(traj,center) ################# ### K-means simulation (3 steps) plot(clusterLongData3d(traj),parTraj=parTRAJ(col=part+1)) for (i in 1:3){ center <- calculTrajMean3d(traj,part) part <- affectIndiv3d(traj,center) plot(clusterLongData3d(traj),parTraj=parTRAJ(col=part+1)) }
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.