5,661
Views
43
CrossRef citations to date
0
Altmetric
Theory and Methods

Cross-Validation: What Does It Estimate and How Well Does It Do It?

ORCID Icon, ORCID Icon &
Pages 1434-1445 | Received 19 Aug 2021, Accepted 27 Feb 2023, Published online: 15 May 2023
 

Abstract

Cross-validation is a widely used technique to estimate prediction error, but its behavior is complex and not fully understood. Ideally, one would like to think that cross-validation estimates the prediction error for the model at hand, fit to the training data. We prove that this is not the case for the linear model fit by ordinary least squares; rather it estimates the average prediction error of models fit on other unseen training sets drawn from the same population. We further show that this phenomenon occurs for most popular estimates of prediction error, including data splitting, bootstrapping, and Mallow’s Cp. Next, the standard confidence intervals for prediction error derived from cross-validation may have coverage far below the desired level. Because each data point is used for both training and testing, there are correlations among the measured accuracies for each fold, and so the usual estimate of variance is too small. We introduce a nested cross-validation scheme to estimate this variance more accurately, and show empirically that this modification leads to intervals with approximately correct coverage in many examples where traditional cross-validation intervals fail. Lastly, our analysis also shows that when producing confidence intervals for prediction accuracy with simple data splitting, one should not refit the model on the combined data, since this invalidates the confidence intervals. Supplementary materials for this article are available online.

Acknowledgments

The authors would like to acknowledge Frank Harrell for a seminar and personal correspondence alerting them to the miscoverage of cross-validation in the high-dimensional logistic regression model. We would like to thank Alexandre Bayle, Michael Celentano, Bradley Efron, Lester Mackey, Adam Smoulder, Ryan Tibshirani, Larry Wasserman, and three anonymous reviewers/editors for helpful comments on earlier versions of this manuscript.

Disclosure Statement

The authors report there are no competing interests to declare.

Notes

1 We thank an anonymous reviewer for feedback on this topic.

2 The width in is reported relative to the version of cross-validation that holds out two folds at a time, since this is what is computed internally during NCV. In table and elsewhere, we instead report widths relative to the usual K-fold CV.

Additional information

Funding

S. B. was partially supported by a Ric Weiland Graduate Fellowship. T.H. was partially supported by grants DMS-2013736 and IIS 1837931 from the National Science Foundation, and grants 5R01 EB 001988-21 and 5R01 EB001988-16 from the National Institutes of Health. R.T. was supported by the National Institutes of Health (5R01 EB001988-16) and the National Science Foundation (19 DMS1208164).

Reprints and Corporate Permissions

Please note: Selecting permissions does not provide access to the full text of the article, please see our help page How do I view content?

To request a reprint or corporate permissions for this article, please click on the relevant link below:

Academic Permissions

Please note: Selecting permissions does not provide access to the full text of the article, please see our help page How do I view content?

Obtain permissions instantly via Rightslink by clicking on the button below:

If you are unable to obtain permissions via Rightslink, please complete and submit this Permissions form. For more information, please visit our Permissions help page.