Hypothesis Testing
The Neyman–Pearson framework for deciding between hypotheses under uncertainty, type I and II errors, power, the most-powerful-test lemma, and the likelihood-ratio test that generalizes it.
Prerequisites: Maximum Likelihood Estimation (MLE), The Central Limit Theorem
A hypothesis test is a decision rule under uncertainty: given noisy data, decide whether to reject a default claim. For a quant this is the machinery that separates a real edge from a lucky backtest, is this strategy's Sharpe genuinely positive, is this factor loading real, does this series have a unit root? The Neyman–Pearson framework makes the decision, and its accounting of the two ways you can be wrong is the part most people get sloppy about and desks pay for.
The setup: null, alternative, and two errors
State a null hypothesis (the skeptical default, "no edge," ) and an alternative . A test is a rule that maps the data to {reject, don't reject} , defined by a rejection region. Because the data are random, two errors are possible:
| true | true | |
|---|---|---|
| Reject | Type I error () | correct |
| Don't reject | correct | Type II error () |
The type I error rate (size, significance level) is , a false discovery. The type II error rate is , a missed discovery. The power is , the probability of catching a real effect. The Neyman–Pearson philosophy is asymmetric: fix at a tolerable level (say 5%), then find the test that maximizes power.
Constructing a test statistic
The standard recipe: form a test statistic whose distribution under is known, and reject when lands in the tail. For a sample mean with known variance, the -statistic
by the The Central Limit Theorem. A two-sided test at level rejects when (e.g. for ). When is estimated, follows a distribution. The rejection threshold is the critical value; comparing to it is mechanically identical to comparing a p-value to .
The Neyman–Pearson lemma
For a simple null against a simple alternative , which test is most powerful at level ? The Neyman–Pearson lemma answers definitively: the most powerful test rejects when the likelihood ratio exceeds a threshold,
with chosen so the size is exactly . The intuition is exactly right, reject in favor of precisely where the data are relatively more probable under than under , and rank observations by that ratio. Every optimal test in classical statistics is, at bottom, a likelihood-ratio comparison.
The likelihood-ratio, Wald, and score tests
Real hypotheses are usually composite (e.g. , or nested models). The generalized likelihood-ratio test uses
the ratio of the best fit under the null to the best fit overall. Wilks' theorem gives its asymptotic null distribution: , where is the number of restrictions. This is the standard way to test whether adding parameters (an extra factor, a GARCH term) significantly improves fit. Two asymptotically equivalent cousins complete the "holy trinity":
- Wald test, estimate the unrestricted model and check whether the restriction is far from satisfied, scaled by the estimate's covariance: . The ordinary - and -statistics are Wald tests.
- Score (Lagrange multiplier) test, estimate only the restricted model and check whether the score is far from zero there. Cheap when the restricted model is easy to fit; the standard ARCH and Breusch–Pagan tests are LM tests.
All three agree asymptotically but can differ in finite samples; Wald is sensitive to how the restriction is parameterized, LR is invariant.
Worked example: is a strategy's Sharpe positive?
A strategy returns a mean with sample volatility over periods. Test against . The -statistic is , the -stat is just the annualized-appropriately Sharpe times the root of the sample size. With a Sharpe of (annual) over 4 years, : not close to the one-sided threshold. To get at Sharpe you need about 11 years. This computation is why claims of "significant" edge from short backtests deserve suspicion, the power to detect realistic Sharpes is low, and the multiple-testing inflation of (below) makes the false-discovery problem worse.
Failure modes in financial data
- Autocorrelation destroys the null distribution. The formula assumes i.i.d. returns; serial correlation and overlapping windows make the true standard error larger, so naive -stats over-reject. Use HAC (Newey–West) standard errors. See Autocorrelation and Serial Correlation.
- Low power is the norm. Real edges are small and data are short; most honest tests of trading signals are badly underpowered, so "failed to reject" almost never means "no effect."
- Non-standard distributions under the null. Testing on the boundary (a variance , a unit root) breaks the usual /normal asymptotics, Dickey–Fuller statistics have their own tables precisely for this reason. See Unit Roots and the ADF Test.
- Data snooping. Choosing the hypothesis after seeing the data, or testing thousands of signals, invalidates the fixed- guarantee entirely. This is the single biggest inferential danger in quant research. See p-values and Multiple Testing and Overfitting.
In interviews
Define type I and type II errors precisely and without hesitating, swapping them is an instant tell. Explain that you fix and then maximize power, and be able to state the Neyman–Pearson lemma (most powerful test is a likelihood-ratio threshold). Know the trinity, LR, Wald, score, and one distinguishing fact each (Wald needs only the unrestricted fit, score needs only the restricted fit, LR needs both and is parameterization-invariant). The killer applied question is "your backtest shows , are you convinced?" and the graduate answer names autocorrelation-inflated standard errors and multiple testing before celebrating.
Related concepts
Practice in interviews
Further reading
- Casella & Berger, Statistical Inference (Ch. 8)
- Lehmann & Romano, Testing Statistical Hypotheses
- Greene, Econometric Analysis (Ch. 5)