File Exchange

## ibootci

version 2.8.7.2 (61.2 KB) by Andrew Penn

### Andrew Penn (view profile)

Two-sided bootstrap confidence intervals for small samples and samples with complex dependence structures

Updated 04 Aug 2020

Function File: ibootci

Bootstrap confidence intervals

ci = ibootci(nboot,bootfun,...) computes the 95% iterated (double) bootstrap confidence interval of the statistic computed by bootfun. nboot is a scalar, or vector of upto two positive integers indicating the number of replicate samples for the first and second bootstraps. bootfun is a function handle specified with @, or a string indicating the function name. The third and later input arguments are data (column vectors), that are used to create inputs to bootfun. ibootci creates each first level bootstrap by sampling from the rows of the column vector data arguments (which must be the same size). Nominal central coverage of two-sided intervals is calibrated to achieve second order accurate coverage by bootstrap iteration and interpolation. Linear interpolation of the empirical cumulative distribution function of bootstat is then used to construct two-sided confidence intervals. The resampling method used throughout is balanced resampling. Default values for the number of first and second bootstrap replicate sample sets in nboot are 5000 and 200 respectively.

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

ci = ibootci(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:
'per' or 'percentile' - Percentile method.
'cper' - Bias-corrected percentile method.
'bca' - Bias-corrected and accelerated method (default).
'stud' or 'student' - Studentized (bootstrap-t) confidence interval.

ci = ibootci(nboot,{bootfun,...},...,'Weights',weights) specifies observation weights. weights must be a vector of non-negative numbers. The dimensions of weights must be equal to that of the non-scalar input arguments to bootfun. The weights are used as bootstrap sampling probabilities.

ci = ibootci(nboot,{bootfun,...},...,'Strata',strata) specifies a vector containing numeric identifiers of strata. The dimensions of strata must be equal to that of the non-scalar input arguments to bootfun. Bootstrap resampling is stratified so that every stratum is represented in each bootstrap test statistic.

ci = ibootci(nboot,{bootfun,...},...,'Clusters',clusters) specifies a vector containing numeric identifiers for clusters. Whereas strata are fixed, clusters are resampled. This is achieved by two-stage bootstrap resampling of residuals with shrinkage correction.

ci = ibootci(nboot,{bootfun,...},...,'Block',blocksize) specifies a positive integer (or 'auto') defining the block length for block bootstrapping dependent-data (e.g. time series). The algorithm uses circular, overlapping blocks. The double bootstrap resampling and calibration procedure makes interval coverage less sensitive block length. Block bootstrap can also be used in regression contexts by combining it with pairs bootstrap (i.e. by providing x and y vectors as data variables).

ci = ibootci(nboot,{bootfun,...},...,'smooth',bandwidth) applies additive random noise of the specified bandwidth to the bootstrap sample sets before evaluating bootfun.

ci = ibootci(nboot,{bootfun,...},...,'DEFF',state) estimates the design effect by resampling. State can be 'on' or 'off'.

[ci,bootstat] = ibootci(...) also returns the bootstrapped statistic computed for each of the bootstrap replicate samples sets. If only a single bootstrap is requested, bootstat will return a vector: each column of bootstat contains the result of applying bootfun to one replicate sample from the first bootstrap. If bootstrap iteration is requested, bootstat will return a cell array containing the statistics computed by bootfun in the first and second bootstrap. For the second boostrap, each column of bootstat contains the results of applying bootfun to each replicate sample from the second bootstrap for one replicate sample from the first bootstrap.

[ci,bootstat,S] = ibootci(...) also returns a structure containing the settings used in the bootstrap and the resulting statistics including the (double) bootstrap bias and standard error. Field descriptions are provided in the function help.

[ci,bootstat,S,calcurve] = ibootci(...) also returns calcurve, a vector of calibration values the same size as the first bootstrap replicate set.

[ci,bootstat,S,calcurve,bootidx] = ibootci(...) also returns bootidx, a matrix of indices from the first bootstrap.

Computations of confidence intervals can be accelerated by parallel processing.

ibootci has very similar usage to the function bootci. Please see function help for examples of function usage.

### Cite As

Andrew Penn (2020). ibootci (https://github.com/acp29/iboot), GitHub. Retrieved .

Emmanuel Roulin

HIgh Tech Man

Chang hsiung

jwswylie

Andrew Penn

### Andrew Penn (view profile)

Hi Robert. The usage is very similar to bootci in the Matlab Statistics Toolbox. I have now added some example uses in the function help.

Robert

### Robert (view profile)

Looks great - could you please provide a simple example to illustrate correct use?