clustvar: Cluster variance

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/clustvar.R

Description

Computes the variation in community composition (i.e. beta diversity) found within the sites of a set of hard or fuzzy clusters.

Usage

1
clustvar(x, cluster = NULL, defuzzify=FALSE,...)

Arguments

x

Community data. Either a site-by-species matrix or a site-by-site matrix of compositional distances between sites (i.e., an object of class dist). Alternatively, this can be an object of class vegclust or vegclass, and in this case it is unnecessary to provide cluster.

cluster

A vector indicating the hard membership of each object in x to a set of groups.

defuzzify

A flag indicating whether fuzzy memberships should be defuzzified (see function defuzzify). Only applies to the case where an object of class vegclust or vegclass is supplied in x.

...

Additional parameters for function defuzzify.

Details

This function can be used in two ways:

Value

A double value (for one cluster) or a vector of values, one per each cluster.

Author(s)

Miquel De Cáceres, Forest Science Center of Catalonia

See Also

vegclust, kmeans,defuzzify

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## 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 with 3 clusters. Perform 10 starts from random seeds 
## and keep the best solution
wetland.nc = vegclust(wetland.chord, mobileCenters=3, m = 1.2, dnoise=0.75, 
                      method="NC", nstart=10)

## Gets cluster variance of fuzzy clusters
clustvar(wetland.nc)

## Gets cluster variance of fuzzy clusters after defuzzification
clustvar(wetland.nc, defuzzify=TRUE)

## Similar to the previous, this gets cluster variance of defuzzified (i.e. hard) clusters
clustvar(wetland.chord, cluster=defuzzify(wetland.nc)$cluster)

## Gets cluster variance of K-means (i.e. hard) clusters
clustvar(wetland.chord, cluster=kmeans(wetland.chord, centers=3, nstart=10)$cluster)

vegclust documentation built on May 30, 2017, 6:43 a.m.

Search within the vegclust package
Search all R packages, documentation and source code