Chapter 8: Financial Feature Engineering

Residualization, Peer Sets, and Relative-Value Features

Neutralization is not cosmetic cleanup. It changes the hypothesis about what should count as an opportunity.

Residualization, Peer Sets, and Relative-Value Features

Neutralization is not cosmetic cleanup. It changes the hypothesis about what should count as an opportunity.

The Intuition

Many feature ideas in finance are relative by construction.

You often do not care whether a stock went up. You care whether it went up:

  • more than its sector peers
  • more than what its factor exposures would predict
  • more than a spread relationship says it should

That shift sounds small, but it changes the feature from an absolute statement to a residual one.

A raw momentum signal says:

recent winners may keep winning.

A sector-neutral momentum signal says:

recent winners within their sector may keep winning.

A factor-residual momentum signal says:

recent winners after removing common factor structure may keep winning.

Those are different hypotheses. Chapter 8 uses neutralization this way. This primer makes explicit what changes when the peer set or residual model changes.

From Raw Signal to Residual Signal

The simplest relative-value feature subtracts a peer reference:

$$ z_{i,t} = x_{i,t} - \bar{x}_{g(i),t}, $$

where g(i) is the peer group for asset i.

This can be useful for spreads, valuation gaps, relative momentum, and cross-sectional anomalies.

Residualization is the more general version. Write the raw object of interest $x_{i,t}$ — this can be a return, a spread, or some other feature before neutralization — as

$$ x_{i,t} = \beta_i^\top f_t + \varepsilon_{i,t}, $$

where $f_t$ captures the common structure you want to remove. The residual $\varepsilon_{i,t}$ is the part the chosen reference frame does not explain.

That framing is still only as good as the residual model. If the common structure is nonlinear or state-dependent, a linear residual can still carry systematic content that a tree or neural model will pick up later.

This is why neutralization is hypothesis design. The reference model says what should be considered "common" and therefore not the target of the trade.

Peer Sets Change the Meaning

A peer set is not just a convenience. It defines the comparison class.

Common choices include:

  • sector peers
  • industry peers
  • country or region buckets
  • market-cap buckets
  • statistical clusters
  • factor-model residual peers

Each one answers a different question.

If you normalize a stock against its sector, you are assuming sector moves are background variation. If you residualize against market and style factors, you are assuming those factor exposures are not the edge. If you use statistical clusters, you are letting the data define similarity rather than an economic taxonomy.

That is why changing the peer set is not a noise-reduction tweak. It is a new feature definition.

Why Residualization Can Help

Residual features often help for three reasons.

1. They remove obvious common structure

A raw signal may simply reload broad market or sector exposure. Residualization can isolate the stock-specific or spread-specific part.

2. They stabilize cross-sectional comparison

Comparing banks to software firms on raw valuation or short-horizon reversal can be meaningless. A peer-normalized feature makes the ranking more coherent.

3. They improve portfolio interpretation

If the feature already removes broad exposures, downstream portfolio risk is often easier to read. The portfolio may still pick up common bets, but less of the signal's strength comes from trivial macro structure.

Why Residualization Can Hurt

Neutralization is not free.

It introduces estimation noise through:

  • unstable factor loadings
  • drifting peer sets
  • frequent re-estimation
  • small peer groups

For example, residualizing a niche industrial name against a three-stock peer group may produce a residual that mostly reflects peer-specific noise rather than stock-specific information. The cleaner-looking feature can be statistically worse than the raw one.

It can also remove exactly the part of the signal that carried the edge. If sector momentum is real, then sector-neutral momentum may throw away useful information in the name of cleanliness.

So the right question is not "should I always residualize?" It is:

what common structure do I believe is background, and how noisy is the step that removes it?

A Worked Scenario

Suppose you are testing a 6-month momentum feature in a cross-section of equities.

You compare three variants.

Raw momentum

Rank stocks by their own 6-month return.

This may work, but a lot of the signal can come from sector waves or broad market exposure.

Sector-neutral momentum

