Learn R Programming

longitudinalData (version 0.6.4)

criterion3: ~ Function: criterion3 ~

Description

Given a LongData and a Partition, the fonction criterion3 calculate some criterions that are classicaly use to estimate the quality of a clusterization.

Usage

criterion3(object, partition, method="linearInterpolation")

Arguments

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

Value

  • A list:
    • calinski
    {[numeric]: Calinski and Harabatz criterion c(k)=Trace(B)/Trace(W)*(n-k)/(k-1)}
  • ray[numeric]: Ray and Turi R(k) = 1/N Sum_{i in 1:k} sum_x in C_i |x-z_i|^2 / min(|z_i - z_j|^2)
  • davies[numeric]: Davies and Bouldin D(k) = Avg(max(pairwise comparison))

Details

Given a LongData and a Partition, the fonction criterion calculate three criterions that are classicaly use to estimate the quality of a clusterization : Calinski and Harabatz, Ray and Turi, Davies and Bouldin 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.

See Also

LongData, Partition, imputation, criterion

Examples

Run this code
##################
### Preparation of some artificial data
par(ask=TRUE)
traj <- gald()

### Correct partition
part1 <- partition(rep(1:4,each=50),4)
(cr1 <- criterion3(traj,part1))
plot(traj,part1,main=paste("Ray =",formatC(cr1[["ray"]])))


### Random partition
part2 <- partition(floor(runif(200,1,5)),4)
(cr2 <- criterion3(traj,part2))
plot(traj,part2,main=paste("Ray =",formatC(cr2[["ray"]])))

### 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("Ray =",formatC(cr3[["ray"]])))

### Comparisons of the Partition
cr1["ray"]
cr2["ray"]
cr3["ray"]
par(ask=FALSE)

Run the code above in your browser using DataLab