Bootstrap sampling

`bootstat = bootstrp(nboot,bootfun,d1,...)`

[bootstat,bootsam] = bootstrp(...)

bootstat = bootstrp(...,* 'Name'*,

`Value`

`bootstat = bootstrp(nboot,bootfun,d1,...)`

draws `nboot`

bootstrap data samples, computes statistics
on each sample using `bootfun`

, and returns the results
in the matrix `bootstat`

. `nboot`

must
be a positive integer. `bootfun`

is a function handle
specified with `@`

. Each row of `bootstat`

contains
the results of applying `bootfun`

to one bootstrap
sample. If `bootfun`

returns a matrix or array,
then this output is converted to a row vector for storage in `bootstat`

.

The third and later input arguments (`d1,...`

)
are data (scalars, column vectors, or matrices) used to create inputs
to `bootfun`

. `bootstrp`

creates
each bootstrap sample by sampling with replacement from the rows of
the non-scalar data arguments (these must have the same number of
rows). `bootfun`

accepts scalar data unchanged.

`[bootstat,bootsam] = bootstrp(...)`

returns
an `n`

-by-`nboot`

matrix of bootstrap
indices, `bootsam`

. Each column 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,...`

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,...`

, 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.) To get the output samples `bootsam`

without
applying a function, set `bootfun`

to empty (`[]`

).

`bootstat = bootstrp(...,`

uses
additional arguments specified by one or more * 'Name'*,

`Value`

`Name,Value`

pair
arguments. The name-value pairs must appear after the data arguments.
The available name-value pairs:`'Weights'`

— Observation weights. The`weights`

value must be a vector of nonnegative numbers with at least one positive element. The number of elements in`weights`

must be equal to the number of rows in non-scalar input arguments to`bootstrp`

. To obtain one bootstrap replicate,`bootstrp`

samples*N*out of*N*with replacement using these weights as multinomial sampling probabilities.`'Options'`

— The value is a structure that contains options specifying whether to compute bootstrap iterations in parallel, and specifying how to use random numbers during the bootstrap sampling. Create the options structure with`statset`

. Applicable`statset`

parameters are:`'UseParallel'`

— If`true`

Parallel Computing Toolbox™ is installed, compute bootstrap iterations in parallel. If the Parallel Computing Toolbox is not installed, computation occurs in serial mode. Default is`false`

, meaning serial computation.`UseSubstreams`

— Set to`true`

to compute in parallel in a reproducible fashion. Default is`false`

. To compute reproducibly, set`Streams`

to a type allowing substreams:`'mlfg6331_64'`

or`'mrg32k3a'`

.`Streams`

— A`RandStream`

object or cell array of such objects. If you do not specify`Streams`

,`bootstrp`

uses the default stream or streams. If you choose to specify`Streams`

, use a single object except in the case`UseParallel`

is`true`

`UseSubstreams`

is`false`

In that case, use a cell array the same size as the Parallel pool.

`RandStream`

| `bootci`

| `histogram`

| `ksdensity`

| `parfor`

| `random`

| `randsample`

| `statget`

| `statset`