Tutorials › Exam SRM - Statistics for Risk Modeling › Product Terms for Continuous-Predictor Interactions

Exam SRM · Transformations and Collinearity · Tutorial 124 of 926

Product Terms for Continuous-Predictor Interactions

Construct and interpret a two-predictor interaction model, calculate conditional changes in the response, and recognize when a product term represents interaction rather than curvature.

Advanced 11 min read

What You'll Learn

  • Write a linear regression model containing two continuous predictors and their product.
  • Interpret the product coefficient and the predictor coefficients at their reference values.
  • Calculate how a change in one predictor corresponds to different fitted-response changes at different values of the other.
  • Use fitted mean values to recover interaction-model coefficients.
  • Distinguish a product interaction from a squared predictor that represents curvature.
  • Recognize common interpretation errors and explain what centering changes in an interaction model.

Why Include a Product Term?

A regression model with two predictors but no product term assumes that the fitted effect of either predictor is constant across values of the other predictor. That assumption may be too restrictive. For example, in a hypothetical insurance analysis, the association between annual mileage and expected claim cost might differ for newer and older vehicles. A product term lets the model represent that variation.

This is called an interaction between continuous predictors. It does not, by itself, establish that either predictor causes a change in the response. It describes how the fitted relationship between predictors and response varies in the model.

Definition: For continuous predictors \(x_1\) and \(x_2\), a two-predictor interaction model includes their product \(x_1x_2\): $$ Y_i=\beta_0+\beta_1x_{1i}+\beta_2x_{2i}+\beta_3x_{1i}x_{2i}+\varepsilon_i. $$ Here \(Y_i\) is the response for observation \(i\), the \(\beta\)'s are regression coefficients, and \(\varepsilon_i\) is the error. The product coefficient \(\beta_3\) represents how the fitted effect of one predictor changes as the other predictor changes.

The model is linear in its coefficients, even though it contains a product of predictors: each coefficient appears only as a coefficient multiplying a known column of the design matrix. The columns are \(1\), \(x_1\), \(x_2\), and \(x_1x_2\). Including all four terms is usually important. Without the main effects \(x_1\) and \(x_2\), the model forces their effects to be zero whenever the other predictor is zero, a restriction not generally intended by the interaction.

Model Assumptions and Interpreting the Terms

The conditional mean model is \(E[Y_i\mid x_{1i},x_{2i}]=\beta_0+\beta_1x_{1i}+\beta_2x_{2i}+\beta_3x_{1i}x_{2i}\). For the usual least-squares interpretation, assume the errors have conditional mean zero, are uncorrelated across observations, and have constant conditional variance. Normal errors are additionally assumed for exact small-sample \(t\)- and \(F\)-inference. The coefficient estimates also require the model columns not to be perfectly linearly dependent. If the mean relationship is misspecified, or observations do not meet the relevant error assumptions, standard inference may not be reliable.

The main-effect coefficients are conditional on the other predictor being zero. In particular, \(\beta_1\) describes the fitted change in \(Y\) per unit increase in \(x_1\) when \(x_2=0\); \(\beta_2\) describes the change per unit increase in \(x_2\) when \(x_1=0\). If zero is not a meaningful or observed reference value, these coefficients may be difficult to interpret directly. Centering predictors can make zero correspond to a useful reference, such as an average value.

The interaction coefficient describes how the conditional effect changes: an increase of one unit in \(x_2\) changes the fitted per-unit effect of \(x_1\) by \(\beta_3\). Its units are response units per unit of \(x_1\) per unit of \(x_2\). A positive \(\beta_3\) means the fitted effect of \(x_1\) increases as \(x_2\) increases; a negative \(\beta_3\) means it decreases. Neither sign alone determines whether the effect of \(x_1\) is positive or negative at a particular \(x_2\).

Key result: In the interaction model, the fitted change for increasing \(x_1\) by \(h\), while holding \(x_2\) fixed, is $$ \widehat{Y}(x_1+h,x_2)-\widehat{Y}(x_1,x_2) =h(\widehat{\beta}_1+\widehat{\beta}_3x_2). $$ Thus, the fitted change per unit of \(x_1\) depends on the value of \(x_2\). With no product term, that change would be \(h\widehat{\beta}_1\), the same at every \(x_2\).

This result follows by subtracting the two fitted values. The intercept and the terms involving only \(x_2\) cancel; the \(x_1\) and \(x_1x_2\) terms change by \(h\widehat{\beta}_1\) and \(h x_2\widehat{\beta}_3\), respectively. Their sum is \(h(\widehat{\beta}_1+\widehat{\beta}_3x_2)\). This difference calculation is exact for any \(h\), not an approximation.

