Estimating Residual Mean Reversion for Statistical Arbitrage Signals
Summary
The document examines an attempt to reproduce the residual-process signal in the Avellaneda and Lee statistical arbitrage framework. The proposed workflow standardizes stock and ETF returns, regresses stock returns on ETF returns, fits an AR(1) model to the regression residuals, and uses its coefficients and residual variance in a signal formula. The author reports that the resulting signals look implausible on actual data.
Responses point to possible modeling and implementation problems: the framework is described as treating the cumulative residual process as mean reverting, while the attempted setup may imply different assumptions; one response also flags look-ahead bias from standardizing with full-sample means and standard deviations. The document offers troubleshooting suggestions, not a corrected derivation or empirical validation. Simulated independent return series are used in the example, so the text does not establish that the signal works on live or historical trading data. Careful alignment of the modeled process and strictly backward-looking estimates remain central caveats.
Key ideas
- The described signal is built from regression residuals and an AR(1) fit.
- The Avellaneda and Lee method is characterized in a response as modeling cumulative residuals as mean reverting.
- Standardizing returns with full-sample statistics can introduce look-ahead bias.
- The example uses simulated returns and does not validate the signal on market data.
- The discussion identifies possible issues but does not provide a complete corrected implementation.
Tags
Full text
# Statistical Arbitrage, Avellaneda & Lee - Estimation of the Residual Process # Statistical Arbitrage, Avellaneda & Lee - Estimation of the Residual Process I am trying to calculate the trade signal outlined in Avellaneda & Lee paper "Statistical Arbitrage in the US Equities Market". They describe their approach in appendix. Here is my attempt on simulated data: ``` # Simulate returns window = 60 np.random.seed(42) stock_returns = np.random.normal(0.0005, 0.01, window) etf_returns = np.random.normal(0.0004, 0.008, window) # Standardize stock_returns_standardised = (stock_returns - stock_returns.mean())/stock_returns.std() etf_returns_standardised = (etf_returns - etf_returns.mean())/etf_returns.std() # Run regression of stock returns on ETF returns etf_returns_with_const = sm.add_constant(etf_returns_standardised) model = sm.OLS(stock_returns_standardised, etf_returns_with_const) results = model.fit() # Calculate the residuals from the regression (idiosyncratic returns) residuals = results.resid # Fit an AR(1) model to the residuals ar_model = AutoReg(residuals, lags=1) ar_results = ar_model.fit() # Obtain the autocorrelation coefficients 'a' and 'b' from the AR(1) model a = ar_results.params[0] b = ar_results.params[1] # Calculate the signal s_score = -a * np.sqrt(1 - b**2) / ((1 - b) * np.sqrt(np.var(residuals))) ``` There is some issue with this calculation as visually the signals time series does not make sense to me when I apply the logic to my actual data. As many of the concepts here are new to me, I would appreciate any help with correcting my approach. ## Answer by Newquant (score 1) https://quant.stackexchange.com/a/77286 From memory they assume that the sum of residuals is a mean reverting process, whereas your code assumes a random walk in the residuals + no correlation between the stock and ETF return process. I would suggest attempting this using actual trading data from Yahoo or other free resources. ## Answer by time to bounce (score 0) https://quant.stackexchange.com/a/79284 if i'm reading your code correctly, you have look forward bias. in the second block of code, you use the mean and stdv of the entire return series, rather than a backwards looking measure of those metrics
Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.