wild.boot: Generate one or multiple bootstrap samples of regression...

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/fANOVA_all.R

Description

Generate bootstrap samples using the wild bootstrap method introduced by Wu (1986). One of the advantages for the wild bootstrap method is that it allows for a heterogeneous variance in the residuals in regression analysis.

Usage

1
wild.boot(x, nboot = 1)

Arguments

x

a vector of regression residuals.

nboot

the number of bootstrap replicates. Usually this will be a single positive integer.

Details

This function is to generate bootstrap residuals using the wild bootstrap method.

Value

a vector or a matrix.

Author(s)

X.F. Wang wangx6@ccf.org

References

Wu, C. (1986) Jackknife, bootstrap and other resampling methods in regression analysis (with discussion). Annals of Statistics. 14, 1261–1350.

Mammen, E. (1991). Bootstrap, wild bootstrap, and asymptotic normality. Probability Theory and Related Fields. 93, 439–455.

See Also

T.L2, T.aov, T.var.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
n <- 1000
x <- runif(n, min=0, max=1)
## generate heteroscedastic error variances
sig.x <- sqrt(exp(x)/2.5-0.4)
err <- sapply(sig.x, function(x) rnorm(1, sd=x))
x2 <- x^2
y <- 10+3*x+2*x2 +err
plot(x,y)
fit <- lm(y ~ x + x2)
## obtain 12 samples of the wild bootstrap residuals 
res.boot <- wild.boot(fit$res, nboot=12)
## obtain 12 samples of the wild bootstrap responses
y.boot <- matrix(rep(fit$fit,time=12), ncol=12) + res.boot
## plot the 12 wild bootstrap samples
## The wild bootstrap method keeps the patterns of variance heterogeneity 
## in the orginal sample.
par(mfrow=c(4,3))
for (i in 1:12) plot(x, y.boot[,i])

fANCOVA documentation built on Nov. 13, 2020, 5:07 p.m.

Related to wild.boot in fANCOVA...