Weighted Regression Mean-Reversion
Generalize cluster mean-reversion using weighted regression to remove systematic factor exposures. Trade residuals that are orthogonal to industry, sector, and style factors.
Overview
The weighted regression mean-reversion strategy extends simple cluster mean-reversion by using weighted least squares regression to remove multiple factor exposures simultaneously.
Instead of just subtracting the cluster mean, this approach regresses returns against a matrix of factor loadings Ω (industry dummies, style factors, etc.) using volatility-weighted regression. The residuals ε are orthogonal to all factors.
By weighting each stock by the inverse of its variance (z_i = 1/σ²_i), stocks with lower volatility receive more weight in the regression, producing more stable factor estimates and cleaner residuals for trading.
Key Insight
Research
Research on weighted regression approaches to statistical arbitrage and factor-neutral mean-reversion strategies.
The Mathematics
In Plain English
The math behind this strategy is straightforward. Here's what you're actually doing:
- 1Define factor loadings: Build matrix Ω where each column represents a factor (industry dummies, market beta, size, value, etc.).
- 2Set volatility weights: Create diagonal weight matrix Z with z_i = 1/σ²_i for each stock based on historical volatility.
- 3Run weighted regression: Regress returns R on factors Ω using weights Z to get factor exposures.
- 4Extract and trade residuals: Compute residuals ε orthogonal to all factors. Short positive residuals, buy negative residuals.
That's it. The formulas below just express this process precisely.
1Orthogonality Condition
Weighted residuals R̃ are orthogonal to all K factor columns in Ω.
2Weighted Residuals
Twiddled (weighted) returns equal weight matrix times raw residuals.
3Residual Calculation
Residuals after removing weighted factor exposures from returns.
4Weight Matrix
Diagonal matrix of weights, typically z_i = 1/σ²_i (inverse variance).
5Weighted Covariance
Weighted cross-product matrix of factor loadings.
6Sum Constraint
If intercept included in Ω, weighted residuals sum to zero automatically.
7Volatility Weights
Inverse variance weighting gives more weight to stable stocks in regression.
Why Weight by Inverse Variance?Note
Stocks with lower volatility provide more reliable information about factor exposures. Weighting by 1/σ² is equivalent to assuming homoskedastic residuals after scaling, making the regression estimates more efficient.
Strategy Rules
Factor Matrix Construction
- Include intercept column (vector of 1s) for market-wide mean
- Add industry/sector dummy variables (GICS sectors or finer)
- Optionally include style factors (beta, size, value, momentum)
- Ensure factors are not perfectly collinear
- Binary factors: 1 if stock belongs, 0 otherwise
Weight Calculation
- 1Estimate volatility σ_i for each stock (20-60 day lookback)
- 2Calculate weights z_i = 1/σ²_i
- 3Form diagonal matrix Z = diag(z_1, ..., z_N)
- 4Cap extreme weights to avoid instability
- 5Re-estimate weights periodically (weekly/monthly)
Regression & Residuals
- Compute Q = Ω^T Z Ω (K × K matrix)
- Compute Ω^T Z R (K × 1 vector of weighted covariances)
- Solve for factor returns: f = Q^{-1} Ω^T Z R
- Calculate residuals: ε = R - Ω f
- Weight residuals: R̃ = Z ε
Position Sizing
- 1Short stocks with R̃_i > 0 (positive weighted residual)
- 2Buy stocks with R̃_i < 0 (negative weighted residual)
- 3Size proportional to |R̃_i| or use rank-based sizing
- 4Verify factor neutrality: Σ R̃_i Ω_iA ≈ 0 for all A
- 5Rebalance when residuals change significantly
Implementation Guide
Implementing weighted regression mean-reversion requires constructing factor matrices, computing volatility weights, and solving the weighted least squares problem.
Build Factor Loading Matrix
Construct matrix Ω with N rows (stocks) and K columns (factors). The first column should be all 1s (intercept). Additional columns can be industry dummies (e.g., 11 GICS sectors), or continuous factors like beta and size.
- Start simple: intercept + industry dummies only
- Use GICS sector codes for industry classification
- For 500 stocks across 11 sectors, Ω is 500 × 12
Calculate Volatility Weights
Estimate each stock's volatility σ_i using 20-60 days of returns. Calculate weights z_i = 1/σ²_i. Very low volatility stocks get capped weights to prevent instability.
- Use exponentially weighted volatility for responsiveness
- Cap weights at 95th percentile to limit outliers
- Update weights weekly to balance stability and accuracy
Extremely low volatility stocks can dominate the regression. Always cap or winsorize weights.
Solve Weighted Regression
Compute Q = Ω^T Z Ω and the weighted cross-product Ω^T Z R. Solve for factor returns f = Q^{-1} Ω^T Z R. Then compute residuals ε = R - Ω f.
- Use numpy.linalg.solve() rather than explicit matrix inversion
- Check that Q is well-conditioned (condition number < 1000)
- Weighted residuals: R̃ = Z ε
Trade the Residuals
Sort stocks by weighted residuals R̃_i. Short the top decile (highest positive residuals), buy the bottom decile (most negative residuals). The portfolio is automatically neutral to all factors in Ω.
- Use decile or quintile cutoffs for cleaner portfolios
- Verify factor neutrality by checking Σ R̃_i Ω_iA ≈ 0
- Rebalance daily or when residuals cross zero
Execution Requirements
This strategy typically trades many stocks simultaneously across multiple sectors. Ensure your broker supports shorting across the universe and has reasonable borrow rates. Consider execution algorithms for large portfolios.
Helpful Tools & Resources
Strategy Variations
Explore different ways to implement this strategy, each with its own trade-offs and benefits.
Industry-Only
Use only industry dummies in Ω. Simplest implementation, removes sector exposure.
Multi-Factor
Add style factors (beta, size, value). More thorough factor removal but requires more data.
PCA-Based
Use principal components instead of named factors. Data-driven factor discovery.
Equal Weighted
Set all z_i = 1. Simpler but less efficient if volatilities vary significantly.
Risks & Limitations
If important factors are omitted from Ω, residuals will still contain systematic exposure.
Extreme weights from low-volatility stocks can cause erratic regression estimates.
Too many factors relative to stocks can overfit, leaving little signal in residuals.
Volatility estimates are noisy. Weight errors propagate to residual calculations.
Large portfolios with many positions require sophisticated execution infrastructure.
References
- Avellaneda, M., & Lee, J.-H. (2010). Statistical Arbitrage in the US Equities Market. Quantitative Finance, 10(7), 761-782 [Link]
- Kakushadze, Z. (2016). 101 Formulaic Alphas. Wilmott Magazine, 2016(84), 72-81 [Link]
- Connor, G., & Korajczyk, R. A. (1988). Risk and Return in an Equilibrium APT. Journal of Financial Economics, 21(2), 255-289 [Link]
- Ledoit, O., & Wolf, M. (2004). Improved Estimation of the Covariance Matrix of Stock Returns. Journal of Empirical Finance, 10(5), 603-621 [Link]
Ready to Explore More Strategies?
Access our complete library of academic-backed trading strategies across stocks, options, ETFs, and more.
Browse All Stock Strategies