Sharpe Ratio Difference Test
Test whether the Sharpe ratio of each asset differs from that of the benchmark: is the difference in risk-adjusted return more than the estimation error of two Sharpe ratios measured on the same dates?
Two Sharpe ratios measured over a year of daily returns are both estimates, and because the two assets move together their errors are correlated, which a comparison of two separate standard errors ignores. Jobson and Korkie (1981) derived the standard error of the difference for jointly normal returns, which Memmel (2003) corrected. Ledoit and Wolf (2008) showed that this test is unreliable when returns have fat tails or are serially correlated, as daily returns usually are, and replaced its standard error with a heteroskedasticity and autocorrelation consistent (HAC) one by the delta method.
The formulas are as follows, with n the number of dates both have an excess return:
\[\text{Memmel:}\;\; z = \frac{\text{SR}_{a} - \text{SR}_{b}}{\sqrt{\frac{2 - 2 \rho + \frac{\text{SR}_{a}^{2} + \text{SR}_{b}^{2} - 2 \cdot \text{SR}_{a} \cdot \text{SR}_{b} \cdot \rho^{2}}{2}}{n}}}\] \[\text{Ledoit-Wolf:}\;\; z = \frac{\Delta}{\sqrt{\frac{\text{∇f'} \Psi \text{∇f}}{n}}},\;\; \text{with}\;\; \Delta = f(v) = \frac{\mu_{a}}{\sqrt{\gamma_{a} - \mu_{a}^{2}}} - \frac{\mu_{b}}{\sqrt{\gamma_{b} - \mu_{b}^{2}}}\] \[\text{∇f} = \left(\frac{\gamma_{a}}{c_{a}},\; - \frac{\gamma_{b}}{c_{b}},\; - \frac{\mu_{a}}{2 \cdot c_{a}},\; \frac{\mu_{b}}{2 \cdot c_{b}}\right),\;\; \text{with}\;\; c = (\gamma - \mu^{2})^{\frac{3}{2}}\] \[\Psi = \frac{n}{n - 4} \cdot \left(\Gamma(0) + \sum_{j=1⟪\ldots \;\text{L\}⟫} \left(1 - \frac{j}{L + 1}\right) \cdot (\Gamma(j) + \Gamma(j)')\right),\;\; \Gamma(j) = \frac{\Sigma_{t} y(t) \cdot y(t - j)'}{n}\] \[y(t) = (r_{a}(t) - \mu_{a},\; r_{b}(t) - \mu_{b},\; r_{a}(t)^{2} - \gamma_{a},\; r_{b}(t)^{2} - \gamma_{b})\] \[\text{P-Value} = 2 \cdot (1 - \Phi(\left|z\right|))\]Where SR is the Sharpe ratio of one observation (mean over standard deviation with n - 1 in the denominator, of the daily excess returns, as get_sharpe_ratio before annualizing), \(\rho\) the correlation of the two excess returns, \(\mu\) and \(\gamma\) the means of the excess returns and of their squares, \(\Psi\) the Bartlett (Newey-West) estimate of their long-run covariance with L lags and \(\Phi\) the standard normal distribution. A low p-value (e.g. below 0.05) means the Sharpe ratios differ significantly; a positive Sharpe Difference that the asset’s Sharpe ratio is the higher one.
Also known as: Jobson-Korkie test, Memmel test, Ledoit-Wolf test, Sharpe ratio equality test, Sharpe ratio significance test.
Example · 2021 to 2025
Install the Finance Toolkit with pip install financetoolkit -U, then call get_sharpe_ratio_difference_test:
from financetoolkit import Toolkit
toolkit = Toolkit(
"MSFT",
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2021-01-01",
end_date="2025-12-31",
)
toolkit.performance.get_sharpe_ratio_difference_test(method="ledoit_wolf")["MSFT"]
Or, with the Finance Toolkit MCP set up, ask an AI assistant such as Claude or ChatGPT:
Was Microsoft's Sharpe ratio significantly different from the S&P 500's in any year from 2021 to 2025, using the Ledoit-Wolf test?
Which returns:
| Item | Sharpe Difference | Standard Error | Z-Statistic | P-Value |
|---|---|---|---|---|
| 2021 | 0.0088 | 0.0509 | 0.1723 | 0.8632 |
| 2022 | -0.0007 | 0.0326 | -0.0218 | 0.9826 |
| 2023 | 0.0160 | 0.0556 | 0.2881 | 0.7733 |
| 2024 | -0.0632 | 0.0460 | -1.3738 | 0.1695 |
| 2025 | -0.0111 | 0.0478 | -0.2329 | 0.8158 |
5 rows
Parameters
get_sharpe_ratio_difference_test accepts the following parameters.
| Parameter | Type | Description | Example |
|---|---|---|---|
period | str | The period to use for the calculation. Options are: “daily”, “weekly”, “monthly”, “quarterly”, “yearly”. Defaults to “quarterly” if the Toolkit is initialised with quarterly=True, otherwise “yearly”. | "weekly" |
method | str | The test. Options are: “memmel” (the Jobson-Korkie test with Memmel’s correction), “ledoit_wolf” (the HAC test of Ledoit and Wolf). Defaults to “memmel”. | "memmel" |
lags | int | The number of lags L in the Newey-West covariance, only used when method=”ledoit_wolf”. Defaults to None, which uses the Newey and West (1994) rule floor(4 * (n / 100)^(2/9)), 4 for a year of daily returns. | 2 |
rounding | int | None | The number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise). | 2 |
show_columns | str | list[str] | None | The columns to keep, a name or a list of names, matched on every column level, or the rows when no column has those names (such as the line items of a financial statement). Names that do not exist are logged, and when none exist the result is returned in full. Defaults to None, which keeps every column. | None, which keeps every column |
References
- Paper Jobson, J.D. and Korkie, B.M. (1981). “Performance Hypothesis Testing with the Sharpe and Treynor Measures.” Journal of Finance, 36(4), 889-908.
- Paper Memmel, C. (2003). “Performance Hypothesis Testing with the Sharpe Ratio.” Finance Letters, 1, 21-23.
- Paper Ledoit, O. and Wolf, M. (2008). “Robust Performance Hypothesis Testing with the Sharpe Ratio.” Journal of Empirical Finance, 15(5), 850-859.
- Paper Newey, W.K., & West, K.D. (1987). “A Simple, Positive Semi-Definite, Heteroskedasticity and Autocorrelation Consistent Covariance Matrix.” Econometrica, 55(3), 703-708.