How We Found the S&P 500 / Mets Spurious Correlation
Why any two yes-or-no records can look like a relationship
Take any two yes-or-no records over the same days — coin flips, the market up or down, a team’s wins and losses — and one number, the phi coefficient, measures how closely one tracks the other. Phi runs from −1 (always opposite) through 0 (unrelated) to +1 (always together). Over 13 days, two records that have nothing to do with each other still wander off zero: a typical miss is about 0.29 either way.
Now test several teams and report the strongest. The best of six is not a typical draw; it is the most extreme one you found. That is the multiple-comparisons trap, and it is the engine behind every “Bears win, market falls” column you have ever read.
Issue #24 is a joke piece, but the joke does real teaching work. It said plainly that we tested six teams against the S&P 500 over the same 16 trading days and reported the strongest. Most columns like it hide the search. We named it.
The phi coefficient and why running it six times finds something
For two yes-or-no records (X, Y) over n days, build the 2×2 table:
| Y = 1 | Y = 0 | Row sum | |
|---|---|---|---|
| X = 1 | a | b | a+b |
| X = 0 | c | d | c+d |
| Col sum | a+c | b+d | n |
The phi coefficient is:
It is the ordinary correlation between two 0/1 variables. When the two are unrelated, its spread is about 1/sqrt(n). For the Mets’ 13 matched days, that is about 0.28; simulation of the actual setup gives 0.29.
Now run it for six teams against the S&P 500 over the 16 trading days from March 26 to April 17 (12 or 13 game days per team) and keep the largest, whatever its sign. Simulating six teams with no connection to the market at all:
So even with no real relationship anywhere, a search like ours turns up a phi as strong as the Mets’ almost one time in four. The right reading of “phi = −0.57, best of six” is “the most extreme result of a small search”, not “a connection.”
Worked example: the actual Mets vs. S&P run
Over the 16 trading days from March 26 to April 17, the Mets played on 13. They went 3–10 on those days; the S&P 500 rose on 10 of them and fell on 3.
| S&P up | S&P down | |
| Mets win | 1 (a) | 2 (b) |
| Mets loss | 9 (c) | 1 (d) |
Phi across six teams, and what noise would do
The full script, scripts/spurious-correlation.py, holds each day’s market direction and each team’s result, keyed by date, and keeps only the days that have both. This sample runs on that data, adds the exact test, and simulates what an unrelated team would produce.
import importlib.util, math, io, contextlib import numpy as np from scipy.stats import fisher_exact # Load the issue's data (dates -> 1/0) without printing its report spec = importlib.util.spec_from_file_location("sc", "scripts/spurious-correlation.py") sc = importlib.util.module_from_spec(spec) with contextlib.redirect_stdout(io.StringIO()): spec.loader.exec_module(sc) def table(team, market): days = sorted(set(team) & set(market)) # game days the market was open a = sum(team[d] == 1 and market[d] == 1 for d in days) b = sum(team[d] == 1 and market[d] == 0 for d in days) c = sum(team[d] == 0 and market[d] == 1 for d in days) d_ = sum(team[d] == 0 and market[d] == 0 for d in days) return a, b, c, d_ def phi(a, b, c, d): den = math.sqrt((a+b) * (c+d) * (a+c) * (b+d)) return (a*d - b*c) / den if den else 0.0 for name, games in sc.teams.items(): a, b, c, d = table(games, sc.sp500) p = fisher_exact([[a, b], [c, d]])[1] print(f"{name:22s} phi {phi(a, b, c, d):+.2f} exact p {p:.2f}") # New York Mets phi -0.57 exact p 0.11 ... next largest: Braves -0.30 # What six unrelated teams produce: coin-flip results on 13 days, market up 10 of 13 rng = np.random.default_rng(1) mkt = [1] * 10 + [0] * 3 best = [] for _ in range(20_000): sims = [] for _ in range(6): x = rng.integers(0, 2, 13) a = sum(xi == 1 and m == 1 for xi, m in zip(x, mkt)) b = sum(xi == 1 and m == 0 for xi, m in zip(x, mkt)) c = sum(xi == 0 and m == 1 for xi, m in zip(x, mkt)) d = sum(xi == 0 and m == 0 for xi, m in zip(x, mkt)) sims.append(abs(phi(a, b, c, d))) best.append(max(sims)) best = np.array(best) print(f"average best |phi|: {best.mean():.2f}") # about 0.47 print(f"best reaches 0.57: {(best >= 0.567).mean():.0%}") # about 23%
To run it on a different pair of records: swap in any two yes-or-no records keyed by date. Then be honest, like the article was, about how many candidates you tested — and run the noise simulation with that many.
Caveats and known limitations
- Six teams is a small search, and teams that play each other have linked results, so the six comparisons are not fully independent. Test all 30 and at least one false alarm at the 5% bar becomes close to certain.
- Thirteen days is short. Longer windows shrink what chance alone produces (the spread falls like 1/sqrt(n)).
- Trading days ≠ baseball days. We kept only dates with both a market close and a game: weekends, Good Friday and off days drop out, leaving 12 or 13 days per team.
- The article’s thesis is the joke. The method is real.
Read the article that uses this analysis: Want to Know If the Mets Lost? Check the S&P 500. →