We report two Monte Carlo experiments, designed and reported
according to the ADEMP framework (Morris et al. 2019), using the
RDataScienceCompendium R package. Study 1
compares five nominal 95% confidence intervals for the mean of
log-normal data. The Student \(t\)
interval had the best coverage for mild to moderate skew at every sample
size studied. With strong skew (\(\sigma =
1\)), all intervals under-covered: at \(n = 10\) coverage ranged from 77.2% (basic
bootstrap) to 84.3%. The BCa interval was the best or joint-best
bootstrap method in every scenario with strong skew. Study
2 shows that reporting the cross-validated error of the
best-performing candidate model is optimistically biased. The bias was
largest with small samples and many candidates: at \(n = 50\) with 25 noise candidates, the true
RMSE was understated by 0.107 on average. Nested cross-validation
removed the selection bias, but only when the RMSE was computed from the
pooled out-of-fold predictions. Averaging per-fold RMSEs, which is
common practice, left a residual optimism of up to 0.017 caused by
Jensen’s inequality. All results carry Monte Carlo standard errors
(MCSEs) and can be regenerated with a single command.
Resampling methods are often recommended because they relax distributional assumptions. Whether they deliver on this promise at the sample sizes seen in practice is an empirical question, and simulation studies are the standard tool for answering it. Simulation studies are experiments, however, and their conclusions are only as reliable as their design and their quantification of Monte Carlo error (Morris et al. 2019).
We study two questions that come up routinely in applied work:
All computations use the RDataScienceCompendium package
(version 0.2.0). Each (scenario, replicate) pair has its own
L’Ecuyer-CMRG random-number stream (L’Ecuyer et al. 2002), so results do
not depend on how many parallel workers are used. The seeds and run
times are listed in the provenance files in
analysis/results/.
| ADEMP | Specification |
|---|---|
| Aims | Compare coverage and width of five nominal 95% intervals for a mean. |
| Data-generating mechanisms | \(X_i \sim \mathrm{LogNormal}(0, \sigma^2)\), \(n \in \{10, 20, 40, 80\}\), \(\sigma \in \{0.25, 0.5, 1\}\) (skewness 0.78, 1.75, 6.18); full factorial, 12 scenarios. |
| Estimand | \(\theta = E[X] = \exp(\sigma^2/2)\). |
| Methods | Student \(t\); nonparametric bootstrap percentile, basic, normal and BCa intervals with \(R = 1999\) resamples. |
| Performance measures | Coverage (primary), bias-eliminated coverage, mean width. |
| Replicates | 5000 per scenario, so that coverage MCSE \(\le 0.31\) percentage points near 95%. The largest observed coverage MCSE was 0.59 points. |
| ADEMP | Specification |
|---|---|
| Aims | Quantify the bias of two estimators of the prediction error of a “select by CV, then refit” procedure. |
| Data-generating mechanisms | \(p\) independent \(N(0,1)\) candidate predictors; \(y = \beta x_1 + \varepsilon\), \(\varepsilon \sim N(0,1)\); \(n \in \{50, 200\}\), \(p \in \{5, 25\}\), \(\beta \in \{0, 0.5\}\); 8 scenarios. |
| Estimand | RMSE of the final (selected and refitted) model on new data, evaluated on an independent test set of 10,000 observations. |
| Methods | Naive: the minimum over candidates of the 5-fold CV RMSE. Nested: 5 \(\times\) 5 nested CV. Each is computed in two ways: by averaging the per-fold RMSEs (fold), and from the pooled out-of-fold predictions (pooled). Candidates are the \(p\) single-predictor linear models. |
| Performance measures | Bias (primary), empirical SE and MSE of each estimator. |
| Replicates | 1000 per scenario. |
Nested CV estimates the error of the procedure when it is trained on 80% of the data. It is therefore expected to be slightly pessimistic about a model trained on all \(n\) observations. We added the pooled variants after a pilot run showed nested CV to be unexpectedly optimistic. Our hypothesis was that averaging square roots of per-fold mean squared errors is biased downwards when test folds are small, since \(E[\sqrt{\widehat{\mathrm{MSE}}}] \le \sqrt{E[\widehat{\mathrm{MSE}}]}\). The pooled variants test this hypothesis directly.
No replicate failed in either study (0 and 0 failures).
| sigma | n | t | bca | percentile | normal | basic |
|---|---|---|---|---|---|---|
| 0.25 | 10 | 94.1 (0.3) | 88.9 (0.4) | 89.1 (0.4) | 89.3 (0.4) | 88.8 (0.4) |
| 0.25 | 20 | 94.5 (0.3) | 92.3 (0.4) | 92.0 (0.4) | 92.3 (0.4) | 92.1 (0.4) |
| 0.25 | 40 | 94.4 (0.3) | 93.0 (0.4) | 93.0 (0.4) | 93.1 (0.4) | 93.1 (0.4) |
| 0.25 | 80 | 94.9 (0.3) | 94.3 (0.3) | 94.4 (0.3) | 94.3 (0.3) | 94.5 (0.3) |
| 0.50 | 10 | 91.3 (0.4) | 87.9 (0.5) | 87.1 (0.5) | 86.8 (0.5) | 85.9 (0.5) |
| 0.50 | 20 | 93.0 (0.4) | 91.3 (0.4) | 91.3 (0.4) | 90.7 (0.4) | 90.1 (0.4) |
| 0.50 | 40 | 94.1 (0.3) | 93.1 (0.4) | 93.1 (0.4) | 93.0 (0.4) | 92.8 (0.4) |
| 0.50 | 80 | 94.7 (0.3) | 94.4 (0.3) | 94.2 (0.3) | 94.3 (0.3) | 94.1 (0.3) |
| 1.00 | 10 | 84.3 (0.5) | 82.7 (0.5) | 80.7 (0.6) | 79.4 (0.6) | 77.2 (0.6) |
| 1.00 | 20 | 86.0 (0.5) | 87.5 (0.5) | 85.4 (0.5) | 84.2 (0.5) | 82.1 (0.5) |
| 1.00 | 40 | 89.0 (0.4) | 89.7 (0.4) | 88.6 (0.4) | 87.6 (0.5) | 86.4 (0.5) |
| 1.00 | 80 | 91.0 (0.4) | 91.2 (0.4) | 91.2 (0.4) | 90.6 (0.4) | 89.6 (0.4) |
At \(\sigma = 0.25\) and \(n = 10\), the \(t\) interval achieved 94.1% coverage. Every bootstrap interval stayed below 89.3%. The bootstrap intervals are too narrow in small samples, partly because they use the plug-in variance, which divides by \(n\) rather than \(n-1\) (Davison and Hinkley 1997). Under strong skew (\(\sigma = 1\)) the ordering changes with \(n\). At \(n = 10\) the \(t\) interval (84.3%) and BCa (82.7%) are both far from nominal. At \(n = 80\) BCa reaches 91.2% compared with 91.0% for \(t\). The basic interval was the worst or tied for worst in every scenario with \(\sigma \ge 0.5\).
| sigma | t | bca | percentile | normal | basic |
|---|---|---|---|---|---|
| 0.25 | 0.241 | 0.223 | 0.220 | 0.220 | 0.220 |
| 0.50 | 0.546 | 0.521 | 0.497 | 0.498 | 0.497 |
| 1.00 | 1.714 | 1.781 | 1.532 | 1.564 | 1.532 |
| beta | n | p | naive, fold | naive, pooled | nested, fold | nested, pooled | P(select x1) |
|---|---|---|---|---|---|---|---|
| 0.0 | 50 | 5 | -0.059 (0.003) | -0.039 (0.003) | -0.017 (0.003) | +0.003 (0.003) | — |
| 0.0 | 200 | 5 | -0.015 (0.002) | -0.010 (0.002) | -0.004 (0.002) | +0.001 (0.002) | — |
| 0.0 | 50 | 25 | -0.107 (0.003) | -0.086 (0.003) | -0.008 (0.004) | +0.012 (0.004) | — |
| 0.0 | 200 | 25 | -0.029 (0.002) | -0.024 (0.002) | -0.006 (0.002) | -0.001 (0.002) | — |
| 0.5 | 50 | 5 | -0.040 (0.003) | -0.020 (0.003) | -0.017 (0.004) | +0.004 (0.004) | 91% |
| 0.5 | 200 | 5 | -0.003 (0.002) | +0.002 (0.002) | -0.003 (0.002) | +0.002 (0.002) | 100% |
| 0.5 | 50 | 25 | -0.063 (0.003) | -0.042 (0.003) | -0.001 (0.004) | +0.021 (0.004) | 79% |
| 0.5 | 200 | 25 | -0.006 (0.002) | -0.001 (0.002) | -0.006 (0.002) | -0.001 (0.002) | 100% |
Selection bias. The naive estimate was optimistic in every scenario where the choice among candidates was not obvious, under both aggregations. Its bias grew with the number of candidates and shrank with \(n\). Under the null, pooled naive bias went from -0.010 (MCSE 0.002) at \(n = 200, p = 5\) to -0.086 (MCSE 0.003) at \(n = 50, p = 25\). When a real signal was present and \(n = 200\), the true predictor was always selected and the optimism essentially vanished (-0.001 (MCSE 0.002)).
Aggregation bias. The fold-averaged nested estimate was also optimistic, for example -0.017 (MCSE 0.003) at \(n = 50, p = 5\). Pooling removed this bias (0.003 (MCSE 0.003)). This is consistent with it being an artefact of averaging per-fold RMSEs and not a failure of nested CV. With pooling, nested CV had 6 of 8 biases within 2 MCSE of zero. The exceptions were small and positive, at most +0.021. That is the expected pessimism from training on 80% of the data, and it is largest when \(n = 50\) and there are many candidates to choose from.
In Study 1 the bootstrap offered no advantage over the \(t\) interval for the mean at small \(n\) and moderate skew. For strongly skewed data, BCa was the best bootstrap interval and overtook \(t\) as \(n\) grew. No method was satisfactory at \(n = 10\) with heavy skew. This agrees with the theoretical second-order accuracy of BCa, and with its known small-sample narrowness (Efron 1987; Davison and Hinkley 1997). The practical lesson is to present small-sample intervals for skewed data with appropriate caution, not to choose the bootstrap by default.
Study 2 puts numbers on a well-known pitfall. Selecting among only 25
single-variable models is enough to make naive CV understate prediction
error by several percent when \(n =
50\). Nested CV is the remedy (Varma and Simon 2006; Cawley and Talbot 2010), but the study
also exposed a second, less familiar source of optimism. Averaging
per-fold RMSEs is biased downwards when test folds are small, and at
\(n = 50\) this bias was about as large
as the selection bias that nested CV is meant to remove. Computing
non-linear metrics such as the RMSE from the pooled out-of-fold
predictions (Forman and
Scholz 2010) avoids the problem. The
RDataScienceCompendium functions
cross_validate() and nested_cv() now report
both versions. Once pooled, nested CV’s remaining bias is small and
conservative.
Limitations. Study 1 considers only log-normal data and the mean; heavier tails or other statistics may favour different methods. Study 2 uses a simple class of candidate models and a single choice of fold counts. Both designs are easy to extend with the scripts provided.
From the repository root:
make analysis # install package, run both studies, draw figures, render paper
The studies used a machine with future backend and took 123.6 s
(Study 1) and 388.2 s (Study 2) of wall-clock time on
aarch64-apple-darwin25.2.0 running R version 4.5.2 (2025-10-31). Because
every replicate has its own random-number stream, the numbers in this
paper are reproduced exactly with any number of workers
(RDSC_WORKERS=1 for a sequential run).