Skip to contents

comp.FKM.indices() compares the clustering indices of two more more clusterings that are output from cluster.coefs() or cluster.fitted().

Usage

comp.FKM.indices(clusterings, index = "ALL", clusternames = NA)

Arguments

clusterings

A list object of the clusterings to compare. Each should be of class 'FKM.TPS'.

index

Desired cluster validity index or indices. Default is "ALL". Options are: "PC", "PE", "MPC", "SIL", "SIL.F", "XB", or "ALL". Multiple options can be input as a character vector. See fclust::Fclust.index()

clusternames

Optional character vector with names of the clusters being compared.

Value

A data frame with the desired validity indices for each of the clusterings.

Details

comp.FKM.indices() compares the clustering indices of two more more clusterings that are output from cluster.coefs() or cluster.fitted(). Available indices are those found in the fclust package: PC (partition coefficient), PE (partition entropy), MPC (modified partition coefficient), SIL (silhouette), SIL.F (fuzzy silhouette), and XB (Xie-Beni). The default ALL gives all indices. See fclust::Fclust.index()

See also

Values for cluster validity indices are calculated using the fclust package. See fclust::Fclust.index()

Examples

data(TS.sim)

fitsplines <- TPSfit(TS.sim, vars=c("Var1", "Var2", "Var3"), time="Time",
     ID="SubjectID", knots_time=c(0, 91, 182, 273, 365), n_fit_times=10)

ccoefs_2 <- cluster.coefs(fitsplines, k=2, seed=1234, RS=10)
ccoefs_3 <- cluster.coefs(fitsplines, k=2, seed=1234, RS=10)
ccoefs_4 <- cluster.coefs(fitsplines, k=2, seed=1234, RS=10)
ccoefs_5 <- cluster.coefs(fitsplines, k=2, seed=1234, RS=10)

# Compare clusters using all indices and custom names
comp.FKM.indices(list(ccoefs_2, ccoefs_3, ccoefs_4, ccoefs_5),
clusternames=c("k=2", "k=3", "k=4", "k=5"))
#>            PC        PE       MPC       SIL     SIL.F       XB
#> k=2 0.6795184 0.2448186 0.3590367 0.2246924 0.2483164 0.858249
#> k=3 0.6795184 0.2448186 0.3590367 0.2246924 0.2483164 0.858249
#> k=4 0.6795184 0.2448186 0.3590367 0.2246924 0.2483164 0.858249
#> k=5 0.6795184 0.2448186 0.3590367 0.2246924 0.2483164 0.858249

# Compare clusterings using a subset of the indices
comp.FKM.indices(list(ccoefs_2, ccoefs_3, ccoefs_4, ccoefs_5),
clusternames=c("k=2", "k=3", "k=4", "k=5"), index=c("SIL.F", "XB"))
#>         SIL.F       XB
#> k=2 0.2483164 0.858249
#> k=3 0.2483164 0.858249
#> k=4 0.2483164 0.858249
#> k=5 0.2483164 0.858249