Kmeans {Kmedians} | R Documentation |
Kmeans
Description
A K-means algorithm.
Usage
Kmeans(X,nclust=1:15,ninit=1,niter=20,par=TRUE)
Arguments
X |
A numerical matrix giving the data. |
nclust |
A vector of positive integers giving the possible numbers of clusters. Default is |
ninit |
A non negative integer giving the number of random initializations. Default is |
niter |
A positive integer giving the number of iterations for the EM algorirthms. Default is |
par |
A logical argument telling if the parallelization of the algorithm is allowed. Default is |
Value
A list with:
bestresults |
A list giving all the results for the clustering selected by |
allresults |
A list containing all the results. |
SE |
A vector giving the Sum of Errors for each considered number of clusters. |
cap |
The results given by the function |
Ksel |
An integer giving the number of clusters selected by |
data |
A numerical matrix giving the data. |
nclust |
A vector of positive integers giving the considered numbers of clusters. |
For the lists bestresult
and allresults
:
cluster |
A vector of positive integers giving the clustering. |
centers |
A numerical matrix giving the centers of the clusteres. |
SE |
An integer giving the Sum of Errors. |
See Also
See also Kmedians
, Kplot
and gen_K
.
Examples
## Not run:
n <- 500
K <- 3
pcont <- 0.2
ech <- gen_K(n=n,K=K,pcont=pcont)
X <-ech$X
res <- Kmeans(X,par=FALSE)
Kplot(res)
## End(Not run)