resample {resample} | R Documentation |
Nonparametric resampling
Description
This function is called by bootstrap
and other
resampling functions to actually perform resampling, but may also be
called directly.
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 |
sampler |
a function like |
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
|
block.size |
integer. The |
trace |
logical, if |
... |
addition arguments passed to |
observedIndices |
integer vector of indices, used for calculating the observed value.
When this is called by |
call |
typically the call to |
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 "resample"
; this is
a list with components:
observed |
the observed statistic, length |
replicates |
a matrix with |
n |
number of observations |
p |
the length of the statistic returned by |
R |
number of resamples. |
seed |
the value of |
Author(s)
Tim Hesterberg timhesterberg@gmail.com,
https://www.timhesterberg.net/bootstrap-and-resampling
See Also
bootstrap
,
bootstrap2
,
permutationTest
,
permutationTest2
,
samp.bootstrap
,
samp.permute
.
For an overview of all functions in the package, see
resample-package
.
Examples
# See full set of examples in resample-package, 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