Partition-class {longitudinalData} | R Documentation |
~ Class: Partition ~
Description
An object of class Partition
is a partition of a population
into subgroups. The object also contains some information like the
percentage of trajectories in each group or some qualities criterion.
Objects from the Class
Objects are mainly intend to be created by some clustering methods (like k-means, fuzzy k-means, mixture modeling, latent class analysis,...)
Slots
nbClusters
[numeric]: number of groups, between 1 and 26
clusters
[vector(factor)]: vector containing the groups of each individual. Groups are in upper-case letters.
percentEachCluster
[vector(numeric)]: percentage of trajectories contained in each group.
postProba
[matrix(numeric)]: assuming that in each clusters C and for each time T, variable follow a normal law (mean and standard deviation of the variable at time T restricted to clusters C), then it is possible to compute the postterior probabilities of each individual (that is the probabilities that an individual has to belong to each clusters). These probabilities are hold in postProba.
postProbaEachCluster
[vector(numeric)]: for each clusters C, mean of the post probabilities to belong to C of the individual that effectively belong to C. A high percent means that the individual that are in this cluter realy meant to be here.
criterionValues
[vector(numeric)]: Value of the quality criterions used to evaluate the quality of the
Clustering
. SeequalityCriterion
for details.details
[vector(character)]: hold different optionnal informations like the algorithm (if any) used to find the partition, the convergence time, the imputation methods, the starting condition. Examples:
details=c(algorithm="kmeans",convergenceTime="3")
.
validation rules
A class Partition
object must follow some rules to be valid:
Slots should be either all empty, or all non empty.
-
nbClusters
has to be lower or equal to 26. -
clusters
is a factor inLETTERS[1:nbCluster]
.
Construction
Class Partition
objects are mainly constructed by some clustering methods
(like k-means, fuzzy k-means, mixture modeling, latent class
analysis,...). Neverdeless, it is also possible to construct them from
scratch using the fonction partition
.
Get [
- Object["nbClusters"]
[numeric]: Gets the number of clusters (the value of the slot
nbClusters
)- Object["clusters"]
[vector(factor)]: Gets the cluster of each individual (the value of the slot
clusters
)- Object["clustersAsInteger"]
[vector(integer)]
: Gets the cluster of each individual and turn them into integer- Object["percentEachClusters"]
[vector(numeric)]
: Get the percent of individual in each clusters (the value of the slotnbClusters
)- Object["postProbaEachClusters"]
[vector(numeric)]
: Get the post probabilities for each clusters.- Object["postProba"]
[matrix(numeric)]
: Get the post probabilities for each individual and each clusters.- Object["criterionValues"]
[vector(numeric)]
: gives the values of all the criterion values (the value of the slotcriterionValues
)- Object["details"]
[vector(character)]
: Get the values of the slotdetails
.- Object["XcriterionX"]
[numeric]
: Get the value of the criterionXcriterionX
. It can be one ofCalinski.Harabatz
,Krzysztof.Calinski
,Genolini.Calinski
,Ray.Turi
,Davies.Bouldin
,BIC
,AIC
,AICc
orrandom
.- Object["XspecialX"]
[character]
: Get the value namedXspecialX
in the slotdetails
(probably one ofmultiplicity
,convergenceTime
,imputationMethod
oralgorithm
.)
Setteur [<-
- Object["multiplicity"]<-value
[numeric]: In the slot
details
, sets the values namesmultiplicity
tovalue
.- Object["convergenceTime"]<-value
[numeric]: In the slot
details
, sets the values namesconvergenceTime
tovalue
.
The others slot can not be change after the object creation.
Author
Christophe Genolini
1. UMR U1027, INSERM, Université Paul Sabatier / Toulouse III / France
2. CeRSME, EA 2931, UFR STAPS, Université de Paris Ouest-Nanterre-La Défense / Nanterre / France
References
[1] C. Genolini and B. Falissard
"KmL: k-means for longitudinal data"
Computational Statistics, vol 25(2), pp 317-328, 2010
[2] C. Genolini and B. Falissard
"KmL: A package to cluster longitudinal data"
Computer Methods and Programs in Biomedicine, 104, pp e112-121, 2011
See Also
Overview: longitudinalData-package
Classes: LongData
Methods: partition
Examples
############
### Building Partition
### number
part <- partition(rep(c(1,2,1,3),time=3))
### LETTERS
part <- partition(rep(c("A","B","D"),time=4),details=c(convergenceTime="3",multiplicity="1"))
### Others don't work
try(partition(rep(c("A","Bb","C"),time=3)))
#############
### Setteur and Getteur
### '['
part["clusters"]
part["clustersAsInteger"]
part["nbClusters"]
### '[<-'
part["multiplicity"] <- 2
(part)