Clustering with several number of clusters
hier.vegclust.Rd
Performs several runs of function 'vegclust' (or 'vegclustdist') on a community data matrix (or distance matrix) using different number of clusters
Usage
hier.vegclust(x, hclust, cmin=2,cmax=20, min.size=NULL, verbose=TRUE, ...)
hier.vegclustdist(x, hclust, cmin=2,cmax=20, min.size=NULL, verbose=TRUE, ...)
random.vegclust(x, cmin=2, cmax=20, nstart=10, min.size=NULL, verbose=TRUE, ...)
random.vegclustdist(x, cmin=2, cmax=20, nstart=10, min.size=NULL, verbose=TRUE, ...)
Arguments
- x
For
hier.vegclust
and random.vegclust, a site (rows) by species (columns) matrix or data frame. Forhier.vegclustdist
and random.vegclustdist, a square distance matrix.- hclust
A hierarchical clustering represented in an object of type
hclust
.- cmin
Number of minimum mobile clusters.
- cmax
Number of maximum mobile clusters.
- nstart
A number indicating how many random trials should be performed for each number of groups
- min.size
If
min.size != NULL
, it specifies the minimum size of clusters. If some clusters are smaller, the algorithm will return the solutions corresponding to lower numbers of clusters.- verbose
Flag used to print which number of clusters is currently running.
- ...
Additional parameters for function
vegclust
orvegclustdist
.
Details
Function hier.vegclust
takes starting cluster configurations from cuts of a dendrogram given by object hclust
. Function random.vegclust
chooses random objects as cluster centroids and for each number of clusters performs nstart
trials. Functions hier.vegclustdist
and random.vegclustdist
are analogous to hier.vegclust
and random.vegclust
but accept distance matrices as input.
Value
Returns an object of type 'mvegclust' (multiple vegclust), which contains a list vector with objects of type vegclust
.
Examples
## Loads data
data(wetland)
## This equals the chord transformation
## (see also \code{\link{decostand}} in package vegan)
wetland.chord = as.data.frame(sweep(as.matrix(wetland), 1,
sqrt(rowSums(as.matrix(wetland)^2)), "/"))
## Create noise clustering from hierarchical clustering at different number of clusters
wetland.hc = hclust(dist(wetland.chord),method="ward")
#> The "ward" method has been renamed to "ward.D"; note new "ward.D2"
wetland.nc1 = hier.vegclust(wetland.chord, wetland.hc, cmin=2, cmax=5,
m = 1.2, dnoise=0.75, method="NC")
#> PROCESSING 2 MOBILE CLUSTERS
#> PROCESSING 3 MOBILE CLUSTERS
#> PROCESSING 4 MOBILE CLUSTERS
#> PROCESSING 5 MOBILE CLUSTERS
## Create noise clustering from random seeds at different levels
wetland.nc2 = random.vegclust(wetland.chord, cmin=2, cmax=5, nstart=10,
m = 1.2, dnoise=0.75, method="NC")
#> PROCESSING 2 MOBILE CLUSTERS
#> PROCESSING 3 MOBILE CLUSTERS
#> PROCESSING 4 MOBILE CLUSTERS
#> PROCESSING 5 MOBILE CLUSTERS