MultiChannel.WUC {Ckmeans.1d.dp}R Documentation

Optimal Multi-channel Weighted Univariate Clustering


Perform optimal multi-channel weighted univariate k-means clustering in linear time.


  MultiChannel.WUC(x, y,  k=c(1,9))



a numeric vector of data to be clustered. All NA elements must be removed from x before calling this function. The function will run faster on sorted x (in non-decreasing order) than an unsorted input.


a numeric matrix of non-negative weights for each element in x. Columns of the matrix are channels. It is highly recommended to use positive (instead of zero) weights to account for the influence of every element. Weights strongly influence clustering results. When the number of clusters k is given as a range, the weights should be linearly scaled to sum up to the observed sample size.


either an exact integer number of clusters, or a vector of length two specifying the minimum and maximum numbers of clusters to be examined. The default is c(1,9). When k is a range, the actual number of clusters is determined by Bayesian information criterion (BIC).


MultiChannel.WUC minimizes the total weighted within-cluster sum of squared distance (Zhong 2019). It uses the SMAWK algorithm (Aggarwal et al. 1987) with modified data structure to speed up the dynamic programming to linear runtime. The method selects an optimal k based on an approximate Gaussian mixture model using the BIC.


A list object containing the following components:


a vector of clusters assigned to each element in x. Each cluster is indexed by an integer from 1 to k.


a numeric vector of the (weighted) means for each cluster.


a numeric vector of the (weighted) within-cluster sum of squares for each cluster.


a vector of the (weighted) number of elements in each cluster.


total sum of (weighted) squared distances between each element and the sample mean. This statistic is not dependent on the clustering result.


total sum of (weighted) within-cluster squared distances between each element and its cluster mean. This statistic is minimized given the number of clusters.


sum of (weighted) squared distances between each cluster mean and sample mean. This statistic is maximized given the number of clusters.


a character string. The actual name of the x argument.


a character string. The actual name of the y argument.


Hua Zhong and Mingzhou Song


Aggarwal A, Klawe MM, Moran S, Shor P, Wilber R (1987). “Geometric applications of a matrix-searching algorithm.” Algorithmica, 2(1-4), 195–208. doi: 10.1007/BF01840359.

Zhong H (2019). Model-free Gene-to-zone Network Inference of Molecular Mechanisms in Biology. Ph.D. thesis, Department of Computer Science, New Mexico State University, Las Cruces, NM, USA.


  X <- sort(sample(x = c(1:100), size = 20, replace = TRUE))
  Y <- matrix(sample(x = c(1:100), size = 40, replace = TRUE), ncol=2, nrow=length(X))

  res <- MultiChannel.WUC(x = X, y = Y, k = c(5:10))

[Package Ckmeans.1d.dp version 4.3.3 Index]