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)
## Compute distance using Hamming distance
diss <- seqdist(mvad.seq, method="HAM")
## Pam clustering
pamRange <- wcKMedRange(diss, 2:15)
## Plot all statistics (standardized)
plot(pamRange, stat="all", norm="zscoremed", lwd=3)
## Plotting sequences in 3 groups
seqdplot(mvad.seq, group=pamRange$clustering$cluster3)
Run the code above in your browser using DataLab