Skip to content

test: pin estimators to reference values - #559

Open
WatchTree-19 wants to merge 1 commit into
ranaroussi:mainfrom
WatchTree-19:test/reference-values
Open

WatchTree-19 wants to merge 1 commit into
ranaroussi:mainfrom
WatchTree-19:test/reference-values

Conversation

@WatchTree-19

@WatchTree-19 WatchTree-19 commented Sep 28, 2026 •

Copy link
Copy Markdown

Adds tests/test_reference_values.py: eleven stats functions checked against the convention each one implements, on five fixed return series (Bacon's 2008 24-month portfolio, a seven-point sample, Gaussian, Student t(3) and left-skewed daily series), 56 cases.

Eight of the eleven expected values are R PerformanceAnalytics 2.1.0 output, and the exact R call is recorded beside each metric in tests/data/reference_values.json (volatility, CAGR, Sharpe, max drawdown, Calmar, Omega, skewness, kurtosis). Sortino and the Gaussian VaR and CVaR, which PerformanceAnalytics computes differently, were checked against numpy, scipy or a brute-force definition. All pass on main today, so this changes no behaviour; it means a future change to an estimator fails a named test instead of shifting numbers silently. Changing the sample volatility, the VaR standard deviation or the skewness estimator by even 1e-6 each fails five cases.

Test-only, no new dependencies. The Ulcer index is left out here because it needs #558; it is one entry to add once that lands. Values come from https://github.com/WatchTree-19/vetted.

Adds tests/test_reference_values.py, which checks eleven stats functions
against the convention each one implements (sample volatility,
geometric CAGR, Sharpe, Sortino, drawdown, Calmar, Gaussian VaR and
CVaR, Omega, adjusted skewness and excess kurtosis) on five fixed return
series, including the 24-month portfolio from Bacon (2008).

Eight of the eleven are R PerformanceAnalytics 2.1.0 output; the R call
is recorded beside each metric in tests/data/reference_values.json. The
other three were checked against numpy, scipy or a brute-force
definition. A change to any estimator now fails a named test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant