Last chance! 50% off unlimited learning
Sale ends in
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
)
A staged event tree.
an object of class sevt
with fitted probabilities and
data, as returned by full
or sevt_fit
.
integer or (named) vector: number of clusters, that is stages per variable. Values will be recycled if needed.
character: as in kmeans
.
function applied to the probabilities before clustering.
vector of stages which will be ignored and left untouched,
by default the name of the unobserved stages stored in
object$name_unobserved
.
the maximum number of variables to consider.
names of the variables to consider.
as in kmeans
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
.
data("Titanic")
model <- stages_kmeans(full(Titanic, join_unobserved = TRUE, lambda = 1), k = 2)
summary(model)
Run the code above in your browser using DataLab