Create an Markov model from a regular clustering (k-means or PAM) of sequence data.
Arguments
- x
a clustering object (result of kmeans or PAM), a data set (a data matrix), or a vector with (integer) cluster assignments.
- data
the data used for clustering (only used if
xis a cluster assignment vector).- centers
if
xis a cluster assignment vector, then a data.frame or matrix with the cluster centers needs to be supplies. Otherwise,centersis ignored.- measure
used distance measure.
Examples
data("EMMsim")
## using kmeans
cl <- kmeans(EMMsim_train, 10)
emm <- TRAC(cl)
emm
#> EMM with 10 states/clusters.
#> Measure: euclidean
#> Threshold: 0.499165
#> Centroid: TRUE
#> Lambda: 0
plot(emm, method = "MDS")
## using a cluster assignment vector (taken from the k-means clustering above)
x <- cl$cluster
emm <- TRAC(x, data = EMMsim_train)
emm
#> EMM with 10 states/clusters.
#> Measure: euclidean
#> Threshold: 0.4028334
#> Centroid: TRUE
#> Lambda: 0
plot(emm, method = "MDS")