Tutorials › Regression Analysis (Undergraduate) › Avoiding Extrapolation in Interaction Predictions

Simple Slopes and Marginal Effects · Tutorial 387 of 991

Avoiding Extrapolation in Interaction Predictions

Learn to identify when an interaction prediction is extrapolative and how to keep predictions, plots, and comparisons within regions supported by the data.

Intermediate 10 min read

What You'll Learn

  • Distinguish interpolation from extrapolation for one predictor and for interacting predictors.
  • Explain why being within each predictor’s observed range does not guarantee joint data support.
  • Use the observed predictor combinations to assess whether a prediction is supported.
  • Recognize unsupported group-by-predictor comparisons.
  • Limit interaction plots and comparisons to regions with adequate data support.
  • Explain why a model can calculate an extrapolated prediction without making it well supported.

Why Data Support Matters for Interaction Predictions

An interaction model can produce a prediction for many combinations of predictor values. But a calculated prediction is not necessarily a comparison that the data can support. If the model is asked to predict for a combination that was never observed, the result depends more heavily on the assumed model form than a prediction made among comparable observed cases.

This distinction matters especially when predictors interact. A value of one predictor may occur only alongside particular values of another. Looking at each predictor’s range separately can hide this pattern. A prediction may fall within both ranges and still describe a combination far from the data.

Definition: Interpolation uses a model to predict within a region of predictor space supported by observed data. Extrapolation predicts beyond that support. With one continuous predictor, extrapolation commonly means predicting below its observed minimum or above its observed maximum. With interacting predictors, support depends on their joint combinations, not just on each predictor’s separate range.

Interaction Models and Joint Support

For two continuous predictors \(x\) and \(z\), a linear interaction model for a quantitative outcome \(Y\) can be written as

$$ Y_i = \beta_0 + \beta_1 x_i + \beta_2 z_i + \beta_3 x_i z_i + \varepsilon_i. $$

The fitted conditional mean at a chosen profile \((x,z)\) is

$$ \widehat{Y}(x,z) = \hat{\beta}_0 + \hat{\beta}_1 x + \hat{\beta}_2 z + \hat{\beta}_3 xz. $$

This equation describes what the fitted model calculates; it does not establish that the data support every possible \((x,z)\). The model’s interpretation as a conditional mean relies on its form being suitable for the setting and on errors having mean zero conditional on the predictors, \(E(\varepsilon_i\mid x_i,z_i)=0\). Standard errors and tests require additional conditions. A support check is separate: it asks whether observations actually cover the predictor profile being interpreted.

A useful geometric description is the convex hull of the observed predictor profiles. It consists of all weighted averages of those profiles, where the weights are nonnegative and sum to one. A profile inside the hull is within the overall span of the observed combinations; one outside it is an extrapolation by this geometric criterion. Being inside the hull is not a guarantee of dense or local support: a region can contain few observations, or have a gap, while still lying inside the hull.

Worked Example: Within Each Range, but Outside Joint Support

Suppose hypothetical data contain the following observed pairs of predictor values:

$$ (1,1),\ (2,1),\ (2,2),\ (3,2),\ (3,3),\ (4,3). $$

The observed range of \(x\) is 1 to 4, and the observed range of \(z\) is 1 to 3. A fitted interaction model is \(\widehat{Y}(x,z)=20+3x+2z-0.5xz\). Consider predictions at \((4,1)\) and \((2.5,2)\).

At \((4,1)\), both coordinates are within their separate observed ranges. The model calculates

$$ \widehat{Y}(4,1)=20+3(4)+2(1)-0.5(4)(1)=32. $$

However, every observed pair in this example satisfies \(z\geq 0.5x\). Any weighted average of observed pairs also satisfies that inequality: if \(z_j\geq0.5x_j\) for each pair and the weights \(w_j\) are nonnegative, then \(\sum_jw_jz_j\geq0.5\sum_jw_jx_j\). The proposed profile \((4,1)\) does not satisfy it, because \(1<0.5(4)=2\). Thus it is outside the convex hull of the observed pairs. The value 32 is a model-based extrapolation, not a prediction for a well-supported combination.

At \((2.5,2)\), the profile is the midpoint of the observed pairs \((2,2)\) and \((3,2)\). It is therefore inside the observed span. Its fitted prediction is

$$ \widehat{Y}(2.5,2)=20+3(2.5)+2(2)-0.5(2.5)(2)=29. $$

This is interpolation in the joint predictor space. It remains sensible to check whether nearby observations are numerous enough for the intended interpretation; being inside the hull alone cannot answer that question.

Interactions with Categorical Predictors

For a binary group indicator \(G\), with \(G=0\) for one group and \(G=1\) for the other, a group-by-continuous interaction model can be written as

$$ \widehat{Y}(x,G)=\hat{\beta}_0+\hat{\beta}_1x+\hat{\beta}_2G+\hat{\beta}_3xG. $$

The group-specific fitted lines are \(\hat{\beta}_0+\hat{\beta}_1x\) for \(G=0\) and \((\hat{\beta}_0+\hat{\beta}_2)+(\hat{\beta}_1+\hat{\beta}_3)x\) for \(G=1\). A comparison between those lines at a chosen \(x\) is supported only if the data support that predictor value in the groups being compared. In particular, a difference between fitted group means at an \(x\) where one group has no observations relies on extrapolation for that group.

Worked Example: An Unsupported Group Comparison

In hypothetical data, group A has observed \(x\)-values from 0 to 10, while group B has observed values from 6 to 12. Suppose the fitted model is \(\widehat{Y}=50+4x+8G-1.5xG\), with \(G=0\) for A and \(G=1\) for B. Compare the fitted group predictions at \(x=4\), then at \(x=8\).

