In-Sample vs. Out-of-Sample

The fairest test of a system uses data it was never tuned on. Here is how splitting data into in-sample and out-of-sample periods works, and what happened when we tuned 40 moving-average systems on 2007–2016 and tested them on 2017–2026.

Split the data

In-sample data is the period you use to design and tune rules. Out-of-sample data is a period you hold back and use only once, at the end, to see whether the rules still work. If performance collapses out of sample, the in-sample results were likely overfit.

Unlock all of Investing School

The rest of this lesson, its chart examples and quiz are part of Investing School. Start free with Stock Market Fundamentals and the first lesson in every category.