Learn R Programming

kml3d (version 0.6)

ordered(ListClustering): ~ Function: ordered(ListClustering) ~

Description

Sort the Clustering of a ListClustering according to a quality criterion. (the function ordered for Partition is describe here).

Usage

ordered(x,...)

Arguments

x
[ListClustering]: Object whose Clustering should be sort.
...
Note used, for S4 compatibility only.

Value

  • This function change internaly the order of the fields c2, c3, ... c26 of an object. In addition, it return the permutation matrix (the matrix use to re-ordered the ci).

Author(s)

Christophe Genolini INSERM U669 / PSIGIAM: Paris Sud Innovation Group in Adolescent Mental Health Modal'X / Universite Paris Ouest-Nanterre- La Defense Contact author : genolini@u-paris10.fr

Details

Sort the Clustering of a ListClustering for each list (sort the 'c2' list, the 'c3' list,...) according to a quality criterion. The criterion used to sort is the one in the field criterionActif. The increasing or decreasing option is selected according to the criterion using the constant CRITERION_MIN_OR_MAX. Clustering that does not have a value for the selected criterion are put last.

References

Article "KmL: K-means for Longitudinal Data", in Computational Statistics, Volume 25, Issue 2 (2010), Page 317. Web site: http://christophe.genolini.free.fr/kml

Examples

Run this code
##############
### Preparing data

### Longdata
traj <- as.longData(array(rnorm(30*5*2),dim=c(30,5,2)))

### Some clustering
part2 <- partition(rep(c("A","B","A"),time=10),nbClusters=2)
clust2 <- clustering(traj,part2)
part2b <- partition(rep(c("A","B","B"),time=10),nbClusters=2)
clust2b <- clustering(traj,part2b)

part3 <- partition(rep(c("A","B","C"),time=10),nbClusters=3)
clust3 <- clustering(traj,part3)
part3b <- partition(rep(c("A","B","C","B","C"),time=6),nbClusters=3)
clust3b <- clustering(traj,part3b)

################
### ListClustering
listClus <- listClustering()
listClus['criterionActif'] <-"calinski"
plot(listClus)

listClus["add"] <- clust2
listClus["add"] <- clust2b
listClus["add"] <- clust2
listClus["add"] <- clust3
listClus["add"] <- clust3b
listClus["add"] <- clust3
plot(listClus)

###
ordered(listClus)
plot(listClus)

Run the code above in your browser using DataLab