Tutorials › Regression Analysis (Undergraduate) › Comparing Predictor Profiles by Subtraction

Building and Reading Model Terms · Tutorial 136 of 991

Comparing Predictor Profiles by Subtraction

Use subtraction to compare fitted outcomes for two predictor profiles and identify which model terms contribute to their difference.

Intermediate 10 min read

What You'll Learn

  • Define a predictor profile and a fitted difference between two profiles.
  • Subtract fitted additive equations in a consistent order.
  • Identify and cancel terms that are unchanged between profiles.
  • Calculate fitted differences when numeric predictors and indicator variables change.
  • Interpret a fitted difference with its sign and outcome units.
  • Distinguish a fitted comparison from an observed or causal difference.

Why Compare Profiles by Subtraction?

A regression model can give a fitted outcome for any specified combination of predictor values. Often, the useful question is not the fitted outcome for one profile alone, but how two profiles compare. For example, how far apart are the model's fitted weekly study hours for two students who differ in both work hours and enrollment status? Subtracting their fitted outcomes makes the comparison direct: terms that are the same for both profiles cancel, and the remaining terms show what contributes to the fitted difference.

The order of subtraction matters. In this tutorial, a difference “from profile A to profile B” means the fitted value for B minus the fitted value for A. A positive result means that the model's fitted outcome is higher for B; a negative result means it is lower. The result is a difference between fitted values, not necessarily the difference between two observed outcomes.

The Additive Model and Predictor Profiles

A predictor profile is a specified set of values for all predictors in a regression equation. For this topic, consider a fitted additive model with two numeric predictors, \(x_1\) and \(x_2\), and one zero-one indicator, \(g\):

$$ \widehat{y}=\hat{\beta}_0+\hat{\beta}_1x_1+\hat{\beta}_2x_2+\hat{\beta}_3g $$

Here, \(\widehat{y}\) is a fitted outcome, \(\hat{\beta}_0\) is the estimated intercept, and each remaining coefficient multiplies its corresponding predictor. The indicator \(g\) is coded as 0 or 1, with its meaning determined by the model's coding. “Additive” means the equation adds the listed predictor terms; it contains no product terms such as \(x_1g\). The model and coding must be the same for both profiles being compared.

Definition: For profiles A and B evaluated using the same fitted model, the fitted difference from A to B is \(\widehat{y}_B-\widehat{y}_A\). It is measured in the units of the outcome. When the model is additive, any term with the same value in both profiles contributes equally to both fitted values and cancels in the subtraction.

The algebraic comparison does not require assumptions about a residual distribution: it follows by subtracting two values calculated from the same fitted equation. To interpret those values as estimates of mean outcomes, the regression model's specification must be appropriate for the setting, including its additive form and predictor coding. This arithmetic alone does not establish that a difference is statistically significant or that changing a predictor causes an outcome to change.

How Subtraction Cancels Shared Terms

Write the model once for profile A and once for profile B. Subtract the entire equation for A from the entire equation for B, preserving parentheses so that every term in A is subtracted.

$$ \begin{aligned} \widehat{y}_B-\widehat{y}_A &=(\hat{\beta}_0+\hat{\beta}_1x_{1B}+\hat{\beta}_2x_{2B}+\hat{\beta}_3g_B)\\ &\quad-(\hat{\beta}_0+\hat{\beta}_1x_{1A}+\hat{\beta}_2x_{2A}+\hat{\beta}_3g_A)\\ &=\hat{\beta}_1(x_{1B}-x_{1A}) +\hat{\beta}_2(x_{2B}-x_{2A}) +\hat{\beta}_3(g_B-g_A). \end{aligned} $$

The intercept cancels because it is identical in both fitted values. Each predictor term can be written as its coefficient multiplied by the difference in that predictor's profile values. If a predictor is unchanged, its difference is zero, so its term contributes zero. This is not an assumption that the predictor has no association with the outcome; it means only that this predictor does not distinguish these two profiles in this particular comparison.

Key result: To find a fitted difference, calculate \(\widehat{y}_B-\widehat{y}_A\), subtract the full fitted equations, and simplify. The terms that differ between profiles remain; shared terms cancel. State the subtraction order and retain the outcome's units in the final interpretation.

Worked Comparisons

Worked Example: Two Profiles Differ in One Numeric Predictor

Suppose a hypothetical fitted model predicts quiz score in points from weekly practice hours \(x\) and a zero-one indicator \(g\) for attending an optional review session (\(g=1\) for attendance and \(g=0\) otherwise):

$$ \widehat{y}=42+3.2x+5g $$

Compare profile A, a student with 4 practice hours who did not attend the review (\(g=0\)), with profile B, a student with 7 practice hours who also did not attend. The indicator is unchanged, so it will cancel.

For A, the fitted score is \(42+3.2(4)+5(0)=42+12.8=54.8\) points. For B, it is \(42+3.2(7)+5(0)=42+22.4=64.4\) points.

Subtract A from B:

$$ \widehat{y}_B-\widehat{y}_A =(42+3.2(7)+5(0))-(42+3.2(4)+5(0)) =22.4-12.8=9.6\text{ points}. $$

The same result follows after canceling the shared intercept and indicator term: \(3.2(7-4)=3.2(3)=9.6\) points. In this fitted model, profile B has a score 9.6 points higher than profile A. This describes the fitted comparison, not a guaranteed difference between the two students' actual scores.

Worked Example: Numeric and Indicator Predictors Both Differ

