Research question

Using a simulated 300-month return series, the article searches 500 parameter sets over the first 180 months, treats the middle 60 months as the first out-of-sample window and the last 60 as the final holdout. How much of the best in-sample result survives out of sample? What happens if the analyst reuses the middle 60 months to select a model? The data are generated with seed 20261036 and are not real market data.

Data

Item Value
Total sample 300 months
Frequency and unit monthly returns; Sharpe is unitless
Search period first 180 months
First out-of-sample window middle 60 months
Final holdout last 60 months
Parameter sets 500
Best in-sample Sharpe 0.831
Its first out-of-sample Sharpe 0.072
Mean out-of-sample Sharpe of the in-sample top 10 -0.002
Correlation of in-sample and out-of-sample Sharpe -0.061
Best Sharpe after 20 out-of-sample selections 1.131
Final 60-month Sharpe of that 1.131 combination 0.489
License simulated data, no external license

Method and assumptions

The strategy uses 500 parameter combinations of one signal (lookback and holding period). The in-sample window selects the combination with the highest Sharpe; the first out-of-sample window is evaluated once. A separate exercise has an analyst select 20 times on the middle 60 months, report the best Sharpe, and test that combination on 60 untouched months. Sharpe is the monthly mean divided by the standard deviation, then multiplied by √12, with no costs deducted. The first out-of-sample window does not enter the first selection; reusing it 20 times turns it into selection data. Overfitting means treating in-sample noise as signal. NIST/SEMATECH notes that a single fit statistic does not prove a model is adequate, while Chicco and Jurman (2022) state that a test set must not be used repeatedly, because doing so causes overfitting and invalidates the results [2].

Results

The best in-sample Sharpe is 0.831, versus 0.072 in the first out-of-sample window; the in-sample top 10 average -0.002 out of sample, and the in-sample/out-of-sample correlation is -0.061. After 20 out-of-sample selections, the best reported Sharpe is 1.131; the same combination scores 0.489 over the final 60 months, a shrinkage of about 57%.

In-sample versus out-of-sample Sharpe ratios A band at the top splits three hundred months into a 180-month search period, a 60-month first out-of-sample block and a 60-month final holdout, at 1.0667 pixels per month. Below, three bars measured from a zero line at eighty pixels per Sharpe unit: the best in-sample combination 0.831 (113.6 pixels), its out-of-sample 0.072 (14.4), and the average out-of-sample of the top ten in-sample combinations, minus 0.002 (0.16 pixels downward, effectively on the zero line). Sample split (1.0667 px per month) and Sharpe (80 px per unit) search 180 OOS 60 holdout 60 0.831 0.072 −0.002 best in-sample its out-of-sample top-10 average OOS
Figure 1: the 300-month split (180 search / 60 out-of-sample / 60 final holdout at 1.0667 pixels per month) and three Sharpe ratios from the 500-combination search (zero line, 80 pixels per unit): best combination 0.831 in-sample but 0.072 out-of-sample, and the average out-of-sample Sharpe of the top ten in-sample combinations at -0.002, with an in-sample to out-of-sample correlation of -0.061. The drop is the size of the overfitting; simulated teaching numbers.

Diagram: two markdowns

Best in-sample, first out-of-sample, reported after 20 picks and final holdout Left: 0.831 in-sample falls to 0.072 in the first out-of-sample look, a markdown of 0.759. Right: 1.131 reported after 20 picks on the same holdout falls to 0.489 in the final holdout that was never used for selection, a markdown of 0.642. The axis runs from zero to 1.2. Two markdowns: −0.759 and −0.642 Left: one look. Right: 20 picks on the same holdout. 0 0.4 0.8 0.831 best in-sample 0.072 first out-of-sample 1.131 reported after 20 picks 0.489 final holdout −0.759 −0.642 1.131 is the best of 20 picks; the final holdout is used once.
Figure 2: the left path evaluates once: 0.831 in-sample falls to 0.072, a 0.759 markdown. The right path reuses the same 60 months for 20 picks: the reported value rises to 1.131, but the final 60-month holdout never used for selection delivers 0.489, a 0.642 markdown. Both are teaching figures from the same simulation, not realizable performance.

Robustness

  • This run fixes one split, 180/60/60: other splits or seeds change the numbers, while the overestimation from taking the maximum of 500 in-sample values follows from the selection mechanism itself, not from one draw. Stating results for a 150/75/75 split would require extending the script's parameters and running it, which this article does not do.
  • This article deducts no trading costs and reports no turnover by parameter set; directionally, costs accumulate with turnover, so net Sharpe falls once they are deducted and falls most for the shortest holding periods. The quantified version is in the main article Survivorship Bias and Trading Costs (RES-021).

Limitations

One simulated series is not a real asset; the grid, split points and strategy family are arbitrary. Sharpe estimates are shown without standard errors, and the final 60 months could be unusually high or low. Costs, capacity and regime change are omitted. Reusing the same out-of-sample data turns it into in-sample data in practice; a true final holdout is used once. OpenStax notes that extrapolation beyond the observed range is unreliable even when an equation produces a number; the 60-month holdout cannot be extrapolated to longer periods. Out-of-sample evaluation and cross-validation apply only when a budget of untouched data is reserved, when time-series folds are split in time order so that no future information leaks, and when each fold is used for a single evaluation - re-selecting on the same fold turns it into training data. The same source limits their value: a single out-of-sample estimate is itself noisy and is reported here without standard errors, shorter holdouts are less reliable, and performance outside the tested window cannot be inferred from it. The correlation is computed over all 500 combinations (restricting it to the in-sample top ten gives 0.089), so the figure is basis-dependent, while the near-zero relation between in-sample rank and out-of-sample result holds on either basis. The evidence does not support any forecast of a real strategy's return.

