---
title: "Pairs and Baskets"
book: "Strategies I: Equities and Futures"
subject: quant
language: en
chapter: 4
exercises: 8
source: https://one-course.com/books/quant/8/en/chapter/4-pairs-and-baskets
---

# Chapter 4 — Pairs and Baskets

Two synthetic stocks had moved together for a year, their normalised prices a standard deviation of 2.4 per cent apart: they were planted as close substitutes, and the [distance method](#def-s1-pairs-and-baskets-distance) picked them. The pair opened when their spread reached two standard deviations, closed, and opened again. Then, on the 111th day of trading, one of the companies was taken over at a premium. The spread jumped to 35%, the short leg stopped trading, and the pair never closed: it lost 24.6% on each dollar per leg. [Pairs trading](#def-s1-pairs-and-baskets-pairs) is the oldest story in [statistical arbitrage](https://one-course.com/books/quant/8/en/chapter/1-anatomy-of-a-stat-arb-book#def-s1-anatomy-of-a-stat-arb-book-statarb) and the easiest to explain: find two stocks that move together, and bet on their return to each other when they drift apart. This chapter is about how the two stocks are found, why most methods find the wrong ones, and what happens when the story stops being true. The build is `firm.pairsel`.

## 4.1 Selection: distance, cointegration, copulas

**Definition 4.1 (Pairs trading).**

*Pairs trading* is the strategy of selecting two securities whose prices have moved together, and taking a long position in the one that has fallen behind and a short position in the other when their prices diverge, to be closed when they converge.

**Definition 4.2 (Distance method, formation period, trading period).**

The *distance method* selects the pairs of stocks whose normalised price paths (cumulative total return indices starting at one) have the smallest sum of squared differences over a *formation period*, and trades them over the following *trading period*, opening a pair when its spread exceeds a multiple of its formation-period standard deviation and closing it when the prices cross.

Gatev, Goetzmann and Rouwenhorst gave the [distance method](#def-s1-pairs-and-baskets-distance) its standard form: twelve months of formation, six of trading, open at two historical standard deviations, close at the next crossing or at the end of the six months; the top 20 pairs. On daily US data from 1962 to 2002 it earned annualised excess returns of up to 11% on self-financing portfolios of pairs, typically more than conservative cost estimates. The cointegration method (Book 4, chapter 20) replaces the distance with an Engle–Granger test: regress one log price on the other and test the residual for a unit root. The copula method models the pair’s daily returns with a copula (Book 4, chapter 15) and trades when one return is improbably high or low given the other. Krauss’s survey counts over a hundred papers in five families, and Rad, Low and Faff compared the three main ones on US equities from 1962 to 2014: mean monthly excess returns of 91, 85 and 43 basis points before costs for distance, cointegration and copula, and 38, 33 and 5 after.

The synthetic market so far has no pairs to find: its stocks share factors but no stock is a substitute for another, so every spread wanders off as the difference of two random walks. `MarketConfig.twin_share` (new in this chapter, off by default) pairs 10% of the initial listings as close substitutes, fifty pairs whose log price spread is a stationary AR(1) with a mean-reversion time of ten days and a standard deviation of 2%. Everything else about the twins is ordinary: they can be taken over, delisted or split like any stock. Because the pairs are known, the chapter can count what each method finds.

## 4.2 Trading rules and the formation window

On the twin market, sixteen cycles of twelve months’ formation and six months’ trading, from year 3 to year 10, with the Gatev–Goetzmann–Rouwenhorst rule, $1 per leg and five basis points per unit traded:

| selection | distance | copula | two-step | Engle–Granger | [synthetic twin](#def-s1-pairs-and-baskets-twin) |
| --- | --- | --- | --- | --- | --- |
| planted pairs among the 320 selected | 311 | 311 | 113 | 40 | — |
| Sharpe ratio before costs | 5.34 | 4.39 | 1.16 | $-0.09$ | $-0.45$ |
| Sharpe ratio after costs | 5.05 | 3.89 | 1.03 | $-0.17$ | $-0.49$ |
| net return a year ($1 per leg) | 12.2% | 11.6% | 5.9% | $-1.4\%$ | $-2.6\%$ |
| openings per pair and cycle | 2.11 | 4.28 | 2.24 | 2.02 | 0.87 |
| pairs still open at the end | 51% | 89% | 75% | 81% | 61% |
| Sharpe ratio after costs, no planted pairs | $-0.43$ | $-0.50$ | $-0.11$ | $-0.47$ | $-0.35$ |

The [distance method](#def-s1-pairs-and-baskets-distance) finds the substitutes: 311 of its 320 pairs are planted twins, and it nets a Sharpe ratio of 5.05. On the default market, where there are none, the same method loses: the pairs it picks are those whose paths happened to stay close over one year, typically two low-volatility stocks, and 84% of them are still open when their six months end, because nothing pulls them back. Gatev, Goetzmann and Rouwenhorst noticed the same selection effect: on average 82% of the stocks in their top twenty pairs were utilities. The copula index on the same pairs trades twice as often and earns a little less (its mispricing index drifts, so pairs stay open). The table’s worst column is the one that sounds most rigorous.

![The chapter’s opening example: two planted substitutes on the synthetic market over their six-month trading period. The spread (difference of normalised prices) opens the pair twice; on day 111 (dotted) the stock the pair is short is taken over at a premium, and the pair never closes. Data: s1_pairs.takeover.](https://one-course.com/images/onecourse/chapters/quant-8/s1-pairs-and-baskets/fig-733a1f3ddd5a.svg)

***Figure 4.1.** The chapter’s opening example: two planted substitutes on the synthetic market over their six-month [trading period](#def-s1-pairs-and-baskets-distance). The spread (difference of normalised prices) opens the pair twice; on day 111 (dotted) the stock the pair is short is taken over at a premium, and the pair never closes. Data: `s1_pairs.takeover`.*

## 4.3 Why cointegration tests fail at scale

Ranking pairs by Engle–Granger p-values should find the planted pairs, since they are the only cointegrated ones. It finds 40 of 320. The reason is multiple testing (Book 4, chapter 12) with a test whose p-values are wrong. Each cycle tests every pair of stocks in the same industry, about 46 600 pairs; over sixteen cycles, 745 465 tests. The p-values come from the Engle–Granger statistic’s distribution for two independent Gaussian random walks, simulated once (`eg_null`). The synthetic market’s returns have fat tails and volatility that clusters, like real ones, and under those conditions the test rejects too often: on the default market, where no pair is cointegrated, 7.4% of pairs have p-values below 5%, and 0.32% below 0.1%, three times the nominal rate ([Figure 4.2](#fig-s1-pairs-and-baskets-calib)). The smallest p-values are dominated by these false rejections, not by the planted pairs.

![Calibration of the Engle–Granger test with a Gaussian random-walk null on the synthetic market without planted pairs (742 028 same-industry pair tests): the share of pairs whose p-value falls below each level, against the level. Data: s1_pairs.calibration.](https://one-course.com/images/onecourse/chapters/quant-8/s1-pairs-and-baskets/fig-84afac58cb70.svg)

***Figure 4.2.** Calibration of the Engle–Granger test with a Gaussian random-walk null on the synthetic market without planted pairs (742 028 same-industry pair tests): the share of pairs whose p-value falls below each level, against the level. Data: `s1_pairs.calibration`.*

On the twin market, the counts are sharper still. Of 58 024 pairs rejected at 5% (7.8% of those tested), 530 are planted, 84.7% of the 626 planted pairs the cycles could test: the test has power. Benjamini and Hochberg’s procedure, set to a false discovery rate of 5%, keeps 1 139 pairs, of which 32 are planted: 97.2% of its discoveries are false. The procedure is correct; its input is not, and a false-discovery control built on miscalibrated p-values controls nothing. Persistence tells the same story from the other side: of the pairs rejected at 5% in a formation year and still listed a year later, 7.9% are rejected again over that next year, which is barely above the test’s false-rejection rate. The planted pairs are rejected again 84.6% of the time, the others 7.2%.

The two-step method, a common repair, preselects the 200 pairs of smallest distance and then ranks them by Engle–Granger p-value. It keeps 113 planted pairs and nets 1.03: better than the test alone, worse than the distance alone, because within the shortlist the test still prefers its false rejections.

## 4.4 Why pairs died, and what replaced them

The public record says profits declined. Do and Faff confirmed a continuing downward trend in pairs-trading profitability, with the strategy still performing strongly in prolonged turbulence, including the 2008 crisis; Rad, Low and Faff found that from 2009 the distance and cointegration methods found far fewer trading opportunities, while the copula method’s stayed stable. The synthetic market gives the mechanism, if not the history: the [distance method](#def-s1-pairs-and-baskets-distance) earns exactly as much as the market contains close substitutes, and nothing else. A method that selects on the past co-movement of prices finds substitutes where they exist and low-volatility coincidences where they do not.

What replaced the classic pair is the rest of this part of the book: residuals against many factors (chapter 3), where the “partner” is a factor model; structural relative value (chapter 12), where the substitutes are two share classes, a holding company and its holdings, or a fund and its assets, and the link is contractual; and books of thousands of small bets (chapter 1), where no single pair matters.

## 4.5 Baskets: one stock against its synthetic twin

**Definition 4.3 (Synthetic twin).**

A stock’s *synthetic twin* is a portfolio of other stocks, usually from its industry, whose returns track the stock’s over a [formation period](#def-s1-pairs-and-baskets-distance), estimated by a regression of the stock’s returns on theirs; the spread between the stock and its twin is traded like a pair’s.

The basket generalises the pair: instead of one partner, thirty peers, weighted by a ridge regression on the formation year’s returns. On the synthetic market it loses in both versions ($-0.49$ and $-0.35$). A regression on thirty peers fits the stock’s past factor moves well, but its specific moves are its own: they are independent of every peer’s, so the spread with any basket is the stock’s specific random walk, and a random walk does not revert. The basket works where the stock and its peers share something beyond the factors (a common customer, a regulated price), which is the question to ask of any [synthetic twin](#def-s1-pairs-and-baskets-twin) before trading it.

![Cumulative net returns of the five selection methods on the synthetic market with fifty planted pairs of substitutes. Data: s1_pairs.run.](https://one-course.com/images/onecourse/chapters/quant-8/s1-pairs-and-baskets/fig-af3441c0ba23.svg)

***Figure 4.3.** Cumulative net returns of the five selection methods on the synthetic market with fifty planted pairs of substitutes. Data: `s1_pairs.run`.*

## 4.6 Strategy files

**Strategy file 4.1 — Distance-method pairs.**

**Who pays you, and why.** Flows that push one of two close substitutes away from the other: the book lends liquidity across the pair.

**Instruments and venues.** Liquid stocks, long one and short the other; the same exchange hours.

**Signal.** The spread of normalised prices against its formation standard deviation; open at two, close at the crossing.

**Sizing and execution.** $1 per leg per pair, twenty pairs; both legs traded together at the close.

**Costs.** Four units traded per round trip; borrow on the short leg.

**How it dies.** The pairs are coincidences, not substitutes; a takeover or other news breaks a real pair (the chapter’s opening example); too many traders in the same pairs.

**Horizon, capacity, infrastructure.** Weeks to months; small capacity per pair; a daily price file and a formation job.

**Backtest honestly.** The formation universe as it was; delisting and takeover returns in the legs; pairs held to the end of the [trading period](#def-s1-pairs-and-baskets-distance).

**Sources.** Gatev, Goetzmann and Rouwenhorst (2006): up to 11% a year in excess returns, 1962–2002; Do and Faff (2010): a continuing decline; Rad, Low and Faff (2016): 38 basis points a month after costs, 1962–2014.

**Strategy file 4.2 — Cointegration pairs.**

**Who pays you, and why.** As for distance pairs, selected by a test of a stationary spread.

**Instruments and venues.** Liquid stocks, usually in the same industry.

**Signal.** The Engle–Granger residual of one log price on the other, in formation standard deviations.

**Sizing and execution.** Legs in the ratio of the cointegrating coefficient; open at two, close at zero.

**Costs.** As for distance pairs.

**How it dies.** Miscalibrated p-values across tens of thousands of tests fill the book with false pairs; relationships that break.

**Horizon, capacity, infrastructure.** Weeks to months; a test per candidate pair per formation.

**Backtest honestly.** Count the tests; check the test’s calibration on data with no cointegration; preselect by economics, not by p-value alone.

**Sources.** Rad, Low and Faff (2016): 33 basis points a month after costs; fewer opportunities after 2009.

**Strategy file 4.3 — Copula pairs.**

**Who pays you, and why.** As for distance pairs; the signal measures how improbable today’s joint move is.

**Instruments and venues.** As for distance pairs.

**Signal.** A mispricing index: the running sum of $P(U_a \le u_a \mid U_b = u_b) - \tfrac12$ under a copula fitted in the [formation period](#def-s1-pairs-and-baskets-distance).

**Sizing and execution.** Open at an index of $\pm 0.5$, close when it changes sign.

**Costs.** Trades more often than the distance rule.

**How it dies.** As above; the index drifts, and pairs stay open.

**Horizon, capacity, infrastructure.** Weeks; marginal and copula fits per pair.

**Backtest honestly.** Marginals and copula fitted on formation data only.

**Sources.** Rad, Low and Faff (2016): 43 basis points a month before costs and 5 after; trading opportunities stable after 2009.

**Strategy file 4.4 — Stock against its synthetic basket.**

**Who pays you, and why.** As for pairs, with a basket of peers as the partner.

**Instruments and venues.** A stock and a basket of its industry peers.

**Signal.** The cumulative residual of the stock against its ridge-regression twin, in formation standard deviations.

**Sizing and execution.** $1 in the stock against $1 in the basket.

**Costs.** The basket’s trades as well as the stock’s.

**How it dies.** The stock’s specific moves have no counterpart in any basket; the spread is then a random walk.

**Horizon, capacity, infrastructure.** Weeks; a regression per stock per formation.

**Backtest honestly.** Weights fitted on formation data only; compare with the stock’s own [residual reversal](https://one-course.com/books/quant/8/en/chapter/2-short-term-reversal#def-s1-short-term-reversal-residual) (chapter 3).

**Sources.** This chapter’s simulation only; no public performance record verified.

## 4.7 Tutorial: the pair that never closed

**Goal.** Select pairs by distance, by Engle–Granger tests and by both; trade them; count the false discoveries. **End state:** the table and [Figure 4.2](#fig-s1-pairs-and-baskets-calib).

1. **The tests**: Engle–Granger vectorised over many pairs, p-values from a simulated null, Benjamini–Hochberg. `def eg_tau (y, x): y, x = np.asarray(y, float ), np.asarray(x, float ) xm, ym = x.mean(axis=0 ), y.mean(axis=0 ) beta = ((x - xm) * (y - ym)).sum(axis=0 ) / ((x - xm) ** 2 ).sum(axis=0 ) u = y - ym - beta * (x - xm) du, lag = np.diff(u, axis=0 ), u[:-1 ] rho = (lag * du).sum(axis=0 ) / (lag * lag).sum(axis=0 ) e = du - rho * lag se = np.sqrt((e * e).sum(axis=0 ) / (len (du) - 1 ) / (lag * lag).sum(axis=0 )) return rho / se def eg_null (T: int , reps: int = 20000 , seed: int = 4 ): rng = np.random.default_rng(seed) y = np.cumsum(rng.standard_normal((T, reps)), axis=0 ) x = np.cumsum(rng.standard_normal((T, reps)), axis=0 ) return np.sort(eg_tau(y, x)) def pvalue (tau, null): return np.searchsorted(null, np.asarray(tau, float ), side=" right " ) / len (null) def bh (p, q: float = 0.05 ): p = np.asarray(p, float ) order = np.argsort(p) m = len (p) ok = p[order] <= q * np.arange(1 , m + 1 ) / m out = np.zeros(m, bool ) if ok.any(): out[order[: np.flatnonzero(ok).max() + 1 ]] = True return out` **Listing 4.1.** The Engle–Granger statistic over many pairs, its null, and false-discovery control. code/firm/pairsel/firm_pairsel.py
2. **The rule**: open at two formation standard deviations, close at the crossing, positions drifting with returns. `def trade_pair (ra, rb, spread, sd: float , k: float = 2.0 , cost: float = 0.0 ): """spread[t] known at the close of t; open when |spread| > k sd (long the lower leg, short the higher, $1 each), close at the next change of sign; positions drift with returns; P&L of day t + 1 from positions set at t.""" ra, rb, spread = (np.nan_to_num(np.asarray(v, float )) for v in (ra, rb, spread)) T = len (spread) pnl = np.zeros(T) wa = wb = 0.0 side, trades, opened = 0 , 0 , 0 for t in range (T - 1 ): new = side if side != 0 and np.sign(spread[t]) != side: new = 0 if side == 0 and abs (spread[t]) > k * sd: new = int (np.sign(spread[t])) # +1: a above b, so short a and buy b if new != side: traded = abs (wa) + abs (wb) if new != 0 : wa, wb = -float (new), float (new) traded += 2.0 opened += 1 else : wa = wb = 0.0 pnl[t] -= cost * traded trades += 1 side = new pnl[t + 1 ] += wa * ra[t + 1 ] + wb * rb[t + 1 ] wa, wb = wa * (1 + ra[t + 1 ]), wb * (1 + rb[t + 1 ]) return pnl, trades, opened, side` **Listing 4.2.** The distance rule on one pair. code/firm/pairsel/firm_pairsel.py
3. **Run** `run(share, method)` for the five methods on both markets, `discoveries` , `calibration` , `takeover` and `fig_pairs.py` .

**What to change next.** Replace the Gaussian null by a bootstrap of each pair’s own residuals and recount; widen the planted spread to 5% and watch the [distance method](#def-s1-pairs-and-baskets-distance) lose its twins to low-volatility coincidences; close pairs whose leg is under a takeover offer.

## 4.8 Build: pair selection

**Purpose.** Selection of pairs by distance, cointegration and copula, and their trading rule, with the multiple-testing accounting that selection needs.

**Interface.** `normalise(P)`, `top_pairs(N, k)`, `eg_tau(y, x)`, `eg_null(T, reps, seed)`, `pvalue(tau, null)`, `bh(p, q)`, `trade_pair(ra, rb, spread, sd, k, cost)`, `copula_fit(ra, rb)`, `copula_h(fit, ra, rb)`, `twin(y, X, lam)`.

**Rules.** Formation data only in selection and scaling; every test counted; takeover and delisting returns in the legs.

**Acceptance tests.** `code/firm/pairsel/tests/`: distance finds planted near-copies; the null’s 5% quantile near MacKinnon’s value, the test’s power on a stationary spread and its size on random walks; Benjamini–Hochberg on a textbook example; the rule’s P&L by hand; the copula’s correlation and conditional probabilities; ridge weights; the inverse normal.

**Stretch.** A bootstrap null per pair; Johansen tests on baskets (Book 4’s `firm.coint`); stop-losses and takeover filters.

Sources and further reading

- E. Gatev, W. N. Goetzmann and K. G. Rouwenhorst, “Pairs trading: performance of a relative-value arbitrage rule”, *Review of Financial Studies* 19(3), 2006 (NBER working paper 7032, 1999).
- B. Do and R. Faff, “Does simple pairs trading still work?”, *Financial Analysts Journal* 66(4), 2010.
- C. Krauss, “Statistical arbitrage pairs trading strategies: review and outlook”, *Journal of Economic Surveys* 31(2), 2017.
- H. Rad, R. K. Y. Low and R. Faff, “The profitability of pairs trading strategies: distance, cointegration and copula methods”, *Quantitative Finance* 16(10), 2016.

## 4.9 Exercises

**Exercise 4.1 ★.**

Ten industries of 45 stocks each: how many same-industry pairs are there, and how many would a valid 5% test reject if none is cointegrated?

**Solution of Exercise 4.1.**

$10 \times \binom{45}{2} = 10 \times 990 = 9\,900$ pairs; a valid 5% test rejects about $9\,900 \times 0.05 = 495$ of them, all false.

**Exercise 4.2 ★.**

Benjamini–Hochberg at $q = 0.05$ with 1 000 tests: what p-value must the 20th smallest have for twenty rejections?

**Solution of Exercise 4.2.**

The procedure rejects the $k$ smallest where the $k$-th is at most $qk/m$: $0.05 \times 20/1000 = 0.001$.

**Exercise 4.3 ★.**

A pair is opened and closed once at five basis points per unit traded, $1 per leg. What does the round trip cost, in basis points of one leg?

**Solution of Exercise 4.3.**

Opening trades $1 in each leg and closing trades them again: four units at five basis points, 20 basis points of one leg.

**Exercise 4.4 ★★.**

The opening example’s formation standard deviation is 2.4%. At what spread did the pair open, and why did the takeover make it lose far more than that?

**Solution of Exercise 4.4.**

At $2 \times 2.4\% = 4.8\%$. The rule bets on convergence and has no stop: the takeover premium moved the short leg up by a quarter in a day, and the stock then stopped trading, so the spread could never come back. The loss is the premium, not the threshold.

**Exercise 4.5 ★★.**

Why does the [distance method](#def-s1-pairs-and-baskets-distance) favour pairs of low-volatility stocks, and why does that matter when the market has no substitutes?

**Solution of Exercise 4.5.**

The sum of squared differences is smallest for stocks whose prices move least, whatever their relation. Where substitutes exist they win the ranking (311 of 320 selections); where none exist, the ranking fills with quiet stocks whose paths stayed close by chance, and their spreads drift apart like any difference of random walks.

**Exercise 4.6 ★★.**

Explain how 97% of Benjamini–Hochberg’s discoveries can be false when the procedure is set to 5%.

**Solution of Exercise 4.6.**

The procedure controls the false discovery rate when the p-values of the true nulls are uniform (or conservative). Here they are not: fat tails and clustering volatility make the smallest p-values of the 745 000 null pairs far smaller than a uniform distribution would give, and those false pairs fill the list of discoveries ahead of the planted ones. The procedure is right; its input is wrong.

**Exercise 4.7 ★★★.**

*Coding.* Using `discoveries(0.1)`, compute the share of planted pairs among the pairs rejected again in the following year, and compare it with their share among the formation-year rejections.

**Solution of Exercise 4.7.**

Of the 4 020 pairs rejected again, 401 are planted, 10.0%; among the 58 024 formation-year rejections the planted share is 0.91%. Requiring persistence enriches the planted pairs elevenfold: a pair that stays cointegrated is much more likely to be real, which is the named result’s use.

**Exercise 4.8 ★★★.**

*Find the flaw.* “We tested all 50 000 same-industry pairs, kept those significant at 1% after a false-discovery correction, and backtested the survivors: Sharpe ratio 3.”

**Solution of Exercise 4.8.**

The false-discovery correction assumes calibrated p-values, which the Engle–Granger test does not provide on fat-tailed, heteroskedastic returns; the survivors are mostly false. And selecting by the same data used to report the Sharpe ratio overstates it. Check the test’s calibration on data with no cointegration, require persistence or an economic link, and report on a later period.

## 4.10 Problem: The Pair That Never Closed

**Problem 4.1.**

Weekend problem — selection is the strategy

The chapter’s five selection methods on `firm.synthmkt`, with and without planted substitutes.

**Part I — The methods.**

1. Define [pairs trading](#def-s1-pairs-and-baskets-pairs) and the [distance method](#def-s1-pairs-and-baskets-distance) ’s formation and [trading periods](#def-s1-pairs-and-baskets-distance) .
2. State Gatev, Goetzmann and Rouwenhorst’s rule and their headline result.
3. How do the cointegration and copula methods select and signal?
4. What did Rad, Low and Faff find, before and after costs?

**Part II — The synthetic test.**

5. What does `twin_share` plant, and why does the chapter need it?
6. How many planted pairs does each method select?
7. Give the net Sharpe ratios on both markets.
8. Describe the opening example and why the pair never closed.

**Part III — Testing at scale.**

9. How many tests does the chapter run, and how well calibrated are they?
10. What share of Benjamini–Hochberg’s discoveries is false, and why?
11. What does the two-step method do, and why does it not beat distance?
12. Why does the [synthetic twin](#def-s1-pairs-and-baskets-twin) lose?

**Part IV — The verdict.**

13. State the *named result* : the share of cointegrated pairs in the formation year that stay cointegrated in the trading year, and the pairs book’s Sharpe ratio after costs.
14. What does persistence reveal about true and false pairs?
15. What did Do and Faff find about the trend and about crises?
16. What replaced the classic pair?
17. How would you check a test’s calibration before using it at scale?
18. What would you require of a pair before trading it?
19. How would you protect a pairs book against takeovers?
20. In one sentence: what does a pairs strategy need from its market?

**Solution of Problem 4.1.**

1. Long the laggard and short the leader of two stocks that have moved together, closed when they converge; the [distance method](#def-s1-pairs-and-baskets-distance) selects pairs by the sum of squared differences of normalised prices over a [formation period](#def-s1-pairs-and-baskets-distance) and trades them over the next [trading period](#def-s1-pairs-and-baskets-distance) .
2. Twelve months’ formation, six months’ trading, open at two formation standard deviations, close at the next crossing, top 20 pairs; up to 11% a year in excess returns, 1962–2002.
3. Cointegration: an Engle–Granger test on the log prices, trading the residual; copula: a copula fitted to daily returns, trading an index of improbable joint moves.
4. 91, 85 and 43 basis points a month before costs for distance, cointegration and copula; 38, 33 and 5 after.
5. Fifty pairs of close substitutes whose log price spread is a stationary AR(1) (ten days, 2%); without them no pair on the synthetic market is real.
6. Distance and copula 311 of 320, two-step 113, Engle–Granger 40.
7. Twin market: 5.05, 3.89, 1.03, $-0.17$ , $-0.49$ ; default market: $-0.43$ , $-0.50$ , $-0.11$ , $-0.47$ , $-0.35$ .
8. Planted substitutes selected by distance, opened twice; on day 111 the short leg was taken over, the spread jumped to 35% and the pair lost 24.6% per dollar leg without closing.
9. 745 465 tests over sixteen cycles; at a nominal 5% they reject 7.4% of pairs where none is real, and at 0.1% three times the nominal rate.
10. 97.2%: miscalibrated p-values put false pairs ahead of the planted ones.
11. It ranks the 200 closest pairs by p-value, and within them the test still prefers its false rejections: 113 planted pairs, net 1.03.
12. A stock’s specific moves have no counterpart in its peers, so the spread against any basket is a random walk.
13. **Named result.** 7.9% of the pairs rejected at 5% in a formation year are rejected again the next year (84.6% of planted pairs, 7.2% of the others); the distance book nets a Sharpe ratio of 5.05 on the market with substitutes and $-0.43$ on the market without.
14. True pairs persist, false ones do so at about the test’s false-rejection rate, so persistence separates them.
15. A continuing downward trend in profitability, with strong performance in prolonged turbulence, including the 2008 crisis.
16. Residuals against factor models, structural relative value with contractual links, and broad books of small bets.
17. Run it on data where the null is true (shuffled pairs, or a simulation with the data’s tails and volatility) and compare rejection rates with nominal levels.
18. An economic reason to be a substitute, a spread that reverts on data not used to select it, and liquidity in both legs.
19. Screen for takeover bids and rumours, cap the loss per pair, close pairs whose leg is under offer, and diversify across many pairs.
20. Close substitutes whose prices are pulled back together by something other than their own past.

## 4.11 Interview questions

**Interview question 4.1 ★ researcher, trader.**

How would you choose pairs for a pairs-trading strategy?

**Solution of Interview question 4.1.**

Start from an economic link (the same business, share classes, a supplier and customer), then check the link in the data: distance or a cointegration test on a [formation period](#def-s1-pairs-and-baskets-distance), persistence on a later one, liquidity and borrow on both legs. Count every pair tested and hold out time for evaluation.

**Interview question 4.2 ★★ researcher.**

Correlation or cointegration for pairs: what is the difference, and which matters?

**Solution of Interview question 4.2.**

Correlation is about returns moving together day by day; cointegration is about prices staying together over time, a stationary spread. Two stocks can be highly correlated and drift apart, or weakly correlated day to day and still cointegrated. A pairs trade bets on the spread, so cointegration is what matters, and it is harder to establish.

**Interview question 4.3 ★★ researcher.**

You test 100 000 pairs for cointegration. How do you control false discoveries, and what can still go wrong?

**Solution of Interview question 4.3.**

Benjamini–Hochberg or a family-wise bound over all tests. What can still go wrong: p-values miscalibrated by fat tails and changing volatility (check them on null data); dependence between tests; and relationships that are real in the sample and break later. Require out-of-sample persistence.

**Interview question 4.4 ★★ risk, trader.**

One leg of an open pair receives a takeover bid. What do you do?

**Solution of Interview question 4.4.**

The pair’s premise is gone: close it, taking the loss if the target is the short leg, unless the book runs merger arbitrage deliberately (chapter 11). Then check the other pairs for exposure to the same deal or sector.

**Interview question 4.5 ★★ developer.**

Compute the sum of squared distances between the normalised prices of all pairs of 3 000 stocks efficiently.

**Solution of Interview question 4.5.**

With $N$ the $T \times n$ matrix of normalised prices, $D_{ij} = \|N_i\|^2 + \|N_j\|^2 - 2 N_i^\top N_j$: one matrix product $N^\top N$ ($3\,000 \times
3\,000$ from $T \times 3\,000$), then the upper triangle.

**Interview question 4.6 ★★★ researcher.**

A spread follows an AR(1) with coefficient $\phi$ and stationary standard deviation $\sigma$. What is the expected time to revert halfway, and how does the Dickey–Fuller test’s power depend on $\sigma$?

**Solution of Interview question 4.6.**

The expected deviation decays as $\phi^h$, so it halves after $h = \ln 2/(-\ln\phi)$ days. The Dickey–Fuller statistic is scale-invariant: its power depends on $\phi$ and the sample length, not on $\sigma$. A narrow spread is not easier to detect, only cheaper to trade relative to its moves.
