criterion {longitudinalData} | R Documentation |
Given a LongData
and a
Partition
, the fonction criterion
calculate
some criterions that are classicaly use to estimate the quality of a clusterization.
criterion(object, partition, method)
object |
[LongData] : object on which the criterion are calculate |
partition |
[Paritition] : clusterization of the LongData |
method |
[character] : if some value are missing in the
LongData , it is necessary to impute them. The function
criterion call the function imputation using
the method method . |
Given a LongData
and a
Partition
, the fonction criterion
calculate
some criterions that are classicaly use to estimate the quality of a clusterization.
If some individual have no clusters (ie if Partition
has some
missing values), the corresponding trajectories are exclude from the
calculation.
Note that if there is an empty cluster or an empty longData, most of the criterions are anavailable.
A list:
varBetween |
[matrix] : variance between |
varWithin |
[matrix] : variance within |
calinski |
[numeric] : Calinski and Harabatz criterion |
LongData
, Partition
, imputation
################## ### Preparation of some artificial data par(ask=TRUE) traj <- gald() ### Correct partition part1 <- partition(rep(1:4,each=50),4) (cr1 <- criterion(traj,part1)) plot(traj,part1,main=paste("Calinski =",formatC(cr1[["calinski"]]))) ### Random partition part2 <- partition(floor(runif(200,1,5)),4) (cr2 <- criterion(traj,part2)) plot(traj,part2,main=paste("Calinski =",formatC(cr2[["calinski"]]))) ### Partition with 3 clusters instead of 4 part3 <- partition(rep(c(1,2,3,3),each=50),3) (cr3 <- criterion(traj,part3)) plot(traj,part3,main=paste("Calinski =",formatC(cr3[["calinski"]]))) ### Comparisons of the Partition cr1["calinski"] cr2["calinski"] cr3["calinski"] par(ask=FALSE)