StocksAdvancedFactor Neutral

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.

Factors
K loadings
Weights
z_i = 1/σ²
Position
Factor-neutral
Rebalance
Daily/Weekly

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

Multi-Factor Removal
Orthogonal to K factors
Volatility Weighted
z_i = 1/σ² weighting
Larger bubbles (lower volatility) contribute more to regression. Trade residuals: short positive R̃, long negative R̃.

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:

  1. 1
    Define factor loadings: Build matrix Ω where each column represents a factor (industry dummies, market beta, size, value, etc.).
  2. 2
    Set volatility weights: Create diagonal weight matrix Z with z_i = 1/σ²_i for each stock based on historical volatility.
  3. 3
    Run weighted regression: Regress returns R on factors Ω using weights Z to get factor exposures.
  4. 4
    Extract 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.

Technical Formulas

1
Orthogonality Condition

Formula
\sum_{i=1}^{N} \tilde{R}_i \Omega_{iA} = 0, \quad A = 1, \ldots, K

Weighted residuals R̃ are orthogonal to all K factor columns in Ω.

2
Weighted Residuals

Formula
\tilde{R} = Z \varepsilon

Twiddled (weighted) returns equal weight matrix times raw residuals.

3
Residual Calculation

Formula
\varepsilon = R - \Omega Q^{-1} \Omega^T Z R

Residuals after removing weighted factor exposures from returns.

4
Weight Matrix

Formula
Z = \text{diag}(z_i)

Diagonal matrix of weights, typically z_i = 1/σ²_i (inverse variance).

5
Weighted Covariance

Formula
Q = \Omega^T Z \Omega

Weighted cross-product matrix of factor loadings.

6
Sum Constraint

Formula
\sum_{i=1}^{N} \tilde{R}_i = 0

If intercept included in Ω, weighted residuals sum to zero automatically.

7
Volatility Weights

Formula
z_i = \frac{1}{\sigma_i^2}

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

  1. Include intercept column (vector of 1s) for market-wide mean
  2. Add industry/sector dummy variables (GICS sectors or finer)
  3. Optionally include style factors (beta, size, value, momentum)
  4. Ensure factors are not perfectly collinear
  5. Binary factors: 1 if stock belongs, 0 otherwise

Weight Calculation

  1. 1Estimate volatility σ_i for each stock (20-60 day lookback)
  2. 2Calculate weights z_i = 1/σ²_i
  3. 3Form diagonal matrix Z = diag(z_1, ..., z_N)
  4. 4Cap extreme weights to avoid instability
  5. 5Re-estimate weights periodically (weekly/monthly)

Regression & Residuals

  1. Compute Q = Ω^T Z Ω (K × K matrix)
  2. Compute Ω^T Z R (K × 1 vector of weighted covariances)
  3. Solve for factor returns: f = Q^{-1} Ω^T Z R
  4. Calculate residuals: ε = R - Ω f
  5. Weight residuals: R̃ = Z ε

Position Sizing

  1. 1Short stocks with R̃_i > 0 (positive weighted residual)
  2. 2Buy stocks with R̃_i < 0 (negative weighted residual)
  3. 3Size proportional to |R̃_i| or use rank-based sizing
  4. 4Verify factor neutrality: Σ R̃_i Ω_iA ≈ 0 for all A
  5. 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.

1

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.

Tips
  • Start simple: intercept + industry dummies only
  • Use GICS sector codes for industry classification
  • For 500 stocks across 11 sectors, Ω is 500 × 12
2

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.

Tips
  • 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.

3

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.

Tips
  • Use numpy.linalg.solve() rather than explicit matrix inversion
  • Check that Q is well-conditioned (condition number < 1000)
  • Weighted residuals: R̃ = Z ε
4

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 Ω.

Tips
  • 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

Data
CRSP, Compustat, Yahoo Finance, Polygon.io
Computation
Python (numpy, pandas, statsmodels), R
Execution
Interactive Brokers, QuantConnect, Alpaca
Research
SSRN, Quantpedia, WRDS

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.

Consider combining multiple variations or testing them against your specific investment goals and risk tolerance.

Risks & Limitations

High(1)
Medium(4)
Factor MisspecificationHigh

If important factors are omitted from Ω, residuals will still contain systematic exposure.

Impact:
Weight InstabilityMedium

Extreme weights from low-volatility stocks can cause erratic regression estimates.

Impact:
OverfittingMedium

Too many factors relative to stocks can overfit, leaving little signal in residuals.

Impact:
Estimation ErrorMedium

Volatility estimates are noisy. Weight errors propagate to residual calculations.

Impact:
Execution ComplexityMedium

Large portfolios with many positions require sophisticated execution infrastructure.

Impact:
Understanding these risks is essential for proper position sizing and portfolio construction. Consider combining with other strategies to mitigate individual risk factors.

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