clust2params {qcluster} | R Documentation |
Converts Hard Assignment Into Cluster Parameters
Description
Transforms cluster labels into a list of parameters describing cluster size, mean, and dispersion.
Usage
clust2params(data, cluster)
Arguments
data |
a numeric vector, matrix, or data frame of observations.
Rows correspond to observations and columns correspond to variables/features.
Categorical variables and |
cluster |
a vector of integers representing cluster labels. |
Value
A list containing cluster parameters.
Let P=
number of variable/features and K=
number of clusters.
The elements of the list are as follows:
-
prop:
a vector of clusters' proportions; -
mean:
a matrix of dimension(P x K)
containing the clusters' mean parameters; -
cov:
an array of size(P x P x K)
containing the clusters' covariance matrices.
Examples
# load data
data("banknote")
# compute the k-means partition
set.seed(2024)
cl <- kmeans(banknote[-1], centers = 2, nstart = 1)$cluster
# convert k-means hard assignment into cluster parameters
clpars <- clust2params(banknote[-1], cl)
clpars
[Package qcluster version 1.2.1 Index]