Statistics Toolbox    
bootstrp

Bootstrap statistics through resampling of data

Syntax

Description

bootstat = bootstrp(nboot,'bootfun',d1,d2,...) draws nboot bootstrap samples from each of the input data sets, d1, d2, etc., and passes the bootstrap samples to function bootfun for analysis. nboot must be a positive integer, and each input data set must contain the same number of rows, n. Each bootstrap sample contains n rows chosen randomly (with replacement) from the corresponding input data set (d1, d2, etc.).

Each row of the output, bootstat, contains the results of applying bootfun to one set of bootstrap samples. If bootfun returns multiple outputs, only the first is stored in bootstat. If the first output from bootfun is a matrix, the matrix is reshaped to a row vector for storage in bootstat.

[bootstat,bootsam] = bootstrap(...) returns a matrix of bootstrap indices, bootsam. Each of the nboot columns in bootsam contains indices of the values that were drawn from the original data sets to constitute the corresponding bootstrap sample. For example, if d1, d2, etc., each contain 16 values, and nboot = 4, then bootsam is a 16-by-4 matrix. The first column contains the indices of the 16 values drawn from d1, d2, etc., for the first of the four bootstrap samples, the second column contains the indices for the second of the four bootstrap samples, and so on. (The bootstrap indices are the same for all input data sets.)

Example

Correlate the LSAT scores and law-school GPA for 15 students. These 15 data points are resampled to create 1000 different data sets, and the correlation between the two variables is computed for each dataset.

The histogram shows the variation of the correlation coefficient across all the bootstrap samples. The sample minimum is positive, indicating that the relationship between LSAT score and GPA is not accidental.


  binostat boxplot