Reading the current lesson
Learn
Interactive·

Transformations & Interactions

Extend the regression equation when the relationship is not linear or when an effect depends on context.

Revenue may rise quickly with advertising at first and then level off. A promotion may work well for new customers but have little effect for returning customers.

Transformations change the scale or shape of a relationship. Interaction terms allow the effect of one predictor to differ across the value of another.

Key question

How can a regression model represent curved relationships and effects that vary by group or condition?

1

Concept

What does a transformation change?

Transformations can make a curved or uneven relationship easier to model

FormTypical purpose
log(x)compress large values and represent diminishing returns
log(y)model proportional rather than absolute changes
represent curvature
standardizationplace predictors on a comparable scale

A transformation changes interpretation

After transforming a variable, the coefficient must be interpreted on the transformed scale rather than as a simple one-unit raw change.

Curved in the raw units

before

A relationship that bends is hard for a straight line to follow.

Straight after a log

log(x)

Compressing the large values turns the curve into a line.

An interaction

x₁ × x₂
x₂ = 1x₂ = 0

The slope for one variable depends on the level of the other.

2

Why It Matters

How are log transformations interpreted?

Log models turn additive coefficients into percentage-style interpretations

ModelApproximate interpretation of β
y = α + β log(x)a 1% increase in x is associated with a β/100 unit change in y
log(y) = α + βxa one-unit increase in x is associated with about 100β% change in y
log(y) = α + β log(x)a 1% increase in x is associated with about β% change in y

For larger coefficients, use the exact transformation rather than relying only on the small-change approximation.

3

How It Works

What does an interaction mean?

An interaction says that one effect depends on another variable

Interaction model

ŷ = b₀ + b₁x + b₂z + b₃xz

Promotion by customer type

If z identifies returning customers, b₃ tells us how the promotion slope differs between new and returning customers.

4

Example

How should main effects be read?

With an interaction, main effects are conditional rather than universal

  • b₁ is the effect of x when z=0.
  • b₂ is the group difference when x=0.
  • b₃ is the difference between the two x slopes.
  • Centering a continuous variable can make the zero point and main effects easier to interpret.

Do not drop main effects casually

When an interaction is included, its component main effects are usually retained so that the model remains interpretable and respects hierarchy.

5

Interactive

Change transformations and interactions

Change the transformation and interaction strength

Compare the raw and transformed relationship, then change the interaction coefficient and watch the two group-specific lines separate or converge.

xOutcome
Group 0Group 1

With no interaction, the two lines have similar slopes. As the interaction moves away from zero, the slope for Group 1 changes relative to Group 0.

What to watch

A transformation changes the shape or scale of one relationship; an interaction changes which relationship applies under different conditions.

Key takeaways

  • Transformations can represent curvature, stabilize spread, or shift interpretation to proportional change.
  • Log-model coefficients must be interpreted according to which side of the equation is logged.
  • An interaction means the effect of one predictor depends on another variable.
  • Main effects in an interaction model are conditional on the other interacting variable being zero.
Next: Ridge, Lasso, and Elastic Net