Documentation

jackknife

Jackknife sampling

Syntax

jackstat = jackknife(jackfun,X)
jackstat = jackknife(jackfun,X,Y,...)
jackstat = jackknife(jackfun,...,'Options',option)

Description

jackstat = jackknife(jackfun,X)draws jackknife data samples from then-by-pdata arrayX, computes statistics on each sample using the functionjackfun, and returns the results in the matrixjackstat.jackkniferegards each row ofXas one data sample, so there arendata samples. Each of thenrows ofjackstatcontains the results of applyingjackfunto one jackknife sample.jackfunis a function handle specified with@. Rowiofjackstatcontains the results for the sample consisting ofXwith theith row omitted:

s = x; s(i,:) = []; jackstat(i,:) = jackfun(s);
Ifjackfunreturns a matrix or array, then this output is converted to a row vector for storage injackstat. IfXis a row vector, it is converted to a column vector.

jackstat = jackknife(jackfun,X,Y,...)accepts additional arguments to be supplied as inputs tojackfun. They may be scalars, column vectors, or matrices.jackknifecreates each jackknife 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 tojackfununchanged. Non-scalar arguments must have the same number of rows, and each jackknife sample omits the same row from these arguments.

jackstat = jackknife(jackfun,...,'Options',option)provides an option to perform jackknife iterations in parallel, if the Parallel Computing Toolbox™ is available. Set'Options'as a structure you create withstatset.jackknifeuses the following field in the structure:

'UseParallel'

Iftrueand if aparpoolof the Parallel Computing Toolbox is open, use multiple processors to compute jackknife iterations. If the Parallel Computing Toolbox is not installed, or aparpoolis not open, computation occurs in serial mode. Default isfalse, or serial computation.

Examples

Estimate the bias of the MLE variance estimator of random samples taken from the vectoryusingjackknife. The bias has a known formula in this problem, so you can compare thejackknifevalue to this formula.

sigma = 5; y = normrnd(0,sigma,100,1); m = jackknife(@var, y, 1); n = length(y); bias = -sigma^2 / n % known bias formula jbias = (n - 1)*(mean(m)-var(y,1)) % jackknife bias estimate bias = -0.2500 jbias = -0.3378

Introduced in R2006a

Was this topic helpful?