boots {boodd}R Documentation

Bootstrap for the I.I.D. Case

Description

Generic function to bootstrap in the iid case.

Usage

boots(x, func, B, smooth = FALSE, moonsize = NULL, mreplace = TRUE, ...)

Arguments

x

A vector or a matrix representing the data.

func

The function to apply to each sample.

B

A positive integer; the number of bootstrap replications.

smooth

Logical. If TRUE use a smooth bootstrap.

moonsize

A value of m in the 'm out of n' bootstrap.

mreplace

Logical. If TRUE, bootstrap is done with replacement. If FALSE the function performs subsampling. In that case, moonsize should be specified, else the function stops.

...

An optional additional arguments for the func function.

Details

The function boots performs different versions of the bootstrap in the iid case (see Davison and Hinkley (1997)). With default parameters it performs a naive bootstrap (see Efron and Tibshirani (1993)). If moonsize is specified, the function performs the moon bootstrap (see Bickel et al.(1997)) With smooth=TRUE the function performs a smooth bootstrap, based on a kernel density estimator of the data, with a bandwidth chosen by cross-validation (see Efron and Tibshirani (1993) and Falk and Reiss (1989)). Finally, when mreplace=FALSE, the function performs the subsampling method of the Politis and Romano (1994) with subsampling size equals to moonsize.

The func must be a function whose first argument is a vector and which returns either a single value or a vector.

The x argument can be a vector or a matrix. In the case of a matrix, the rows of the matrix are bootstrapped.

The moonsize and mreplace arguments concern m out of n bootstrap (aka moon bootstrap). The moonsize argument is an integer less than the length of x (or the number of rows if x is a matrix). The mreplace argument is a logical that indicates whether the bootstrap samples are drawn with or without replacement.

Value

An object of class boodd containing either a vector or a matrix, depending on whether the func function returns a single value or a vector. If the func function returns a vector of size n, then boots returns a matrix of size B x n.

References

Bertail, P. and Dudek, A. (2025). Bootstrap for Dependent Data, with an R package (by Bernard Desgraupes and Karolina Marek) - submitted.

B. Efron, and Tibshirani, R. (1993). An Introduction to the Bootstrap, Chapman and Hall/CRC Monographs on Statistics and Applied Probability.

Bickel, P. J., Götze, F. and van Zwet, W. R. (1997). Resampling fewer than n observations: gains, losses, and remedies for losses. Statistica Sinica, 7, 1-31

A. C. Davison, D. Hinkley (1997). Bootstrap Methods and Their Application, Cambridge Series in Statistical and Probabilistic Mathematics.

Falk, M., & Reiss, R. D. (1989). Bootstrapping the distance between smooth bootstrap and sample quantile distribution. Probability Theory and Related Fields, 82, 177–186.

Politis, D. N., & Romano, J. P. (1994). Large Sample Confidence Regions Based on Subsamples under Minimal Assumptions. The Annals of Statistics, 22. 2031-2050

See Also

plot.boodd, confint.boodd.

Examples

B <- 999
n <- 200
x <- rnorm(n)
# Naive bootstrap of the mean
boo1 <- boots(x,mean,B)
summary(boo1)
plot(boo1)
confint(boo1)
confint(boo1,method="bperc")

# Naive bootstrap of a multidimentional statistic
mv <- function(data) {c(mean(data),var(data))} # compute mean and variance
boo2 <- boots(x,mv,B)
# Confint can compute percentile and t-percentile confidence intervals 
# when variance is bootstrapped
confint(boo2,method="all")

# Naive Bootstrap of the output parameters of lm (linear regression) function
sigma <- 0.2
y <- x+rnorm(n)
data <- as.matrix(data.frame(x,y))
nlm <- function(dat){lm(dat[,2]~dat[,1])$coefficient}
boo3 <- boots(data,nlm,B)

# Smoothed bootstrap for quantiles 
boo4 <- boots(x,median,B) # without smoothing
plot(boo4)
boo5 <- boots(x,median,B,smooth=TRUE) 
# with smoothing using a cross-validation estimator of the window
plot(boo5)

# Moon bootstrap 
n <- 10000
x <- rnorm(n)
# i.i.d bootstrap is not consistent for the max
boo6 <- boots(x,max,B) 
# Moon bootstrap of the max with a size equals to sqrt(n)
boo7 <- boots(x,max,B,moonsize=sqrt(n)) 
# Subsampling with the moonsize equals to sqrt(n)
boo8 <- boots(x,max,B,moonsize=sqrt(n),mreplace=TRUE) 

[Package boodd version 0.1 Index]