Worked Example: Mileage and Vehicle Age

Suppose a hypothetical insurer models expected annual claim cost \(Y\), measured in thousands of dollars, using \(x_1\), annual mileage measured in units of 10,000 miles, and \(z\), vehicle age in years minus 5. Its fitted model is $$ \widehat{Y}=12+2x_1-0.5z+0.3x_1z. $$ Calculate the predicted cost at \(x_1=2,z=4\), then find the change in predicted cost when mileage rises from \(2\) to \(4\) units at that vehicle age.

Method. Substitute the predictor values for the prediction, then use the product-term formula to calculate the change in response. Here \(z=4\) corresponds to a vehicle age of 9 years.

At \(x_1=2,z=4\), the fitted value is \(12+2(2)-0.5(4)+0.3(2)(4)=12+4-2+2.4=16.4\). The prediction is \(16.4\) thousand dollars.

At \(z=4\), the fitted change per one-unit increase in \(x_1\) is \(2+0.3(4)=3.2\) thousand dollars. The increase from \(x_1=2\) to \(x_1=4\) is two units, so the fitted change is \(2(3.2)=6.4\) thousand dollars.

Check by direct prediction at \(x_1=4,z=4\): \(12+2(4)-0.5(4)+0.3(4)(4)=12+8-2+4.8=22.8\). The difference is \(22.8-16.4=6.4\) thousand dollars, as calculated. The common mistake is to multiply the change of two units by \(\widehat{\beta}_1=2\) and report \(4\) thousand dollars. That ignores the interaction; the correct per-unit change at \(z=4\) is \(3.2\), not \(2\).

Recovering and Using an Interaction Model

Fitted mean values at selected predictor combinations can reveal whether an interaction is needed and help determine its coefficients. The product term contributes nothing when either predictor is zero, but contributes \(\beta_3x_1x_2\) elsewhere. Comparing changes in the response across different values of the other predictor isolates this contribution.

Worked Example: Finding Coefficients From Fitted Means

For a hypothetical processing-time model, suppose fitted mean responses at four combinations of two continuous predictors are \(m(0,0)=8\), \(m(1,0)=10\), \(m(0,2)=7\), and \(m(1,2)=11\). Find the coefficients in \(m(x_1,x_2)=\beta_0+\beta_1x_1+\beta_2x_2+\beta_3x_1x_2\), then predict \(m(2,1)\).

Method. Use the points with one predictor equal to zero to identify the intercept and main effects, then use the remaining point to identify the product coefficient.

At \((0,0)\), \(m(0,0)=\beta_0=8\). At \((1,0)\), \(8+\beta_1=10\), so \(\beta_1=2\). At \((0,2)\), \(8+2\beta_2=7\), so \(2\beta_2=-1\) and \(\beta_2=-0.5\).

At \((1,2)\), the model gives \(8+2-0.5(2)+2\beta_3=11\). Therefore \(8+2-1+2\beta_3=11\), so \(9+2\beta_3=11\), \(2\beta_3=2\), and \(\beta_3=1\). The fitted model is \(m(x_1,x_2)=8+2x_1-0.5x_2+x_1x_2\).

At \((2,1)\), \(m(2,1)=8+2(2)-0.5(1)+(2)(1)=8+4-0.5+2=13.5\). As a check on the interaction, the change in \(x_1\) from 0 to 1 is 2 at \(x_2=0\), but is \(11-7=4\) at \(x_2=2\). The difference between those changes is 2, equal to \(\beta_3(2-0)=1(2)\). A common mistake is to treat the response change from \(x_2=0\) to \(x_2=2\) as constant across \(x_1\); the product term makes that change depend on \(x_1\).

Interaction Is Not the Same as Curvature

A product term and a squared predictor represent different patterns. With an interaction but no squared terms, the fitted response is a straight line in \(x_1\) when \(x_2\) is held fixed, and also a straight line in \(x_2\) when \(x_1\) is held fixed. The slope of one such line changes across values of the other predictor. By contrast, a term such as \(x_1^2\) allows the fitted relationship with \(x_1\) to curve even when \(x_2\) is fixed. A model can contain both kinds of terms if the data and modeling purpose support them.

Worked Example: Distinguishing Interaction From Quadratic Curvature

Compare two hypothetical fitted models. Model A is \(\widehat{Y}=4+2x_1+3x_2+1.5x_1x_2\). Model B is \(\widehat{Y}=4+2x_1+3x_2+0.5x_1^2\). At \(x_2=2\), calculate fitted values at \(x_1=0,1,2\) for each model and identify which pattern represents interaction and which represents curvature in \(x_1\).