Subtract the sector-average momentum score, then rank within sector.

Now the feature asks whether a stock is strong relative to peers facing similar broad conditions.

Factor-residual momentum

Regress returns on market, sector, and style factors; then compute momentum on the residual return series.

Now the feature asks whether the idiosyncratic component itself persists.

All three are plausible. But they target different drivers:

  • raw momentum can benefit from common trend
  • sector-neutral momentum targets within-group persistence
  • residual momentum targets stock-specific continuation after removing known common structure

The choice should follow the hypothesis, not aesthetic preference.

Feature-Stage Versus Portfolio-Stage Neutralization

There are two different places to remove common exposures:

  • at the feature stage
  • at the portfolio stage

Feature-stage residualization changes what the model learns. Portfolio-stage neutralization changes how the learned signal is expressed in holdings.

These are not interchangeable.

If you residualize momentum before ranking, the model is asked to learn persistence only in the part left over after sector or factor effects are removed. If you keep raw momentum and neutralize only at the portfolio stage, the model still learns from the full signal, and the allocator later tries to hedge the resulting common exposures.

Those two workflows can produce different rankings, different holdings, and different error modes. For Chapter 8, the key point is that feature-stage residualization is part of the signal hypothesis, not just a downstream risk-control choice.

Make that concrete. Suppose an oil-services stock is the strongest name in a sector rally. A feature-stage sector-neutral signal may push it down because most of its move is shared with peers. A portfolio-stage hedge can do something different: keep the stock near the top of the ranking, then offset the sector exposure in the final holdings. Same raw move, different learned signal.

Peer-Set Drift and Refresh Cadence

Relative features can drift because the reference set itself changes.

Examples:

  • sector reclassifications change who counts as a peer
  • liquidity screens add and drop names
  • cluster-based peer sets move as correlations shift
  • rolling factor regressions produce changing residual definitions

This matters because the feature can change even if the asset itself did not. The reference frame moved.

There are two separate issues here. Point-in-time peer reconstruction may still be valid, but the meaning of the feature changes as group membership evolves. Using current membership to reconstruct historical peers is worse: it introduces a survivorship-style contamination because the past feature is being defined with information that was not available then.

A practical diagnostic is to log peer-set snapshots through time or use a point-in-time industry map so you can verify that the historical peer membership really matches what was knowable on each date.

That is why relative-value features should document:

  • how peers are defined
  • how often the peer set is refreshed
  • whether the reference model is refit daily, weekly, or monthly
  • whether the re-estimation is fold-safe inside the research protocol

Otherwise a backtest can quietly attribute gains to a feature whose meaning changed over time.

What Good Practice Looks Like

A good relative-value feature specification should answer:

  1. What common structure is being removed?
  2. Why is that structure considered background rather than edge?
  3. How noisy is the removal step?
  4. How often is the peer or factor model refreshed?

If those answers are vague, the feature is usually underspecified.

In Practice

Use these rules:

  • choose the peer set to match the mechanism, not just because it produces a cleaner backtest
  • treat sector-neutral, factor-neutral, and cluster-neutral variants as different features
  • track the estimation noise added by the neutralization step
  • document peer-set refresh cadence and factor-model refit cadence
  • compare raw and residual versions explicitly, because sometimes the removed common component was doing real work

Common Mistakes

  • Calling neutralization a harmless preprocessing step.
  • Changing peer sets without realizing the hypothesis changed too.
  • Residualizing on a noisy factor model and then trusting the residual as if it were clean.
  • Refreshing peer definitions so often that the feature becomes a moving target.
  • Confusing feature residualization with later portfolio hedging.

Connections

This primer supports Chapter 8's treatment of cross-instrument and relative-value features. It connects directly to factor structure, benchmark-relative evaluation, momentum design, and the risk diagnostics later used to determine whether a supposed stock-specific edge is really just common exposure in disguise.

Register to Read

Sign up for a free account to access all 61 primer articles.

Create Free Account

Already have an account? Sign in