Quant Memo
Core

Conditioning Variables and Interaction Features

How to let a model express that a signal's meaning changes depending on context — by explicitly building interaction features, or by letting a nonlinear model learn conditioning on its own — and why doing neither leaves real predictive power on the table.

Prerequisites: Feature Crosses for Tabular Models

A momentum signal that works well in calm markets can flip sign in a crash — the same raw number, "past 12-month return," means something different depending on the volatility environment it's measured in. A plain linear model treats momentum's effect as a single fixed number applied everywhere, blind to context. What you actually want is for the model to know that momentum's coefficient should shrink, or even reverse, when volatility is elevated. That "it depends on context" behavior is what conditioning variables and interaction features are for.

The idea: letting one variable modulate another

Think of a thermostat that adjusts a room's target temperature based on how many people are in it — the "how much heating to add" rule is not fixed, it depends on occupancy. An interaction feature does the analogous thing algebraically: instead of a feature xx (momentum) entering the model with one fixed weight, you multiply it by a conditioning variable zz (say, a volatility regime indicator) so the model can learn that xx's effective influence changes with zz.

The simplest form is a multiplicative interaction term added alongside the original features:

y^=β0+β1x+β2z+β3(x×z)+ε.\hat{y} = \beta_0 + \beta_1 x + \beta_2 z + \beta_3 (x \times z) + \varepsilon .

In plain English: β1\beta_1 is momentum's average effect, β2\beta_2 is the volatility regime's own direct effect, and β3\beta_3 — the interaction coefficient — measures how much momentum's effect itself shifts as the volatility regime changes. If β3\beta_3 is negative and zz is a "high volatility" flag, the model has learned that momentum's payoff shrinks specifically in high-vol periods, something neither xx nor zz alone could express.

Nonlinear models like tree ensembles or neural networks can discover useful interactions automatically by splitting on one variable within a branch already conditioned on another, which is why they sometimes beat a plain linear model without any hand-built interaction terms — but only if there's enough data to estimate those extra degrees of freedom reliably.

Worked example: momentum conditioned on volatility regime

Say backtests show plain 12-month momentum earns an average monthly return of 0.6% across all periods, but broken out by regime: 0.9% in low-volatility months and −0.2% in high-volatility months (using a simple realized-vol median split as the conditioning variable z{0,1}z \in \{0,1\}). A linear model using momentum alone can only report the blended 0.6% average — it has no way to express the sign flip. Adding the interaction term x×zx \times z lets the model fit β10.9\beta_1 \approx 0.9 (the low-vol effect) and β31.1\beta_3 \approx -1.1 (the extra swing in high-vol months, since 0.91.1=0.20.9 - 1.1 = -0.2), so a live prediction correctly discounts or reverses the momentum signal whenever the volatility flag is on — instead of always applying the same blended, and often wrong, average effect.

0 low-vol high-vol blended avg
Momentum's true relationship to returns is opposite-signed across regimes; the flat blended line a non-interacted model would learn hides both slopes.

What this means in practice

Good conditioning variables are usually things a researcher already believes change the meaning of a signal — volatility regime, sector, market-cap bucket, macro state — rather than arbitrary pairwise crosses of every feature with every other feature, which multiplies the feature count and invites overfitting long before it finds anything real. Cross-validating interaction terms and checking whether they hold out-of-sample, exactly as with any other feature, is essential: an interaction fit on a handful of historical high-volatility episodes can look decisive and still be spurious.

An interaction feature (x×zx \times z) lets a model express that one variable's effect depends on the value of another, instead of forcing a single fixed coefficient to average over regimes where the true relationship is different or even opposite. Choose conditioning variables from domain knowledge about when a signal's meaning genuinely changes, not by crossing every feature pair mechanically.

Related concepts

Practice in interviews

Further reading

  • Gu, Kelly, Xiu, 'Empirical Asset Pricing via Machine Learning', Review of Financial Studies (2020)
ShareTwitterLinkedIn