hcr: Heterogeneity-constrained random resampling (HCR)

View source: R/hcr.R

hcrR Documentation

Heterogeneity-constrained random resampling (HCR)

Description

Returns a set of indices of the original data set that maximizes the mean and minimizes the variance of the distances between pairs of plot records.

Usage

hcr(d, nout, nsampl=1000)

Arguments

d

An object of class dist containing the distance values between pairs of sites (plot records).

nout

The number of sites (plot records) to be chosen among those available in d.

nsampl

The number of resampling trials to be compared.

Details

Many subsets of the input data are selected randomly. These subsets are sorted by decreasing mean dissimilarity between pairs of plot records, and then sorted again by increasing variance of these dissimilarities. Ranks from both sortings are summed for each subset, and the subset with the lowest summed rank is considered as the most representative.

Value

Returns a vector containing the indices of the selected sites (plot records) to be used for sub-setting the original table.

Author(s)

Miquel De Cáceres, CREAF

References

Lengyel, A., Chytry, M., Tichy, L. (2011) Heterogeneity-constrained random resampling of phytosociological databases. Journal of Vegetation Science 22: 175-183.

Examples

## Loads data (38 columns and 33 species)
data(wetland)
dim(wetland)
  
## Constructs the chord distance matrix
## (see also  \code{\link{decostand}} in package vegan)
wetland.chord =dist(as.data.frame(sweep(as.matrix(wetland), 1, 
                    sqrt(rowSums(as.matrix(wetland)^2)), "/")))

## Performs HCR resampling. Returns indices of objects
sel = hcr(wetland.chord, nout=20, nsampl=1000)

## Prints the names of the plot records
print(row.names(wetland)[sel])

## Subset the original distance matrix
sel.chord = as.dist(as.matrix(wetland.chord)[sel,sel])

emf-creaf/vegclust documentation built on July 27, 2024, 7:32 a.m.