Suppose a hypothetical model predicts weekly study time in hours using paid work hours per week \(w\) and an indicator \(c\) for full-time enrollment (\(c=1\) for full-time and \(c=0\) for part-time):

$$ \widehat{y}=18-0.6w+4c $$

Compare profile A, with \(w_A=15\) and \(c_A=0\), to profile B, with \(w_B=10\) and \(c_B=1\). For A, \(\widehat{y}_A=18-0.6(15)+4(0)=18-9=9\) hours. For B, \(\widehat{y}_B=18-0.6(10)+4(1)=18-6+4=16\) hours.

Subtract A from B, writing the full model for each profile:

$$ \begin{aligned} \widehat{y}_B-\widehat{y}_A &=(18-0.6(10)+4(1))-(18-0.6(15)+4(0))\\ &=16-9\\ &=7\text{ hours}. \end{aligned} $$

The intercept cancels. The work-hours term contributes \(-0.6(10-15)=3\) hours, and the enrollment-indicator term contributes \(4(1-0)=4\) hours. Together they give \(3+4=7\) hours. Thus, the fitted weekly study time for profile B is 7 hours higher than for profile A. This is a model-based comparison of the two profiles; it does not show that changing someone's enrollment status or work hours would cause that difference.

Worked Example: A Shared Predictor Cancels Even When Its Coefficient Is Not Zero

Suppose a hypothetical fitted equation for a laboratory measurement in milligrams is

$$ \widehat{y}=12+1.5a+0.8b-2g, $$

where \(a\) is age in years, \(b\) is a numeric measurement in centimeters, and \(g\) is a zero-one group indicator. Compare profile A, \((a_A,b_A,g_A)=(30,160,0)\), with profile B, \((a_B,b_B,g_B)=(34,160,1)\).

For A, \(\widehat{y}_A=12+1.5(30)+0.8(160)-2(0)=12+45+128=185\) milligrams. For B, \(\widehat{y}_B=12+1.5(34)+0.8(160)-2(1)=12+51+128-2=189\) milligrams.

Subtracting gives

$$ \begin{aligned} \widehat{y}_B-\widehat{y}_A &=(12+1.5(34)+0.8(160)-2(1))\\ &\quad-(12+1.5(30)+0.8(160)-2(0))\\ &=1.5(34-30)+0.8(160-160)-2(1-0)\\ &=6+0-2=4\text{ milligrams}. \end{aligned} $$

The \(b\) term cancels because both profiles have \(b=160\), even though its coefficient, 0.8, is not zero. The fitted value for B is 4 milligrams higher than for A. The difference comes from the terms that changed: age contributes 6 milligrams to the contrast, while the indicator term contributes \(-2\) milligrams.

A Reliable Calculation Process

When comparing two profiles, it is useful to make the order and the changing values explicit before doing arithmetic. The following steps reduce sign errors and make the resulting statement easier to interpret.

1
State the direction.
Write which profile is B and which is A. The target is \(\widehat{y}_B-\widehat{y}_A\).
2
Use the same fitted equation twice.
Substitute each profile's predictor values into the same model, using the specified indicator coding.
3
Subtract with parentheses.
Place the complete A expression in parentheses after the minus sign so its signs are all handled correctly.
4
Cancel shared terms and calculate.
Terms unchanged between profiles cancel; evaluate the remaining coefficient-weighted differences.
5
Interpret the signed result.
Report which profile has the higher fitted outcome, by how much, and in the outcome's units.

Common Mistakes and Why the Comparison Matters

  • Reversing the subtraction order. A result of \(\widehat{y}_B-\widehat{y}_A=5\) means B's fitted value is 5 outcome units higher than A's. Reversing the order gives \(-5\), not \(5\).
  • Dropping a minus sign. When subtracting an expression, every term inside it is subtracted. Parentheses make this operation visible and prevent a negative coefficient from being mishandled.
  • Keeping a shared term as if it changed. A predictor can have a nonzero coefficient and still make no contribution to a particular comparison when its value is identical in both profiles.
  • Calling the fitted difference an observed difference or a causal effect. The subtraction compares two values calculated from a model. It does not guarantee that observed outcomes differ by that amount, and it does not by itself show that changing a predictor causes an outcome change.
  • Comparing profiles using different equations or coding. Cancellation relies on both fitted values coming from the same model, including the same indicator definitions and reference coding.

Subtraction is useful because it separates the overall profile comparison from the individual fitted values. Shared conditions disappear from the arithmetic, while the signed result retains the direction and size of the fitted contrast. When several predictors differ, showing their separate contributions also makes the calculation easier to check. The interpretation should remain limited to the fitted model and the profiles specified.

Check Your Understanding

For each question, keep the order of subtraction explicit and give units where the context provides them.

  1. In the model \(\widehat{y}=10+2x+3g\), compare A with \(x=4,g=0\) to B with \(x=6,g=0\). What is \(\widehat{y}_B-\widehat{y}_A\), and which profile has the higher fitted value?
  2. In an additive model, two profiles have the same value of one predictor. What is that predictor's contribution to the fitted difference, and why?
  3. For \(\widehat{y}=20-0.5w+2c\), calculate the fitted difference from A \((w=12,c=1)\) to B \((w=8,c=0)\).
  4. Why does a predictor term cancel when its value is unchanged, even if its coefficient is nonzero?
  5. A student says, “The fitted value for B is 6 units higher, so changing A's predictors to B's must cause an increase of 6 units.” What part of this reasoning is not justified by subtraction alone?