seqclustname: Automatic labeling of cluster using sequence medoids

Description Usage Arguments Value Examples

Description

This function automatically name the cluster using the sequence medoid of each cluster.

Usage

1
seqclustname(seqdata, group, diss, weighted = TRUE, perc = FALSE)

Arguments

seqdata

State sequence object (see seqdef).

group

A vector of clustering membership.

diss

a dissimilarity matrix or a dist object.

weighted

Logical. If TRUE, weights of the seqdata object are taken to find the medoids.

perc

Logical. If TRUE, the percentage of sequences in each cluster is added to the label of each group.

Value

A factor of clustering membership. The labels are defined using sequences medoids and optionnaly percentage of case in each cluster.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
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)


Search within the WeightedCluster package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.