Manly.Kmeans {ManlyMix} | R Documentation |
k-means algorithm with Manly transformation
Description
Runs the CEM algorithm for k-means clustering with specified initial membership and transformation parameters.
Usage
Manly.Kmeans(X, id = NULL, la = NULL, Mu = NULL, S = NULL,
initial = "k-means", K = NULL, nstart = 100, method = "ward.D",
tol = 1e-5, max.iter = 1000)
Arguments
X |
dataset matrix (n x p) |
id |
initial membership vector (length n) |
la |
initial transformation parameters (K x p) |
Mu |
initial matrix of mean vectors (K x p) |
S |
initial vector of variances (K) |
initial |
initialization strategy of the EM algorithm ("k-means" - partition obtained by k-means clustering, "hierarchical" - partition obtained by hierarchical clustering) |
K |
number of clusters for the k-means initialization |
nstart |
number of random starts for the k-means initialization |
method |
linkage method for the hierarchical initialization |
tol |
tolerance level |
max.iter |
maximum number of iterations |
Details
Runs the CEM algorithm for k-means clustering with Manly transformation for a provided dataset. The model assumes that a multivariate Manly transformation applied to each component allows to reach near-normality. A user has a choice to specify either initial id vector 'id' and transformation parameters 'la' or initial mode parameters 'la', 'Mu', and 'S'. In the case when transformation parameters are not provided, the function runs the EM algorithm without any transformations, i.e., it is equivalent to the EM algorithm for a k-means model. If some transformation parameters have to be excluded from the consideration, in the corresponding positions of matrix 'la', the user has to specify value 0. Notation: n - sample size, p - dimensionality of the dataset X, K - number of mixture components.
Value
la |
matrix of the estimated transformation parameters (K x p) |
Mu |
matrix of the estimated mean vectors (K x p) |
S |
array of the estimated covariance matrices (K) |
id |
estimated membership vector (length n) |
iter |
number of EM iterations run |
flag |
convergence flag (0 - success, 1 - failure) |
See Also
Manly.EM
Examples
set.seed(123)
K <- 3; p <- 4
X <- as.matrix(iris[,-5])
id.true <- rep(1:K, each = 50)
# Obtain initial memberships based on the traditional K-means algorithm
id.km <- kmeans(X, K)$cluster
# Run the CEM algorithm for k-means with Manly transformation based on traditional k-means solution
la <- matrix(0.1, K, p)
B <- Manly.Kmeans(X, id.km, la)
id.Manly <- B$id
ClassAgree(id.Manly, id.true)