Skip to contents

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.

References

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

Author

Miquel De Cáceres, CREAF

Examples

## Loads data (38 columns and 33 species)
data(wetland)
dim(wetland)
#> [1] 41 33
  
## 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])
#>  [1] "8"  "17" "3"  "9"  "16" "2"  "1"  "10" "22" "20" "39" "11" "30" "28" "31"
#> [16] "26" "24" "36" "32" "35"

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