View source: R/stages_kmeans.R
| stages_kmeans | R Documentation | 
Build a stage event tree with k stages for each variable
by clustering (transformed) probabilities with k-means.
stages_kmeans(
  object,
  k = length(object$tree[[1]]),
  algorithm = "Hartigan-Wong",
  transform = sqrt,
  ignore = object$name_unobserved,
  limit = length(object$tree),
  scope = NULL,
  nstart = 1
)
| object | an object of class  | 
| k | integer or (named) vector: number of clusters, that is stages per variable. Values will be recycled if needed. | 
| algorithm | character: as in  | 
| transform | function applied to the probabilities before clustering. | 
| ignore | vector of stages which will be ignored and left untouched,
by default the name of the unobserved stages stored in
 | 
| limit | the maximum number of variables to consider. | 
| scope | names of the variables to consider. | 
| nstart | as in  | 
kmenas_sevt performs k-means clustering
to aggregate the stage probabilities of the initial
staged tree object.
Different values for k can be specified by supplying a
(named) vector to k.
kmeans from the stats package is used
internally and arguments algorithm and nstart
refer to the same arguments as kmeans.
A staged event tree.
data("Titanic")
model <- stages_kmeans(full(Titanic, join_unobserved = TRUE, lambda = 1), k = 2)
summary(model)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.