At \(x=4\), the prediction for group A is

$$ \widehat{Y}(4,0)=50+4(4)=66. $$

For group B, the model calculates

$$ \widehat{Y}(4,1)=50+4(4)+8-1.5(4)=68. $$

The fitted difference, B minus A, is \(68-66=2\) outcome units. But \(x=4\) is below group B’s observed range of 6 to 12. The group B prediction, and therefore the comparison at \(x=4\), extrapolates for that group. Reporting the numerical difference without that qualification would imply more data support than exists.

At \(x=8\), both groups have observations in their ranges. The fitted predictions are

$$ \widehat{Y}(8,0)=50+4(8)=82,\qquad \widehat{Y}(8,1)=50+4(8)+8-1.5(8)=78. $$

The fitted difference is \(78-82=-4\) outcome units at \(x=8\). This comparison is within both groups’ marginal ranges. It is more directly supported than the comparison at \(x=4\), though the number and distribution of observations near \(x=8\) still matter.

Restricting Prediction Grids and Plots

A prediction grid is a set of predictor profiles at which fitted values are calculated, often to draw lines or surfaces. A rectangular grid is convenient, but it can include combinations absent from the data. Plotting the resulting fitted values without marking this gap can make unsupported portions look just as evidence-based as supported portions.

For two continuous predictors, inspect a scatterplot of their observed pairs or a table of ranges within relevant bands. For a categorical predictor, inspect the range and distribution of the continuous predictor separately within each category. Then choose prediction profiles within the supported regions. When support is sparse or irregular, narrow the grid, show where observations lie, or leave unsupported parts unplotted. Do not extend a line across a region simply because the fitted equation has a value there.

Worked Example: Choosing a Supported Plotting Region

Suppose hypothetical observations form two clusters: profiles with \(x\) from 1 to 3 and \(z\) from 1 to 2, and profiles with \(x\) from 4 to 6 and \(z\) from 3 to 4. Each predictor’s overall range is observed, but low \(x\) is associated with low \(z\), and high \(x\) with high \(z\). For illustration, let the fitted model be \(\widehat{Y}=10+2x+3z+0.5xz\).

A prediction at \((2,1.5)\), in the first cluster, is

$$ \widehat{Y}(2,1.5)=10+2(2)+3(1.5)+0.5(2)(1.5)=20. $$

A prediction at \((5,3.5)\), in the second cluster, is

$$ \widehat{Y}(5,3.5)=10+2(5)+3(3.5)+0.5(5)(3.5)=39.25. $$

Both profiles fall within their respective clusters. By contrast, a rectangular grid might also include \((2,3.5)\), pairing low \(x\) with high \(z\). The equation gives

$$ \widehat{Y}(2,3.5)=10+2(2)+3(3.5)+0.5(2)(3.5)=28. $$

That calculation is arithmetically valid, but the stated data pattern provides no observations in that low-\(x\), high-\(z\) region. A plot that connects fitted values across the gap would suggest support for combinations the data do not contain. A more defensible display shows predictions within the clusters and makes the unsupported region clear rather than filling it with an apparently continuous surface.

A Practical Support Check

Before reporting a fitted prediction or drawing an interaction plot, describe the exact predictor profile and compare it with the observed profiles. The following steps help keep that comparison explicit.

1
State the profile.
Name every predictor value and category involved, including units for quantitative predictors.
2
Check each predictor separately.
Identify whether each numerical value falls within its overall range and, for group comparisons, within each group’s range.
3
Check the combinations.
Look for nearby observations with the same or similar joint values. For multiple continuous predictors, ranges alone do not establish joint support.
4
Limit the claim or display.
Label extrapolated values as model-dependent, avoid unsupported comparisons, and restrict plots to regions with adequate observed support.

Why a Calculated Prediction Is Not Automatically Supported

The fitted equation returns a number wherever its inputs can be entered. That is a property of the formula, not evidence that observations represent the requested profile. Outside the data-supported region, the model’s chosen functional form determines how the prediction extends. A different plausible form could behave differently there.

Interpolation also requires judgment. A profile may be inside the convex hull but near a thin edge or in a sparse area. Support should therefore be assessed in context, using plots, counts, and relevant group-specific distributions. A large overall sample does not guarantee good support for every interaction profile.

Finally, data support and causal interpretation are separate issues. Observations near a profile can support a descriptive model prediction; they do not, by themselves, establish that changing a predictor would cause the outcome to change. The prediction should be described as an association or fitted outcome unless the study design and assumptions justify a causal claim.

Common Mistake

Common mistake: “The requested \(x\) and \(z\) values are each between their observed minimum and maximum, so the prediction is interpolation.” This checks only the marginal ranges. The correction is to inspect the observed joint combinations: a pair of individually in-range values can still lie outside the supported region. For a group comparison, check support within each group rather than relying on the overall range.
Key takeaway: Interaction predictions are supported by observed combinations, not by the prediction equation alone. Check joint support, distinguish interpolation from extrapolation, and show or compare fitted values only where the data provide a meaningful basis for them.

Check Your Understanding

Use the ideas above to assess each prediction or comparison.

  1. Why can a profile be within the observed range of each of two continuous predictors and still be an extrapolation?
  2. In the first worked example, why is \((4,1)\) outside the convex hull of the observed pairs?
  3. Suppose group A has observations from \(x=2\) to \(x=9\), and group B from \(x=7\) to \(x=13\). Which interval supports comparisons within both groups?
  4. What limitation remains when a profile is inside the convex hull but observations near it are sparse?
  5. Why is a model’s ability to calculate a prediction not sufficient evidence that the prediction is well supported?