resample
Nonparametric resampling
This function is called by bootstrap
and other
resampling functions to actually perform resampling, but may also be
called directly.
 Keywords
 htest, nonparametric
Usage
resample(data, resampleFun, sampler, R = 10000, seed = NULL, statisticNames = NULL, block.size = 100, trace = FALSE, ..., observedIndices = 1:n, call = match.call())
Arguments
 data
 vector, matrix, or data frame.
 resampleFun

a function with argument
data
andii
, that calculates a statistic of interest fordata[ii]
ordata[ii, , drop=FALSE]
, for a vector or matrix, respectively.  sampler

a function like
samp.bootstrap
orsamp.permute
.  R
 number of resamples.
 seed
 old value of .Random.seed, or argument to set.seed.
 statisticNames

a character vector the same length as the vector returned by
statistic
.  block.size

integer. The
R
replicates are done this many at a time.  trace

logical, if
TRUE
an indication of progress is printed.  ...

addition arguments passed to
sampler
.  observedIndices

integer vector of indices, used for calculating the observed value.
When this is called by
bootstrap2
orpermutationTest2
, those should be indices corresponding to one sample in a merged data set.  call

typically the call to
bootstrap
or another function that calls resample. This may be a character string, e.g. when called frombootstrap2
.
Details
This is called by
bootstrap
,
bootstrap2
,
permutationTest
, and
permutationTest2
to actually perform resampling.
The results are passed back to the calling function, which may
add additional components and a class, which inherits from
"resample"
.
This may also be called directly. In contrast to the other functions,
where you have flexibility in how you specify the statistic, here
resampleFun
must be a function.
Value

an object of class
 observed
 the observed statistic, length
p
.  replicates
 a matrix with
R
rows andp
columns.  n
 number of observations
 p
 the length of the statistic returned by
resampleFun
.  R
 number of resamples.
 seed
 the value of
seed
when this function is called.
"resample"
; this is
a list with components:
See Also
bootstrap
,
bootstrap2
,
permutationTest
,
permutationTest2
,
samp.bootstrap
,
samp.permute
.
For an overview of all functions in the package, see
resamplepackage
.
Examples
## Not run:
# # See full set of examples in resamplepackage, including different
# # ways to call all the functions depending on the structure of the data.
# data(Verizon)
# CLEC < with(Verizon, Time[Group == "CLEC"])
# bootC < bootstrap(CLEC, mean, seed = 0)
# bootC
# ## End(Not run)