Decomposing prediction error
Suppose with noise variance , and you fit a model on a random training set. At a new point , the expected squared error splits into three parts:
Simple models have high bias and low variance; flexible models the reverse. Adding parameters always lowers training error, but test error is U-shaped in model complexity.
Why finance is the hard case
In financial prediction the noise term is enormous compared with the signal. A model that explains 1% of the variance of returns is good. In that regime, variance dominates: a flexible model fits the noise, and its in-sample performance tells you almost nothing.
Some rules of thumb:
- Prefer few, economically motivated features over many mined ones.
- Expect out-of-sample performance to be much worse than in-sample, often by half or more.
- Treat every choice you made after seeing the data (features, look-back windows, thresholds) as a fitted parameter.
Regularisation
Regularisation trades a little bias for a lot less variance by penalising large coefficients.
- Ridge minimises , giving . It shrinks all coefficients towards zero and stabilises them when regressors are correlated.
- Lasso uses instead. It sets some coefficients exactly to zero, which selects features.
- Elastic net mixes the two.
Larger means more shrinkage: as every coefficient goes to zero, and at you recover OLS. Standardise features first so the penalty treats them equally.
Worked example
shrinking a noisy estimate
Across many stocks, true alphas are distributed with a year. For one stock, your estimate is the true alpha plus independent noise with standard deviation . Your estimate is . What is your best guess of the true alpha?
Show solutionHide solution
For jointly normal signal and noise, the posterior mean shrinks the estimate by the fraction of its variance that is signal:
Shrinking by 80% feels extreme, but it is correct here: most of the estimate's spread across stocks is noise. Ridge regression is this same idea applied to many coefficients at once.
Validating honestly
Cross-validation estimates out-of-sample error by fitting on some data and testing on the rest. For time series, ordinary random -fold leaks the future into the past. Use instead:
- Walk-forward validation: train on data up to time , test on the next block, roll forward.
- Purging and embargoes: drop training observations whose labels overlap the test period, plus a gap after it.
- A final hold-out that you look at only once.
Also watch for look-ahead bias (using information not available at decision time, such as revised data or the day's close), survivorship bias (testing only on companies that still exist), and data snooping (trying many ideas on the same data).
Worked example
the best of many random strategies
You backtest 100 strategies with no true edge, each over one year. Roughly what is the best annualised Sharpe ratio you should expect to see?
Show solutionHide solution
With one year of data, each strategy's measured Sharpe ratio is approximately (its standard error is about ). The expected maximum of 100 independent standard normals is about .
So a Sharpe of 2.5 from the best of 100 one-year backtests is what pure luck delivers. A rough guide for trials is , which gives about here and slightly overstates the true value for moderate .
Knowledge check
You add more and more features to a return-prediction model. What typically happens?
Knowledge check
Which validation scheme is most appropriate for a model that predicts tomorrow's return from today's data?
Knowledge check
What does ridge regression do as its penalty λ grows very large?
Practice problems
Finished reading?
Answer the 3 knowledge checks to complete this lesson (0 done).