bootstrp

 Balanced bootstrap resampling.


 -- Function File: BOOTSTAT = bootstrp (NBOOT, BOOTFUN, D)
 -- Function File: BOOTSTAT = bootstrp (NBOOT, BOOTFUN, D1, ..., DN)
 -- Function File: BOOTSTAT = bootstrp (..., 'seed', SEED)
 -- Function File: BOOTSTAT = bootstrp (..., 'Options', PAROPT)
 -- Function File: [BOOTSTAT, BOOTSAM] = bootstrp (...) 

     BOOTSTAT = bootstrp (NBOOT, BOOTFUN, D) draws NBOOT bootstrap resamples
     from the data D and returns the statistic computed by BOOTFUN in BOOTSTAT
     [1]. bootstrp resamples from the rows of a data sample D (column vector
     or a matrix). BOOTFUN is a function handle (e.g. specified with @), or a
     string indicating the function name. The third input argument is data
     (column vector or a matrix), that is used to create inputs for BOOTFUN.
     The resampling method used throughout is balanced bootstrap resampling
     [2-3].

     BOOTSTAT = bootstrp (NBOOT, BOOTFUN, D1,...,DN) is as above except that 
     the third and subsequent numeric input arguments are data vectors that
     are used to create inputs for BOOTFUN.

     BOOTSTAT = bootstrp (..., 'seed', SEED) initialises the Mersenne Twister
     random number generator using an integer SEED value so that bootci results
     are reproducible.

     BOOTSTAT = bootstrp (..., 'Options', PAROPT) specifies options that govern
     if and how to perform bootstrap iterations using multiple processors (if
     the Parallel Computing Toolbox or Octave Parallel package is available).
     This argument is a structure with the following recognised fields:
        o 'UseParallel':  If true, use parallel processes to accelerate
                          bootstrap computations on multicore machines. 
                          Default is false for serial computation. In MATLAB,
                          the default is true if a parallel pool
                          has already been started. 
        o 'nproc':        nproc sets the number of parallel processes

     [BOOTSTAT, BOOTSAM] = bootstrp (...) also returns BOOTSAM, a matrix of
     indices from the bootstrap. Each column in BOOTSAM corresponds to one
     bootstrap sample and contains the row indices of the values drawn from
     the nonscalar data argument to create that sample.

  Bibliography:
  [1] Efron, and Tibshirani (1993) An Introduction to the
        Bootstrap. New York, NY: Chapman & Hall
  [2] Davison et al. (1986) Efficient Bootstrap Simulation.
        Biometrika, 73: 555-66
  [3] Booth, Hall and Wood (1993) Balanced Importance Resampling
        for the Bootstrap. The Annals of Statistics. 21(1):286-298

  bootstrp (version 2023.06.20)
  Author: Andrew Charles Penn
  https://www.researchgate.net/profile/Andrew_Penn/

  Copyright 2019 Andrew Charles Penn
  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see http://www.gnu.org/licenses/

Demonstration 1

The following code


 % Input univariate dataset
 data = [48 36 20 29 42 42 20 42 22 41 45 14 6 ...
         0 33 28 34 4 32 24 47 41 24 26 30 41]';

 % Compute 50 bootstrap statistics for the mean and calculate the bootstrap
 % standard arror
 bootstat = bootstrp (50, @mean, data)
 std (bootstat)

Produces the following output

bootstat =

       30.385
       26.577
       32.962
       26.885
       28.962
       27.385
       29.538
       28.615
       36.269
       29.192
       36.192
       35.346
       30.923
       31.423
       30.231
       25.692
       28.577
       27.038
       26.269
       31.423
       30.154
       29.654
       28.577
       32.154
       28.385
       32.615
       24.846
       32.269
       25.577
       29.615
       26.923
       27.038
       26.731
       33.923
       31.962
       26.538
       26.846
       29.769
           27
       26.731
       29.231
       30.885
       31.077
           30
       29.115
       31.769
       32.423
       30.692
       29.231
       31.077

ans = 2.7164

Package: statistics-resampling