Learn R Programming

flexclust (version 0.7-0)

stepFlexclust: Run FlexClust Algorithms Repeatedly

Description

Runs clustering algorithms repeatedly for different numbers of clusters and returns the minimum within cluster distance solution for each.

Usage

stepFlexclust(..., K=NULL, nrep=3, verbose=TRUE, FUN = kcca, drop=TRUE)

## S3 method for class 'stepFlexclust,missing': plot(x, y, xlab=NULL, ylab=NULL, type=c("barplot", "lines"), ...)

## S3 method for class 'stepFlexclust': getModel(object, which=1)

Arguments

...
passed to kcca or cclust.
K
A vector of integers passed in turn to the k argument of kcca
nrep
For each value of k run kcca nrep times and keep only the best solution.
FUN
Cluster function to use, typically kcca or cclust.
verbose
If TRUE, show progress information during computations.
drop
If TRUE and K is of length 1, then a single cluster object is returned instead of a "stepFlexclust" object.
x
Object of class "stepFlexclust".
y
Not used.
type
Create a barplot or lines plot.
xlab, ylab
Graphical parameters.
object
Object of class "stepFlexclust".
which
Number of model to get. If character, interpreted as number of clusters.

Examples

Run this code
data("Nclus", package="flexmix")
plot(Nclus)

cl1 = stepFlexclust(Nclus, K=2:7, FUN=cclust)
cl1

plot(cl1)

getModel(cl1, 4)

opar=par("mfrow")
par(mfrow=c(2,2))
for(k in 3:6){
  image(getModel(cl1, as.character(k)), data=Nclus)
  title(main=paste(k, "clusters"))
}
par(opar)

Run the code above in your browser using DataLab