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-p
data arrayX
, computes statistics on each sample using the functionjackfun
, and returns the results in the matrixjackstat
.jackknife
regards each row ofX
as one data sample, so there aren
data samples. Each of then
rows ofjackstat
contains the results of applyingjackfun
to one jackknife sample.jackfun
is a function handle specified with@
. Rowi
ofjackstat
contains the results for the sample consisting ofX
with thei
th row omitted:
s = x; s(i,:) = []; jackstat(i,:) = jackfun(s);
jackfun
returns a matrix or array, then this output is converted to a row vector for storage injackstat
. IfX
is 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.jackknife
creates 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 tojackfun
unchanged. 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
.jackknife
uses the following field in the structure:
'UseParallel' |
If |
Examples
Estimate the bias of the MLE variance estimator of random samples taken from the vectory
usingjackknife
. The bias has a known formula in this problem, so you can compare thejackknife
value 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