Stockertim Dictionary · Markets · Technology
In-sample test
Also called in-sample testing, in-sample backtest, in-sample period, training sample test
In short
A test of a trading strategy or model on the same historical data used to build or tune it, which shows how well it fits the past rather than how it will perform.
- Advanced
- Concept
- Checked
In detail
When a trading strategy or forecasting model is developed, its rules and parameters are chosen by looking at historical data. Measuring the strategy's performance on that same data is an in-sample test. It tells you whether the idea worked in the period it was designed on, and it is a necessary first step, but it is not evidence that the strategy has a real edge.
The problem is overfitting. With enough parameters and enough attempts, almost any strategy can be tuned to look excellent on past data, because it ends up fitting random noise as well as any genuine pattern. The more combinations tried, the more likely the best in-sample result is due to chance, a problem called data snooping or data mining bias. In-sample results therefore almost always look better than what happens later.
To guard against this, researchers hold back data that the strategy never sees during development. An out-of-sample test runs the finished strategy on that reserved period. Walk-forward analysis repeats the process, tuning on one window and testing on the next, then rolling forward. Other safeguards include keeping the number of parameters small, adjusting statistical significance for the number of tests run, including realistic costs, and avoiding look-ahead and survivorship bias in the data.
Worked example
A researcher tests 200 variations of a moving-average rule on 2010 to 2019 data and picks the best, which returned 18% a year. On 2020 to 2024 data it returns 4% a year.
- Variations tried: 200
- Drop from in-sample to out-of-sample return: 18% − 4% = 14%
Most of the in-sample performance came from fitting the past; the out-of-sample figure is a better guide to the rule's real behaviour.
In practice
Quant teams split data into in-sample and out-of-sample sets as standard practice. Regulators and model risk teams expect firms to show validation beyond in-sample fit before models are used for trading or risk decisions.
Watch out
- A strong in-sample backtest is not proof of future returns.
- Peeking at out-of-sample data while tuning turns it into in-sample data.
Learn it properly
Official sources
- NIST/SEMATECH e-Handbook: What are statistical tests? · National Institute of Standards and Technology
- Review of quality assurance of government models · HM Treasury
Facts last checked on 4 November 2026.
Education, not advice: the Stockertim Dictionary explains what terms mean. It never recommends buying or selling anything.