Description Usage Arguments Details Value Author(s) References See Also Examples
The methods take a sample of the specified size from the elements of x using either with or without replacement. Permutations and random subsamples of the input object can be performed with method sample. Heterogeneity-constrained random samples are obtained with method hcr.
1 2 3 4 5 6 7 8 |
x |
|
size |
non-negative integer giving the number of items to choose. For |
replace |
should sampling be with replacement? |
prob |
vector of probability weights for obtaining the elements of the vector being sampled. |
nperm |
the number of permutations. |
fast |
accelerate computations using package |
... |
additional arguments |
See sample for details. If replace = TRUE and size is missing, all duplicated plots are removed from the sample. Method hcr returns the most representative subsample of specified size by selecting from nperm independent subsets the one that has lowest mean dissimilarity and highest variance.
An object of the same class as the input object.
Roland Kaiser, method hcr is an re-implementation of function hcr in package vegclust by Miquel De Cáceres that is capable of forking parallel processes.
Lengyel, A., Chytry, M., Tichy, L. (2011). Heterogeneity-constrained random resampling of phytosociological databases. Journal of Vegetation Science 22: 175-183.
hcr in vegclust, Vegsoup, seriation
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | library(vegsoup)
data(windsfeld)
x <- windsfeld
rownames(sample(x)) # order is permuted
rownames(sample(x, size = 3)) # 3 random plots
# heterogeneity-constrained random samples
# Vegsoup method
hcr(x, size = 20)
# VegsoupPartition method
# we use base::sample to obtain 2 random partitions
p <- VegsoupPartition(x, clustering = sample(2, nrow(x), replace = TRUE))
pp <- hcr(p, size = min(table(partitioning(p))))
summary(lm(richness(pp, "sa") ~ partitioning(pp)))
# compare run times
## Not run:
system.time(hcr(windsfeld, size = 20, nperm = 100000, fast = FALSE))
system.time(hcr(windsfeld, size = 20, nperm = 100000, fast = TRUE))
system.time(vegclust::hcr(as.dist(windsfeld), nout = 20, nsampl = 100000))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.