Wright Sign Test

The Wright Sign Test (S1) of Wright (2000) is the variance ratio test on the signs of the returns. A sign is +1 or -1 whatever the size of the return, so the test is exact in any sample and, unlike the rank tests, stays valid when volatility clusters: it only needs returns that are as likely to rise as to fall, whatever their past.

The formula for the Wright Sign Test first replaces each return \(r_{t}\) by its sign:

\[s_{t} = 1 \quad \text{if } r_{t} > 0\] \[s_{t} = -1 \quad \text{if } r_{t} \leq 0\]

The statistic \(S_{1}\) is the variance ratio of the signs over the n periods: the variance of the sums of q consecutive signs over q times the variance of a single sign, minus 1 and divided by its standard deviation sqrt(phi(q)):

\[S_{1} = \frac{\frac{\frac{\sum_{t=q}^{n} \sum_{j=0}^{q - 1} s_{t-j}^{2}}{n \cdot q}}{\frac{\sum_{t=1}^{n} s_{t}^{2}}{n}} - 1}{\sqrt{\phi(q)}}\] \[\phi(q) = \frac{2 \cdot (2 \cdot q - 1) \cdot (q - 1)}{3 \cdot q \cdot n}\]

The variance ratio of the signs is \(1 + S_{1} \cdot \sqrt{\phi (q)}\). The p-value is two-sided and comes from the exact distribution of \(S_{1}\) when every sign is +1 or -1 with equal probability, simulated with random signs. A positive statistic with a p-value below the significance level means rises follow rises and falls follow falls more often than chance. The signs ignore the size of the returns, which costs power, and a strong drift, which makes rises more likely than falls, breaks the assumption of equal probabilities.

A variance ratio test asks whether prices follow a random walk: if returns are uncorrelated, the variance of returns over q periods is q times the variance of single-period returns, and their ratio is 1. The null hypothesis is that random walk, the alternative that returns are autocorrelated over the horizon. A ratio above 1 means that moves tend to continue (momentum, trending), a ratio below 1 that they tend to reverse (mean reversion). The ratio sums up the autocorrelations of all lags up to q in one number, which makes it more powerful against slow, persistent patterns than a test of a single autocorrelation. A p-value below the chosen significance level (such as 0.05) rejects the random walk; a higher p-value means the returns are consistent with it at that horizon.

Also known as: S1 test, Wright’s sign test, sign variance ratio test.

In the Finance Toolkit this is get_variance_ratio_test with method="wright_sign", the same function as Variance Ratio Test.

Example · XLE, XLF, XLK · 2021 to 2025

Install the Finance Toolkit with pip install financetoolkit -U, then call get_variance_ratio_test:

from financetoolkit import Toolkit

toolkit = Toolkit(
    ["XLE", "XLF", "XLK"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2021-01-01",
    end_date="2025-12-31",
)

toolkit.econometrics.get_variance_ratio_test(method="wright_sign")

Which returns:

Using Your Own Data

get_variance_ratio_test runs on any data, not only prices: ratios, economic indicators, yield curves or your own dataset. Pass a DataFrame, a Series or a dictionary of them to Econometrics as data, with the dates in the rows or the columns, and set changes to how its changes are calculated: "percentage", "log", "difference" for rates and ratios, or None when the data are changes already. For example, for the monthly unemployment rates of the United States and Germany:

from financetoolkit import Economics, Econometrics

economics = Economics(start_date="2000-01-01")

unemployment = economics.get_unemployment_rate(
    countries=["United States", "Germany"], period="monthly"
)

econometrics = Econometrics(data=unemployment, changes="difference")

econometrics.get_variance_ratio_test()

References

  • Paper Wright, J.H. (2000). “Alternative Variance-Ratio Tests Using Ranks and Signs.” Journal of Business & Economic Statistics, 18(1), 1-9.
Share