numeraire.core.stats#
Inference primitives for asset-pricing evaluation (pure numpy/scipy, no heavy deps).
Small, closed-form statistical tests the evaluator layer and reference-result tests build on:
grs_test()— Gibbons-Ross-Shanken (1989) joint zero-alpha F-test of a factor model on a set of test assets (exact small-sample F under i.i.d. normal errors).sharpe_diff_test()— Jobson-Korkie (1981) paired Sharpe-ratio difference z-test with the Memmel (2003) variance correction (the convention of the 1/N-style horse races).clark_west_test()— Clark-West (2007) MSPE-adjusted test for nested forecast comparisons (the companion to the Goyal-Welch OOS R²; plain Diebold-Mariano is oversized for nested models).alpha_regression()— time-series alpha vs a factor benchmark with HAC (Newey-West) standard errors (the volatility-managed-portfolio-style headline regression).fama_macbeth()— Fama-MacBeth (1973) two-pass cross-sectional risk-premia estimation with FM t-statistics, optional Shanken (1992) errors-in-variables and Newey-West corrections.adjust_pvalues()— multiple-testing adjustments for factor-zoo sweeps (Bonferroni, Holm, Benjamini-Yekutieli), the Harvey-Liu-Zhu (2016) toolbox behind the “t > 3.0” hurdle.newey_west_lrv()— the shared Bartlett-kernel long-run variance helper.
The mean-variance economic-value family (the 1/N-horse-race metrics):
certainty_equivalent()— DeMiguel-Garlappi-Uppal (2009) eq. 12 certainty-equivalent return of a strategy’s realized returns (mean - gamma/2 var); their headline utility metric.return_loss()— DGU (2009) eq. 17 return-loss of a strategy vs a benchmark (the extra return the benchmark’s Sharpe line delivers at the strategy’s risk, net of the strategy’s mean).performance_fee()— Fleming-Kirby-Ostdiek quadratic-utility performance fee: the per-period fee equatingE[U(benchmark)]andE[U(candidate - fee)].
All functions take plain arrays/frames and return frozen result dataclasses (or a scalar for the
economic-value metrics); evaluator classes in numeraire.core.evaluators adapt them to OOS
outputs and the tidy result schema.
Gibbons-Ross-Shanken (1989) test that all time-series alphas are jointly zero. |
|
GRS joint zero-alpha test: |
|
Jobson-Korkie (1981) z-test of equal Sharpe ratios with the Memmel (2003) correction. |
|
Paired Sharpe difference: |
|
Clark-West (2007) MSPE-adjusted test for nested models. |
|
Clark-West MSPE-adjusted comparison of nested forecasts (one-sided: model beats bench). |
|
OLS of portfolio (excess) returns on factor returns; HAC (Bartlett) coefficient errors. |
|
Time-series alpha regression |
|
Multiple-testing adjustment for a family of tests (Harvey-Liu-Zhu 2016 §4.4 toolbox). |
|
Multiple-testing adjustment over a family of p-values (original input order). |
|
Bartlett-kernel long-run variance of a 1-D series ( |
|
DGU (2009) eq. |
|
DGU (2009) eq. |
|
Quadratic-utility performance fee (Fleming-Kirby-Ostdiek; Kirby-Ostdiek 2012 eq. |