Methodology

In-Sample vs Out-of-Sample Testing: The Minimum Honest Backtest Check

In-sample data is where a strategy is built and tuned. Out-of-sample data is held back and used once to judge it. Splitting the two is the least you can do to avoid fooling yourself.

In-sample data is the history you use to build and tune a strategy. Out-of-sample data is a slice you deliberately hold back, do not look at, and use exactly once at the end to judge whether the rules describe anything beyond the sample they were fitted to.

Splitting the two is not an advanced technique. It is the minimum honest check, and a backtest reported without it is a statement about how well someone fitted a curve.

Why the in-sample result is not evidence

When you develop a strategy, you are searching. You try a threshold, look at the outcome, adjust, and try again. That search uses the data, and by the end the rules carry the shape of that particular history including its noise.

The final in-sample number therefore measures two things that cannot be separated: whatever genuine relationship exists, and how thoroughly you fitted the sample. Since you cannot tell which is which, the number on its own tells you very little. This is the core problem of overfitting, and holding data back is the direct response to it.

The point of a holdout is simple. If the rules capture something durable, they should work on data that had no chance to influence their design. If they only capture the development sample’s accidents, they will not.

How to split the data

There is more than one way to divide history, and the choice matters more than the exact proportions.

Chronological split. The most common approach: develop on the earlier part of the period, evaluate on the later part. This respects the arrow of time, which matters because market conditions and structure evolve. It also matches how the strategy would actually be used, since in real life you always fit the past and trade the future.

Held-out segment in the middle. Occasionally a specific window is reserved because it contains an unusual environment worth testing against. This is legitimate but must be decided in advance, otherwise you are choosing the exam after seeing the questions.

Cross-sectional split. Rather than splitting by time, develop on one part of the universe and evaluate on another, such as a different market-cap band or a different segment of the market. This is weaker as a test of durability through time but useful as a check on whether the pattern is specific to a handful of names.

For most equity strategy work, the chronological split is the default, because the risk you care about is that the world changes, not that a different set of stocks behaves differently.

The rules that make a holdout mean anything

A holdout only works if it is treated with discipline. Three rules do the work.

Do not look until the design is final. The whole value of the holdout is that it had no influence on the rules. Peeking at it, adjusting the strategy, and peeking again converts it into development data. It stops being a test and becomes another round of fitting, except now you have no independent data left.

Use it once. This is the hard one. If the out-of-sample result disappoints and you go back, change something, and re-test on the same holdout, you have started a search on the holdout. Each re-use degrades it. In practice, if you have used a holdout more than once or twice, treat its verdict as in-sample.

Decide the pass criterion in advance. Write down what result would count as acceptable before you run the evaluation. Otherwise the criterion becomes whatever the result turns out to be, which is the same problem in a different costume.

These sound easy and are not. The temptation to keep going after a bad holdout result is enormous, precisely because the strategy looked so good on the development data.

Reading the two results together

The comparison between in-sample and out-of-sample performance is more informative than either number alone.

A large gap, where the development result is strong and the holdout result is weak or negative, is the classic overfitting signature. The rules described the development sample and nothing more.

A moderate gap, where the holdout is meaningfully worse but still coherent, is the normal and expected outcome. Some degradation is almost always present, because some fitting always happened. The question is whether what remains is worth anything after costs.

A holdout result that matches or exceeds the development result deserves scrutiny rather than celebration. It can happen legitimately if the holdout period was simply more favourable, but it can also indicate a data leak, an inconsistency in how the two periods were processed, or a benchmark mismatch. Check the plumbing before believing it.

The most useful comparison is not the headline return but the whole profile: drawdown, turnover, number of trades, and the spread of contribution across positions and periods. A strategy whose return holds up but whose drawdown doubles out of sample has not really passed. That is why the portfolio metrics hub treats these statistics as a set rather than a ranking.

What can go wrong even with a clean split

A holdout does not protect against every failure, and several problems cross the boundary untouched.

Data leakage between periods. If the signal uses any input computed over the full history, such as a normalisation based on the whole period’s average, information from the holdout has entered the development stage. Every transformation must be computed using only data available up to each point. This is the same discipline as avoiding lookahead bias.

A shared universe defect. If the universe was built from today’s surviving companies, both halves of the split inherit the same survivorship bias. Splitting a biased sample yields two biased samples.

Restated fundamentals. If the underlying financial data is the restated version rather than what was published at the time, both periods are contaminated. This is why point-in-time data matters regardless of how you split.

Costs left out of both. A holdout run with no transaction costs or slippage tests only the signal, not the strategy.

What a passed out-of-sample test does not prove

This is the section that keeps the technique honest.

It does not prove the strategy works. If you tested forty candidates and reported the two that passed, the passing was partly selection. The holdout was a filter applied to a search, and filters let some luck through. The only real protection is to count and disclose how many candidates were tested.

It does not establish that the relationship will persist. A pattern can be perfectly real across the entire tested period and still decay afterwards as participants adapt, liquidity changes, or the market structure that supported it shifts.

It does not tell you the strategy is implementable. A holdout confirms the pattern was present. It says nothing about whether the positions could have been filled at the modelled prices, or whether the approach has capacity at the size you intend.

It does not remove the need for a reason. A rule that passes out of sample and has no economic explanation is still a rule you do not understand. When it stops working, and something eventually does stop working, you will have no way to tell whether it is a temporary drought or a dead idea.

And it is a weaker test than it feels. A single holdout is one draw. Re-estimating repeatedly through time, as in walk-forward analysis, asks a harder question and gives more chances to fail. If a strategy passes a single split but not a rolling one, believe the rolling one.

Out-of-sample testing is best understood as the floor, not the ceiling. It is what stops a backtest from being circular. It does not make it true.

This article is educational. Altys Labs is not a registered research analyst or investment adviser, and nothing here is investment advice or a recommendation to buy, sell, or hold any security.

Frequently asked questions

What is the difference between in-sample and out-of-sample testing?

In-sample is the portion of history you use to design, tune, and choose a strategy. Out-of-sample is a portion you deliberately set aside and do not look at until the rules are final, then use once to judge them. The in-sample result measures how well you fitted the data; the out-of-sample result is the first honest read.

How much data should you hold out?

There is no universal split, and any specific ratio is a convention rather than a rule. The practical constraint is that both parts need to contain enough independent events and more than one market environment to mean anything. A holdout too small to include a drawdown cannot tell you much.

Does a good out-of-sample result prove a strategy works?

No. It shows the rules were not purely fitted to the development sample. If many strategies were tested and only the survivors reported, some will pass by luck, and even a genuine relationship can decay. It raises confidence rather than settling the question.