stages_kmeans {stagedtrees} | R Documentation |
Learn a staged tree with k-means clustering
Description
Build a stage event tree with k
stages for each variable
by clustering (transformed) probabilities with k-means.
Usage
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
)
Arguments
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 |
Details
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
.
Value
A staged event tree.
Examples
data("Titanic")
model <- stages_kmeans(full(Titanic, join_unobserved = TRUE, lambda = 1), k = 2)
summary(model)