Page 265 - Computational Statistics Handbook with MATLAB
P. 265
Chapter 7: Data Partitioning 253
through all of the data points and find the columns of bootsam that do not
contain that point. We then find the corresponding bootstrap replicates.
% Find the jackknife-after-bootstrap.
n = length(gpa);
% Set up storage space.
jreps = zeros(1,n);
% Loop through all points,
% Find the columns in bootsam that
% do not have that point in it.
for i = 1:n
% Note that the columns of bootsam are
% the indices to the samples.
% Find all columns with the point.
[I,J] = find(bootsam==i);
% Find all columns without the point.
jacksam = setxor(J,1:B);
% Find the correlation coefficient for
% each of the bootstrap samples that
% do not have the point in them.
bootrep = bootstat(jacksam,2);
% In this case it is col 2 that we need.
% Calculate the feature (gamma_b) we want.
jreps(i) = std(bootrep);
end
% Estimate the error in gamma_b.
varjack = (n-1)/n*sum((jreps-mean(jreps)).^2);
% The original bootstrap estimate of error is:
gamma = std(bootstat(:,2));
We see that the estimate of the standard error of the correlation coefficient for
ˆ
ˆ
ˆ
this simulation is γ B = SE Boot ρ() = 0.14 , and our estimated standard error in
ˆ
this bootstrap estimate is SE Jack γ ˆ () = 0.088 .
B
Efron and Tibshirani [1993] point out that the jackknife-after-bootstrap
works well when the number of bootstrap replicates B is large. Otherwise, it
ˆ
overestimates the variance of γ B .
7.6 MATLAB Code
To our knowledge, MATLAB does not have M-files for either cross-validation
or the jackknife. As described earlier, we provide a function (csjack) that
© 2002 by Chapman & Hall/CRC