samp.bootstrap

0th

Percentile

Generate indices for resampling

Generate indices for resampling.

Keywords
htest, nonparametric
Usage
samp.bootstrap(n, R, size = n - reduceSize, reduceSize = 0) samp.permute(n, R, size = n - reduceSize, reduceSize = 0, groupSizes = NULL, returnGroup = NULL)
Arguments
n
sample size. For two-sample permutation tests, this is the sum of the two sample sizes.
R
number of vectors of indices to produce.
size
size of samples to produce. For example, to do "what-if" analyses, to estimate the variability of a statistic had the data been a different size, you may specify the size.
reduceSize
integer; if specified, then size = n - reduceSize (for each sample or stratum). This is an alternate way to specify size. Typically bootstrap standard errors are too small; they correspond to using n in the divisor of the sample variance, rather than n-1. By specifying reduceSize = 1, you can correct for that bias. This is particularly convenient in two-sample problems where the sample sizes differ.
groupSizes
NULL, or vector of positive integers that add to n.
returnGroup
NULL, or integer from 1 to length(groupSizes). groupSizes and returnGroup must be supplied together; then full permutations are created, but only subsets of size groupSizes[returnGroup] is returned.
Details

To obtain disjoint samples without replacement, call this function multiple times, after setting the same random number seed, with the same groupSizes but different values of returnGroup. This is used for two-sample permutation tests.

If groupSizes is supplied then size is ignored.

Value

matrix with size rows and R columns (or groupSizes(returnGroup) rows). Each column contains indices for one bootstrap sample, or one permutation.

Note

The value passed as R to this function is typically the block.size argument to bootstrap and other resampling functions.

References

This discusses reduced sample size: Hesterberg, Tim C. (2004), Unbiasing the Bootstrap-Bootknife Sampling vs. Smoothing, Proceedings of the Section on Statistics and the Environment, American Statistical Association, 2924-2930, http://www.timhesterberg.net/articles/JSM04-bootknife.pdf.

See Also

resample-package.

Aliases
  • samp.bootstrap
  • samp.permute
Examples
samp.bootstrap(7, 8)
samp.bootstrap(7, 8, size = 6)
samp.bootstrap(7, 8, reduceSize = 1)

# Full permutations
set.seed(0)
samp.permute(7, 8)

# Disjoint samples without replacement = subsets of permutations
set.seed(0)
samp.permute(7, 8, groupSizes = c(2, 5), returnGroup = 1)
set.seed(0)
samp.permute(7, 8, groupSizes = c(2, 5), returnGroup = 2)
Documentation reproduced from package resample, version 0.4, License: BSD_3_clause + file LICENSE

Community examples

Looks like there are no examples yet.