Open Family Office Datasets Tickers Strategies Portfolios Research Posts About Changelog

Machine Learning in Asset Pricing

Source

Citation. Stefan Nagel (University of Chicago). Machine Learning in Asset Pricing. Princeton Lectures in Finance, Princeton University Press, Princeton and Oxford, 2021. ISBN 978-0-691-21870-0, e-book ISBN 978-0-691-21871-7. An expanded version of the Princeton Lectures in Finance that Nagel gave in May 2019. Chapter 4 is "an abbreviated and adapted version" of Kozak, Nagel and Santosh (2020), "Shrinking the Cross-Section", Journal of Financial Economics. The preface thanks the Center for Research in Security Prices (CRSP) for financial support. No code or data are released with the book.

Status. Planned. The repo already judges a strategy by its portfolio's returns, out of sample, as the book advises. But a strategy that tunes a penalty by cross-validation inside its own code runs a search that the trial ledger doesn't count. #435 would make such a search count as trials.

Read. Read on 2026-11-28 from a PDF of the published book that the maintainer supplied, an EBSCO library e-book of 157 pages with a text layer. Two subagents read the extracted text in full: chapters 1–3, and chapters 4–6. I checked their quotes and the two tables against the text. The equations came out garbled, so they are described in words. The figures came out as axis labels only, so no number on this page comes from a figure. The bibliography and the index weren't read.

Summary

Claim. Asset pricing has handled many predictors "by imposing ad hoc sparsity". Machine learning can do better, but "off-the-shelf application of ML methods without careful adaptation" is "unlikely to produce good results". Economics should set the prior, and Bayesian statistics is the bridge between the two.

Method.

Findings, as the book reports them.

Setting Result Where
Past returns, OLS, scored on the CV folds in-sample R² 5.22%, CV R² −1.18%, portfolio Sharpe 0.35, annualised Table 3.2
The same, ridge, unequal scaling R² 2.69% and 1.18%, Sharpe 0.37 Table 3.2
The same, lasso, unequal scaling R² 3.55% and 0.84%, Sharpe 0.36 Table 3.2
Ridge in 20-year rolling windows, from 1956 out-of-sample R² "close to zero" over the last 10–15 years of the sample Ch. 3, Figure 3.3
50 anomalies, characteristics-sparse "a characteristics-sparse SDF with good pricing performance does not exist" Ch. 4
50 anomalies, principal components "a PC-sparse SDF prices the anomaly portfolios quite well" Ch. 4
Out-of-sample alpha, 2005–2017, 50 anomalies' SDF 12.35% (SE 5.26) against the CAPM, 4.60% (2.22) against a five-PC model Table 4.1
The same, 80 ratios' SDF 20.05% (5.26) against the CAPM, 3.63% (2.93) against a five-PC model Table 4.1
Learning investors, in-sample test rejects the null of rational expectations with probability 1 in the limit Ch. 5

Where the claims go beyond the evidence

The penalty is chosen on the data it is judged by. The R² on the CV folds, at the chosen penalty, is "typically an upward-biased estimate of the true OOS R2". The author says so. Chapter 3 says it too: "the CV R² may still be prone to overfitting because we picked the penalty to minimize it". Table 3.2 comes from the CV folds, not from held-out data. Only chapter 4's 2005–2017 test is fully held out, and that is one period.

One market, one period for the final test. Every result is on US stocks from CRSP. The held-out test is 13 years, and its alphas have standard errors of 2 to 5 points. The author calls the precision with interactions "quite low".

No costs. Chapter 4 leaves trading costs out, and only cites papers that study them. The out-of-sample alphas are gross, on long-short portfolios of 50 to 1,375 factors, rebalanced monthly.

No count of the methods tried. The book compares OLS, ridge, lasso, the elastic net, two scalings and two tuning targets on the same data. It doesn't count that search, or correct for it. It does say that choosing among methods this way runs "into the no-free lunch problem".

The prior's form is a choice. Shrinking the low-variance components hardest rests on the absence of near-arbitrage. The author calls the assumption behind its simplest form "a strong assumption". He also says κ, the prior's scale, can't be set by economics, so cross-validation sets it.

Credit. The author names nearly every limit above himself. He says the book "does not offer cookbook recipes". He also says the past-returns model "is not meant to be representative" of a working strategy. Chapter 5's warning, that in-sample predictability may only show investors learning, cuts against much of the literature that the book builds on.

Use in this repo

The repo judges the portfolio, not the forecast's R². The book says "R2 measures can be quite misleading as indicators of portfolio performance". It also says "improvement of the OOS R2 is not a guarantee" of better portfolios. The verdict judges a strategy's returns, after costs, with DSR and StepM on its alpha (verdict.py, PROTOCOL_VERSION 2). Forecasts are scored separately, with proper scoring rules (scoring.py, #109). So the harness already reports what the book prefers. The book never mentions the information coefficient.

A strategy's own tuning is a search that the ledger can't see. The book picks each penalty by cross-validation, and warns that the pick overfits. The trial ledger counts each strategy and parameter set that the harness runs (trials.py, #7). But a strategy whose code chooses a penalty, a lag or a window by cross-validation runs its own search inside one trial. DSR then deflates for too few trials. #435 asks that such a search declare its grid, and that each point of the grid count as a trial.

The held-out test must hold out the tuning too. Chapter 4 chose everything, the penalty included, on data to 2004, and tested on 2005–2017. That is the repo's order too: the backtest chooses, then the paper trade tests (#32). The book's warning is that a penalty tuned on the whole sample, then "tested" on part of it, is not a test.

Shrinkage and multiple testing answer different questions. The book handles the factor zoo by shrinking every factor's weight in one SDF. Factors that are spurious are shrunk, "For data-mined spurious anomalies, there is no economic reason" for them to load on the high-variance components. The repo corrects for the search instead: DSR for the trials, StepM for the family, and Benjamini–Hochberg for the dependency graph (graph.py, #187). A strategy that combines many signals would need the book's approach. None does yet.

Few signals may not be enough. The book finds no sparse model in the characteristics: "there is almost no redundancy among the 50 anomalies". A strategy that picks a few signals from many leaves most of the information out. It also picks them on the same data, which is a search of its own. The registry has no strategies yet. novy-marx-multiple-signals.md makes the same point about combining signals.

Learning investors make the point-in-time data essential. Chapter 5 shows that "in-sample predictability tests lose their usual economic meaning" when investors learn. Only out-of-sample predictability, with data that investors had at the time, says anything. The store reads each series as it was known (Store.as_of, #295). A precomputed feature is checked for look-ahead (pointintime.py, #370). The book's one exception, variables "not available to investors at the time", is what those checks are for.

Expect decay. The book reports "a substantial decay in return predictability from in- to out-of-sample". It also says the anomalies "experienced significant deterioration" late in the sample. That matches McLean and Pontiff's 26% decay out of sample and 58% after publication (post-publication-decay.md). A backtest's edge should be expected to shrink in the paper trade.