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 =

       31.077
       26.615
       29.731
       29.231
       27.885
       28.962
       29.231
       28.654
       35.615
       27.654
       26.462
       30.885
       31.731
       29.615
       28.308
       29.538
       29.923
       30.115
       32.538
       28.962
       31.385
       25.231
       30.154
       26.115
       25.231
       25.962
       33.654
       33.269
       31.154
       34.385
       30.962
       30.808
       29.192
       29.038
       25.769
       30.192
       30.231
       28.192
       28.808
       31.269
       27.692
       28.231
       32.346
       31.385
         28.5
       31.038
       28.192
       33.308
       30.231
       28.038

ans = 2.3366

Package: statistics-resampling