Skip to content

Instantly share code, notes, and snippets.

@explodecomputer
Created May 12, 2016 16:17
Show Gist options
  • Select an option

  • Save explodecomputer/620e621556d7bfd4c7986c4078530daf to your computer and use it in GitHub Desktop.

Select an option

Save explodecomputer/620e621556d7bfd4c7986c4078530daf to your computer and use it in GitHub Desktop.
weighted clustering
library(WeightedCluster)
data(mvad)
mvad.alphabet <- c("employment", "FE", "HE", "joblessness", "school", "training")
mvad.labels <- c("Employment", "Further Education", "Higher Education", "Joblessness", "School", "Training")
mvad.scodes <- c("EM", "FE", "HE", "JL", "SC", "TR")
mvadseq <- seqdef(mvad[, 17:86], alphabet = mvad.alphabet,
states = mvad.scodes, labels = mvad.labels,
weights = mvad$weight, xtstep = 6)
subm.custom <- matrix(
c(0, 1, 1, 2, 1, 1,
1, 0, 1, 2, 1, 2,
1, 1, 0, 3, 1, 2,
2, 2, 3, 0, 3, 1,
1, 1, 1, 3, 0, 2,
1, 2, 2, 1, 2, 0),
nrow = 6, ncol = 6, byrow = TRUE)
mvaddist <- seqdist(mvadseq, method = "OM", indel = 1.5, sm = subm.custom)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment