We have a large sample (44,933 sequences each of potential length 35) with 9 states. We create a standard dissimilarity matrix:
seq <- seqdef(data, 3:37, right="DEL", left="DEL", gaps="GAP", indel=3, id=data$id, weights=data$weight)
Then create the dissimilarity matrix (We use indel=3 to place greater emphasis on length of the sequences in the clustering.):
om <- seqdist(seq, method="OM", indel=3, sm="TRATE", with.missing = TRUE)
Finally, we cluster the dissimilarity matrix:
seq.ward <- agnes(om, diss=TRUE, method="ward")
If we randomize the order of the rows in the original data:
rand1 <- sample(44933)
data.rand1 <- data[rand1,]
and then recreate the sequences and proceed as above, the cluster results differ.