Learn R Programming

WeightedCluster (version 1.8-0)

wcClusterQuality: Cluster quality statistics

Description

Compute several quality statistics of a given clustering solution.

Usage

wcClusterQuality(diss, clustering, weights = NULL)

Value

A list with two elements stats and ASW:

stats

with the following statistics:

ASW:

The Average Silhouette Width of each cluster, one column for each ASW measure.

Arguments

diss

A dissimilarity matrix or a dist object (see dist)

clustering

Factor. A vector of clustering membership.

weights

optional numerical vector containing weights.

Details

Compute several quality statistics of a given clustering solution. See value for details.

Examples

Run this code
data(mvad)
## Aggregating state sequence
aggMvad <- wcAggregateCases(mvad[, 17:86], weights=mvad$weight)

## Creating state sequence object
mvad.seq <- seqdef(mvad[aggMvad$aggIndex, 17:86], weights=aggMvad$aggWeights)
## Computing Hamming distance between sequence
diss <- seqdist(mvad.seq, method="HAM")

## KMedoids using PAMonce method (clustering only)
clust5 <- wcKMedoids(diss, k=5, weights=aggMvad$aggWeights, cluster.only=TRUE)

## Compute the silhouette of each observation
qual <- wcClusterQuality(diss, clust5, weights=aggMvad$aggWeights)

print(qual)

Run the code above in your browser using DataLab