booter {distillery} | R Documentation |
Bootstrap Resampling
Description
Generate B bootstrap replicates of size rsize and apply a statistic to them. Can do IID or Circular Block Bootstrap (CBB) methods.
Usage
booter(x, statistic, B, rsize, block.length = 1, v.terms, shuffle = NULL,
replace = TRUE, ...)
Arguments
x |
Original data series. May be a vector, matrix or data frame object. |
statistic |
Function that minimally takes arguments: |
B |
number of bootstrap resamples to make. |
rsize |
Number giving the resample size for each bootstrap sample. Must be between 1 and the length of |
block.length |
Number giving the desired block lengths. Default ( |
replace |
logical, should the resamples be taken with replacement? |
v.terms |
If |
shuffle |
|
... |
Optional arguments passed to |
Details
Similar functionality to boot
from package boot, but allows for easier implementation of certain other approaches. For example, m-out-of-n bootstrap resampling (appropriate for heavy-tail distributed data) can be performed via the rsize
argument. The ci
function is used to obtain subsequent confidence limits. For parameteric bootstrap resampling, see pbooter
.
For more complicated bootstrap resampling, e.g., Bayesian bootstrap sampling, the shuffle
argument may prove useful. That is, no weighting is allowed with this function through the standard mechanism, but the same result may be obtained by supplying your own indices through the shuffle
argument. For parametric bootstrap resampling, see the pbooter
function, but for certain types of parametric resampling, the shuffle
argument could prove useful.
If the block length is > 1, then rsize
overlapping blocks of this length are sampled from the data. In order to minimize over or under sampling of the end points, the blocks are circular (cf. Lahiri 2003).
Many good books and other materials are available about bootstrap resampling. One good text on IID bootstrap resampling is Efron and Tibshirani (1998) and for the block bootstrap, Lahiri (2003).
Value
A list object of class “booted” is returned with components:
call |
the function call |
data |
original data series |
statistic |
statistic argument passed in |
statistic.args |
all other arguments passed by ... |
B |
Number of bootstrap replicate samples |
block.length |
The block length used |
replace |
logical stating whether the samples are taken with replacement or not. |
v.terms |
if variance terms are returned by statistic, the argument is repeated in the returned object. |
rsize |
the size of the bootstrap resamples. |
indices |
rsize by B matrix giving the resample indices used (rows) for each bootstrap resample (columns). |
v |
B length vector or B column matrix (if statistic returns a vector) giving the estimated parameter variances for each bootstrap replicate. |
orig.v |
vector giving the parameter variances (i.e. se^2) of statistic when applied to the original data. |
original.est |
vector giving the estimated parameter values when statistic is applied to the original data. |
results |
B length vector or B column matrix giving the parameter estimates for each bootstrap resample. |
type |
character stating whether the resample method is iid or cbb. |
Author(s)
Eric Gilleland
References
Efron, B. and Tibshirani, R. J. (1998) An Introduction to the Bootstrap. Chapman \& Hall, Boca Raton, Florida, 436 pp.
Lahiri, S. N. (2003) Resampling Methods for Dependent Data. Springer-Verlag, New York, New York, 374 pp.
See Also
Examples
z <- rnorm( 100 )
zfun <- function( data, ... ) {
return( c( mean( data ), var( data ), mean( data^2 ), var( data^2 ) ) )
} # end of 'zfun' function.
res <- booter( x = z, statistic = zfun, B = 500, v.terms = c(2, 4) )
print( res )
## Not run: ci( res )