Method. Substitute \(x_2=2\) in each model and compare the successive changes as \(x_1\) increases by one.

For Model A, \(\widehat{Y}=4+2x_1+6+3x_1=10+5x_1\). The predictions at \(x_1=0,1,2\) are \(10,15,20\); successive changes are \(5\) and \(5\). This is linear in \(x_1\) at the fixed value \(x_2=2\). At \(x_2=0\), the fitted relationship is \(4+2x_1\), with a change of 2 per unit. The difference between the two conditional changes, \(5-2=3\), equals \(1.5(2-0)\), showing how the interaction changes the \(x_1\) effect across \(x_2\).

For Model B, \(\widehat{Y}=4+2x_1+6+0.5x_1^2=10+2x_1+0.5x_1^2\). The predictions are \(10\) at \(x_1=0\), \(12.5\) at \(x_1=1\), and \(16\) at \(x_1=2\). The successive changes are \(2.5\) and \(3.5\), so the change in \(x_1\) is not constant: the squared term produces curvature. Model A demonstrates interaction; Model B demonstrates curvature in \(x_1\). The common mistake is to call every model with a changing predictor effect an interaction. Here the squared term changes the effect across \(x_1\), while the product term changes it across \(x_2\).

Reference Values, Centering, and Practical Interpretation

The meaning of the main effects depends on where the other predictor is set to zero. If \(x_1\) is centered at a reference \(a\) and \(x_2\) at a reference \(b\), define \(x_{1c}=x_1-a\) and \(x_{2c}=x_2-b\). The product becomes \(x_{1c}x_{2c}=(x_1-a)(x_2-b)\). Rewriting the same fitted model in these centered variables changes the intercept and the main-effect coefficients, because the zero points have changed, but it does not change fitted values or the coefficient on the product term. Centering is therefore useful for interpretation; it does not create or remove the modeled interaction.

An interaction coefficient should be interpreted in the predictors' units and with attention to the range of data. For example, a coefficient per year of age is not numerically comparable to one per 10,000 miles unless the units are accounted for. A fitted effect evaluated far beyond the observed predictor combinations is an extrapolation, even if the algebra is straightforward. Also, a nonzero product coefficient is evidence of a modeled interaction, not automatically evidence of a practically important effect or a causal mechanism.

Exam trap: Do not interpret \(\widehat{\beta}_1\) as the effect of \(x_1\) at every value of \(x_2\). In a model with a product term, it is the effect at \(x_2=0\). For another value \(c\), calculate \(\widehat{\beta}_1+\widehat{\beta}_3c\) per unit of \(x_1\), or multiply that quantity by the stated change in \(x_1\). Similarly, a product term \(x_1x_2\) is not a squared term such as \(x_1^2\).

Check Your Understanding

Work each problem using the stated units and reference values.

  1. A fitted model is \(\widehat{Y}=5+1.2x_1-0.4x_2+0.2x_1x_2\). At \(x_2=3\), find the fitted response change when \(x_1\) increases from 2 to 4. (Answer: \(3.6\) response units.)
  2. A model has fitted means \(m(0,0)=6\), \(m(2,0)=10\), \(m(0,1)=8\), and \(m(2,1)=14\), and form \(m=\beta_0+\beta_1x_1+\beta_2x_2+\beta_3x_1x_2\). Find all four coefficients. (Answer: \(\beta_0=6,\ \beta_1=2,\ \beta_2=2,\ \beta_3=1\).)
  3. A model is \(\widehat{Y}=9-0.5x_1+2x_2+0.4x_1x_2\). At \(x_1=4\), calculate the fitted change for a two-unit increase in \(x_2\). (Answer: \(7.2\) response units.)
  4. For \(\widehat{Y}=3+x_1+2x_2-0.25x_1x_2\), state how the fitted per-unit effect of \(x_1\) changes when \(x_2\) increases by 4 units. Does this alone show the effect of \(x_1\) is negative? (Answer: It decreases by 1 response unit per unit of \(x_1\); no, the effect's sign also depends on the starting value of \(x_2\) and the coefficient on \(x_1\).)
  5. Compare \(\widehat{Y}=2+3x_1+x_2+0.5x_1x_2\) with \(\widehat{Y}=2+3x_1+x_2+0.5x_1^2\). At \(x_2=2\), compute the first model's response change from \(x_1=0\) to \(x_1=1\). In the second model, compute the successive changes from \(x_1=0\) to 1 and from 1 to 2. Identify the interaction and curvature pattern. (Answer: The first model's change is \(4\); the second model's changes are \(3.5\) and \(4.5\). The first has an interaction; the second has curvature in \(x_1\).)
Clinical Biostats