boot.iid {animation} | R Documentation |
Demonstrate bootstrapping for i.i.d data: use sunflower scatter plot to illustrate the situation of sampling, and histogram to show the distribution of the statistic of interest.
boot.iid(x = runif(20), statistic = mean, m = length(x), control = ani.control(), ...)
x |
a numerical vector (the original data). |
statistic |
A function which returns a value of the statistic of interest when applied to the data x. |
m |
the sample size for bootstrapping (m-out-of-n bootstrap) |
control |
control parameters for the animation; see ani.control |
... |
other arguments passed to ani.control |
This is actually a very naive version of bootstrapping but may be useful for novices. The blue points denote the orignial dataset, while the red points with (possible) leaves denote sample points being resampled; the number of leaves just means how many times these points are resampled, as bootstrap samples with replacement.
A list containing
t0 |
The observed value of 'statistic' applied to 'x'. |
tstar |
Bootstrap versions of the 'statistic'. |
Yihui Xie
There are many references explaining the bootstrap and its variations. For a relatively complete one, you may just refer to:
Efron, B. and Tibshirani, R. (1993) An Introduction to the Bootstrap. Chapman & Hall.
sunflowerplot
, ani.start
, ani.stop
# bootstrap for 20 random numbers following U(0, 1) boot.iid(interval = 0.5) # for the median of 15 points from chi-square(5) boot.iid(x = rchisq(15, 5), statistic = median, interval = 0.5) ## Not run: # save the animation in HTML pages ani.start() boot.iid(saveANI = TRUE, width = 600, height = 500, interval = 0.2) ani.stop() ## End(Not run)