Documentation Center

  • Trial Software
  • Product Updates

bootci

Bootstrap confidence interval

Syntax

ci = bootci(nboot,bootfun,...)
ci = bootci(nboot,{bootfun,...},'alpha',alpha)
ci = bootci(nboot,{bootfun,...},...,'type',type)
ci = bootci(nboot,{bootfun,...},...,'type','student','nbootstd',nbootstd)
ci = bootci(nboot,{bootfun,...},...,'type','student','stderr',stderr)
ci = bootci(nboot,{bootfun,...},...,'Weights',weights)
ci = bootci(nboot,{bootfun,...},...,'Options',options)
[ci,bootstat] = bootci(...)

Description

ci = bootci(nboot,bootfun,...) computes the 95% bootstrap confidence interval of the statistic computed by the function bootfun. nboot is a positive integer indicating the number of bootstrap samples used in the computation. bootfun is a function handle specified with @. The third and later input arguments to bootci are data (scalars, column vectors, or matrices) that are used to create inputs to bootfun. bootci 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). Scalar data are passed to bootfun unchanged.

If bootfun returns a scalar, ci is a vector containing the lower and upper bounds of the confidence interval. If bootfun returns a vector of length m, ci is an array of size 2-by-m, where ci(1,:) are lower bounds and ci(2,:) are upper bounds. If bootfun returns an array of size m-by-n-by-p-by-..., ci is an array of size 2-by-m-by-n-by-p-by-..., where ci(1,:,:,:,...) is an array of lower bounds and ci(2,:,:,:,...) is an array of upper bounds.

ci = bootci(nboot,{bootfun,...},'alpha',alpha) computes the 100*(1-alpha) bootstrap confidence interval of the statistic defined by the function bootfun. bootfun and the data that bootci passes to it are contained in a single cell array. alpha is a scalar between 0 and 1. The default value of alpha is 0.05.

ci = bootci(nboot,{bootfun,...},...,'type',type) computes the bootstrap confidence interval of the statistic defined by the function bootfun. type is the confidence interval type, chosen from among the following strings:

  • 'norm' or 'normal' — Normal approximated interval with bootstrapped bias and standard error.

  • 'per' or 'percentile' — Basic percentile method.

  • 'cper' or 'corrected percentile' — Bias corrected percentile method.

  • 'bca' — Bias corrected and accelerated percentile method. This is the default.

  • 'stud' or 'student' — Studentized confidence interval.

ci = bootci(nboot,{bootfun,...},...,'type','student','nbootstd',nbootstd) computes the studentized bootstrap confidence interval of the statistic defined by the function bootfun. The standard error of the bootstrap statistics is estimated using bootstrap, with nbootstd bootstrap data samples. nbootstd is a positive integer value. The default value of nbootstd is 100.

ci = bootci(nboot,{bootfun,...},...,'type','student','stderr',stderr) computes the studentized bootstrap confidence interval of statistics defined by the function bootfun. The standard error of the bootstrap statistics is evaluated by the function stderr. stderr is a function handle. stderr takes the same arguments as bootfun and returns the standard error of the statistic computed by bootfun.

ci = bootci(nboot,{bootfun,...},...,'Weights',weights) specifies observation weights. weights must be a vector of non-negative 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 bootfun. To obtain one bootstrap replicate, bootstrp samples N out of N with replacement using these weights as multinomial sampling probabilities.

ci = bootci(nboot,{bootfun,...},...,'Options',options) specifies options that govern the computation of bootstrap iterations. One option requests that bootci perform bootstrap iterations using multiple processors, if the Parallel Computing Toolbox™ is available. Two options specify the random number streams to be used in bootstrap resampling. This argument is a struct that you can create with a call to statset. You can retrieve values of the individual fields with a call to statget. Applicable statset parameters are:

  • 'UseParallel' — If true and if a parpool of the Parallel Computing Toolbox is open, compute bootstrap iterations in parallel. If the Parallel Computing Toolbox is not installed, or a parpool is not open, computation occurs in serial mode. Default is false, or 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, bootci uses the default stream or streams. If you choose to specify Streams, use a single object except in the case

    • You have an open Parallel pool

    • UseParallel is true

    • UseSubstreams is false

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

[ci,bootstat] = bootci(...) also returns the bootstrapped statistic computed for each of the nboot bootstrap replicate samples. 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.

Examples

Compute the confidence interval for the capability index in statistical process control:

y = normrnd(1,1,30,1);                 % Simulated process data
LSL = -3; USL = 3;                     % Process specifications
capable = @(x)(USL-LSL)./(6* std(x));  % Process capability
ci = bootci(2000,capable,y)            % BCa confidence interval
ci =
    0.8122
    1.2657

sci = bootci(2000,{capable,y},'type','student') % Studentized ci
sci =
    0.7739
    1.2707

See Also

| | | | |

Was this topic helpful?