Learn R Programming

longitudinalData (version 0.6.5)

criterion: ~ Function: criterion ~

Description

Given a LongData and a Partition, the fonction criterion calculate Calinski & Harabatz criterion.

Usage

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

Arguments

object
[LongData]: object on which the criterion is 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)}

Details

Given a LongData and a Partition, the fonction criterion calculate Calinksi and Harabatz criterion. 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, criterion3

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 <- 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)

Run the code above in your browser using DataLab