Appendix B

Working with Data Frames and Arrays

B.1 Resampling and Data Partitioning

B.1.1 Using the boot function

Bootstrap is implemented in the boot function (boot package [34]), which provides functions and arguments for the book [63]. In ordinary bootstrap, the samples are selected with replacement. The basic syntax for ordinary bootstrap is

  boot(data, statistic, R)

where data is the observed sample and R is the number of bootstrap replicates. The default is sim = "ordinary", the ordinary bootstrap (sampling with replacement).

The second argument (statistic) is a function, or the name of a function, which calculates the statistic to be replicated. Suppose we call this function f. The boot function generates the random indices i = (i1, ... ...

Get Statistical Computing with R now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.