seqclustname {WeightedCluster} | R Documentation |
Automatic labeling of cluster using sequence medoids
Description
This function automatically name the cluster using the sequence medoid of each cluster.
Usage
seqclustname(seqdata, group, diss, weighted = TRUE, perc = FALSE)
Arguments
seqdata |
State sequence object (see |
group |
A vector of clustering membership. |
diss |
a dissimilarity matrix or a |
weighted |
Logical. If |
perc |
Logical. If |
Value
A factor of clustering membership. The labels are defined using sequences medoids and optionnaly percentage of case in each cluster.
Examples
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)
clust5.labels <- seqclustname(mvad.seq, clust5$clustering, diss=diss, perc=TRUE)
seqdplot(mvad.seq, group=clust5.labels)
[Package WeightedCluster version 1.6-4 Index]