Reproduction

  1. Generate 300 monthly returns with seed 20261036.
  2. Enumerate 500 lookback and holding-period combinations.
  3. Select the best Sharpe over the first 180 months and evaluate it on the middle 60.
  4. Simulate 20 out-of-sample selections and record the best Sharpe.
  5. Evaluate the same combination on the final 60 months and report the results.

node scripts/simulate-out-of-sample-overfitting.mjs --check

seed = 20261036
months = 300; search = 180; oos = 60; final = 60
grid = 500; best_is_sharpe = 0.831; best_oos_sharpe = 0.072
top10_oos_mean = -0.002; corr_is_oos = -0.061
best_after_20_oos_picks = 1.131; final_sharpe = 0.489

Strength of conclusions

The best in-sample value is the maximum of 500 comparisons and contains selection bias; it does not carry over out of sample. Reusing the out-of-sample window brings that bias back. The evidence supports "set aside a final sample and evaluate it once"; it does not support treating 0.831 or 1.131 as achievable; the holdout reading of 0.489 is itself one noisy draw.

Related

  • Required prerequisite: Backtesting and Look-Ahead Bias (RES-020).
  • Related reading: Rolling Analysis and Structural Change (RES-018), Backtesting and Look-Ahead Bias (RES-020), Multiple Testing and Data Snooping (RES-023).

Figures in plain language

The three figures below check the mechanism, boundary and comparison in this article; labels come from its own sections, not new data.

Out-of-Sample Testing and Overfitting: mechanism chain Out-of-Sample Testing and Overfitting — three-step structure: problem, mechanism, judgment. Labels come from the article's sections, not new data. Out-of-Sample Testing and Overfitting: mechanism chain Labels come from the article's sections; all three steps matter. Problem Searching 500 parameter sets… Searching 500 parameter sets over 180 months gives a best in-sample… Reproduction Reproduction: 1. Reproduction: 1. Data | Item | Value | | --- | ---: | |… | Item | Value | | --- | ---: | | Total sample | 300 months | |… Reading order: test the problem, then the mechanism, then whether the judgment overreaches. If a middle step lacks evidence, later conclusions are hypotheses, not facts. Structural illustration, not a new data chart; sample is the article's own argument.
Figure 3: Out-of-Sample Testing and Overfitting — mechanism chain: problem, mechanism, judgment. Sample: the article's own argument; units as stated in the text.
Out-of-Sample Testing and Overfitting: boundary Separates conditions where the claim holds from those where it fails; a local example is not universal. Out-of-Sample Testing and Overfitting: when does it hold? Check the conditions before the conclusion If conditions, definitions or samples change, recompute the conclusion Holds One simulated series is not a real asset; the grid, split points and strategy family are arbitrary.… Fails / rewrite Using a simulated 300-month return series, the article searches 500 parameter sets over the first 180 months… Boundary illustration; sample is the article's own argument; units as stated in the text.
Figure 4: Out-of-Sample Testing and Overfitting — boundary: when the claim holds, and when it fails. Sample: the article's own argument; units as stated in the text.
Out-of-Sample Testing and Overfitting: object, conditions and common mistakes Three rows compare the concept, its conditions and common mistakes; comparison is not equivalence and does not replace a definition. Out-of-Sample Testing and Overfitting: object, conditions and common mistakes at a glance This article Commonly confused Object Searching 500 parameter sets over… Adjacent concepts / common claims Conditions One simulated series is not a real asset… Using a simulated 300-month return series, the article… Check Define first, then compare; never judge labels only Correlation is not causation; a local case is not universal Comparison illustration; sample is the article's own argument; units as stated in the text.
Figure 5: Out-of-Sample Testing and Overfitting — comparison of object, conditions and common mistakes. Sample: the article's own argument; units as stated in the text.

Exercises

  1. Why does the best in-sample Sharpe overstate skill?
  2. What is the point of evaluating out of sample only once?
  3. Why is 1.131 not credible after 20 out-of-sample selections?
  4. Does overfitting occur only when there are many parameters?
Suggested answers
  1. The maximum of 500 noisy estimates tends to select positive noise, so it exceeds true skill.
  2. It keeps the out-of-sample window from participating in selection and preserves a relatively independent test.
  3. 1.131 is the maximum of 20 selections made on the same out-of-sample window; the final holdout gives only 0.489, so the reported figure was inflated by about 57%, while a single holdout is itself a noisy estimate rather than a new constant.
  4. No; repeatedly looking at the same data, changing rules or choosing the sample window can also turn noise into a signal.

Sources

  1. NIST/SEMATECH. e-Handbook of Statistical Methods, “4.4.4 How can I tell if a model fits my data?” U.S. Government work (public domain). https://www.itl.nist.gov/div898/handbook/pmd/section4/pmd44.htm (accessed 2026-10-30)
  2. Chicco, Davide, and Giuseppe Jurman. “The ABC recommendations for validation of supervised machine learning results in biomedical sciences.” Frontiers in Big Data 5 (2022): 979465. CC BY 4.0. https://www.frontiersin.org/journals/big-data/articles/10.3389/fdata.2022.979465/full (accessed 2026-10-30)
  3. OpenStax. Introductory Statistics 2e, “12.5 Prediction.” CC BY-NC-SA 4.0. https://openstax.org/books/introductory-statistics-2e/pages/12-5-prediction (accessed 2026-10-30)

Worked demo

Read-through check: can you say three things?

No recitation needed. Tick each sentence below and see whether you can explain the mechanism, one worked example and one boundary in your own words.

Ticked 0 / 3

The numbers are teaching assumptions that show relationships, not forecasts or investment advice.

This article has passed the current publication gate. Factual, calculation and translation revisions update both language versions together.

Back to station