Returns BOTH estimates of ESL Sec. 7.11, because the first is misleading alone.
Value
list: err_boot, err_loo_boot, err_train, inclusion_probability, optimistic, n_dropped, per_observation, B, n, method.
Details
Eq. (7.54), Err_boot = (1/B)(1/N) sum_b sum_i L(y_i, f*b(x_i)),
is biased downward: the bootstrap datasets act as training samples
while the original training set acts as the test sample, and the
two overlap. For a 1-nearest-neighbour rule on labels independent
of the inputs the true error is 0.5, but a contribution is
non-zero only when observation i is absent from sample b,
which by (7.55) has probability 0.368 – so (7.54) expects 0.184.
Eq. (7.56), the leave-one-out bootstrap, averages only over the
replicates C^{-i} that exclude observation i. That removes the
overlap but introduces a training-set-size bias in the other
direction, which morie_esl_oob_632() corrects.
Observations present in every replicate have an empty C^{-i} and
are dropped, as the book allows; n_dropped reports how many,
since a large count means B is too small.
References
Hastie, Tibshirani and Friedman (2009), Sec. 7.11, Eqs. (7.54)-(7.56); Efron and Tibshirani (1997).
Examples
set.seed(1)
if (morie_crypto_liboqs_available()) {
X <- matrix(stats::rnorm(150), 50)
morie_esl_bootstrap_err(X, stats::rnorm(50), B = 20)$err_loo_boot
}
