clustMixType (version 0.2-2)

tau_kproto: Validating k Prototypes Clustering: Tau index

Description

Calculating the Tau index for a k-Prototypes clustering with k clusters or computing the optimal number of clusters based on the Tau index for k-Prototype clustering.

Usage

tau_kproto(object = NULL, data = NULL, k = NULL, dists = NULL, ...)

Arguments

object

Object of class kproto resulting from a call with kproto(..., keep.data=TRUE)

data

Original data; only required if object == NULL.

k

Vector specifying the search range for optimum number of clusters; if NULL the range will set as 2:sqrt(n). Only required if object == NULL.

dists

for internal purposes only

...

Further arguments passed to kproto, like:

  • nstart: If > 1 repetetive computations of kproto with random initializations are computed.

  • lambda: Factor to trade off between Euclidean distance of numeric variables and simple matching coefficient between categorical variables.

  • verbose: Logical whether information about the cluster procedure should be given. Caution: If verbose=FALSE, the reduction of the number of clusters is not mentioned.

Value

For computing the optimal number of clusters based on the Tau index for k-Prototype clustering the output contains:

k_opt

optimal number of clusters

indices

calculated indices for \(k=2,...,k_{max}\)

For computing the Tau index-value for a given k-Prototype clustering the output contains:

index

calculated index-value

Details

$$Tau = \frac{s(+) - s(-)}{((\frac{N_t(N_t-1)}{2}-t)\frac{N_t(N_t-1)}{2})^{0.5}}$$ Comparisons are made between all within-cluster dissimilarities and all between-cluster dissimilarities. \(s(+)\) is the number of concordant comparisons and \(s(-)\) is the number of discordant comparisons. A comparison is named concordant (resp. discordant) if a within-cluster dissimilarity is strictly less (resp. strictly greater) than a between-cluster dissimilarity. \(N_t\) is the total number of distances \(\frac{n(n-1)}{2}\) and \(t\) is the number of comparisons of two pairs of objects where both pairs represent within-cluster comparisons or both pairs are between-cluster comparisons. The maximum value of the index is used to indicate the optimal number of clusters.

References

See Also

Other clustervalidation indices: dunn_kproto, dunn_kproto, gamma_kproto, gplus_kproto, mcclain_kproto, ptbiserial_kproto, silhouette_kproto

Examples

Run this code
# NOT RUN {
# generate toy data with factors and numerics

n   <- 10
prb <- 0.99
muk <- 2.5

x1 <- sample(c("A","B"), 2*n, replace = TRUE, prob = c(prb, 1-prb))
x1 <- c(x1, sample(c("A","B"), 2*n, replace = TRUE, prob = c(1-prb, prb)))
x1 <- as.factor(x1)

x2 <- sample(c("A","B"), 2*n, replace = TRUE, prob = c(prb, 1-prb))
x2 <- c(x2, sample(c("A","B"), 2*n, replace = TRUE, prob = c(1-prb, prb)))
x2 <- as.factor(x2)

x3 <- c(rnorm(n, mean = -muk), rnorm(n, mean = muk), rnorm(n, mean = -muk), rnorm(n, mean = muk))
x4 <- c(rnorm(n, mean = -muk), rnorm(n, mean = muk), rnorm(n, mean = -muk), rnorm(n, mean = muk))

x <- data.frame(x1,x2,x3,x4)

# apply k prototyps
kpres <- kproto(x, 4, keep.data=TRUE)

# calculate index-value
tau_value <- tau_kproto(object = kpres)

# calculate optimal number of cluster
k_opt <- tau_kproto(data = x, k = 3:5, nstart = 5, verbose = FALSE)

# }

Run the code above in your browser using DataLab