Choosing and Testing Lookback Windows for Cointegration
Summary
The discussion addresses lookback selection when using OLS residuals to test whether a pair of assets is cointegrated for a statistical-arbitrage strategy. It cautions that a fixed window can make relationships appear significant only for the selected historical period, creating data-snooping concerns. Half-life is not an optimal lookback rule: it estimates the approximate time for a mean-reverting spread to become profitable and can instead inform expectations about how long a position may be held.
A practical approach is to test a small set of windows whose lengths fit the intended holding horizon, then check whether the cointegration results and strategy performance remain robust across them. Large differences across windows weaken confidence in the pair. Out-of-sample evaluation can help address selection bias. The answers offer judgment and robustness checks rather than a universal quantitative formula, and a relationship that appears historically stable may still fail going forward.
Key ideas
- Choose candidate lookback windows in relation to the intended holding period.
- A long window can identify historical stationarity that is irrelevant to the trading horizon.
- Half-life estimates spread reversion and holding duration; it does not determine the optimal estimation window.
- Compare cointegration and backtest results across several windows to assess robustness.
- Use out-of-sample testing to reduce the risk of data snooping when selecting a window.
Tags
Cited by
- Strategies PEP/KO Heteroskedastic Filtered-Spread Re-entry
- Hypotheses PEP/KO Heteroskedastic Filtered-Spread Re-entry
Full text
# How to select optimal look back period for statistical arbitrage? # How to select optimal look back period for statistical arbitrage? Is it possible to estimate the optimal look back period for OLS from which we test if residuals are stationary? Almost all papers that I read use random look back periods of 100 days, 252 days, 500 days etc. I think this procedure introduces data snooping bias. The only "quantitative" method that I've found so far is calculation half-life of mean reversion and using it as a look back period. Can somebody suggest a methodology or a procedure to select the optimal length of a look back period which can be used to test if a pair of stocks is co-integrated? Any help will be appreciated. ## Answer by James (score 1) https://quant.stackexchange.com/a/18518 I think there is no quantitative method, but one can use some common sense based on how long one is willing to hold the position. For instance, if you don't want to hold a position in oil futures for more than a month, using a 10-year window is of no use even if the annual oil price is stationary. In practice, the trader probably tests a few windows whose size is proportional to the reasonable holding period and picks the one that works best. As always, data snooping is offset by testing the strategy out-of-sample. ## Answer by Quantopik (score 1) https://quant.stackexchange.com/a/18522 Yes, you're right. Choosing a fixed lookback period allows you to find more couple of candidates to implement a statistical arbitrages, but it is misleading, in the sense that, looking back, it leads you in finding the period in which a couple of assets are cointegrated and not a couple of assets are really cointegrated; So, what could be the solution to this problem? Test (and, after, backtest) for different periods; if the results are too different, the cointegration relationship is not robust and, so, the candidated couple of assets is not good In my humble opinion, it is interesting to follow E. Chan's blog, who deals with the statistical arbitrage topic pretty often; his books are pretty interesting too. As regards the half-life, it corresponds to how long (approximately) on average you should expect to hold the spread you're investing in, before it becomes profitable and it is not the optimal length of the lookback period. Hope this helps.
Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.