Tutorials › Introduction to Statistics › Comparing Mean Responses at Two Predictor Values

Inference for the Regression Slope · Tutorial 917 of 996

Comparing Mean Responses at Two Predictor Values

Use the separation between two predictor values and a slope interval to estimate and quantify uncertainty in the difference between their population mean responses.

Intermediate 9 min read

What You'll Learn

  • Define the population mean response at a predictor value and the difference between two such means.
  • Show why the intercept cancels when comparing mean responses.
  • Transform a confidence interval for the population slope into one for a mean-response difference.
  • Handle positive, negative, and zero separations without misordering interval endpoints.
  • Interpret the estimate and interval in response units and distinguish them from individual predictions.

Comparing Mean Responses at Two Predictor Values

A regression slope describes how the population mean response changes as the predictor changes. That makes it useful for answering a direct comparison question: how different are the mean responses at two particular predictor values? For example, a health researcher might want to compare the mean response for people with predictor values of 4 and 10 units. The comparison is about population means, not about predicting the response of a particular individual.

In a simple linear regression model, the difference between those two mean responses is the population slope multiplied by the distance between the predictor values. This relationship also gives a direct way to turn a confidence interval for the slope into one for the mean-response difference.

Definition: In the simple linear regression model, the population mean response at predictor value \(x\) is \(\mu(x)=E(Y\mid X=x)=\beta_0+\beta_1x\). For two specified predictor values \(x_1\) and \(x_2\), define \(d=x_2-x_1\) and the mean-response difference, in that order, as \(\Delta=\mu(x_2)-\mu(x_1)\). Thus, \(\Delta=\beta_1d\).

The order in the definition matters: the comparison is the mean at \(x_2\) minus the mean at \(x_1\). If \(d\) is positive, the second predictor value is larger; if \(d\) is negative, it is smaller. The sign of \(\Delta\) describes the direction of the difference in the stated order.

Why the Difference Depends on the Slope

The simple linear regression model for the mean response is \(\mu(x)=\beta_0+\beta_1x\), where \(\beta_0\) is the population intercept and \(\beta_1\) is the population slope. Subtract the mean at \(x_1\) from the mean at \(x_2\):

$$ \begin{aligned} \Delta &=\mu(x_2)-\mu(x_1)\\ &=(\beta_0+\beta_1x_2)-(\beta_0+\beta_1x_1)\\ &=\beta_1(x_2-x_1)\\ &=\beta_1d. \end{aligned} $$

The intercept cancels because it contributes equally to both mean responses. The fitted estimate of the difference is therefore \(\hat{\Delta}=b_1d\), where \(b_1\) is the estimated slope. If the slope is measured in response units per predictor unit, multiplying by a predictor separation gives the difference in response units.

For inference, use the usual simple linear regression slope model and its assumptions: the conditional mean is linear in the predictor, errors are independent, their variance is constant across predictor values, and the errors are normally distributed for exact small-sample \(t\) inference. The predictor values should also be within the range supported by the data; using a fitted line far beyond that range requires extrapolation. These are the conditions used for slope inference. When they are reasonable, a confidence interval for the population slope can be used to infer the corresponding difference in mean responses.

Transforming a Slope Confidence Interval

Suppose a confidence interval for \(\beta_1\) is \([L,U]\), with \(L\leq U\). Since \(\Delta=d\beta_1\), multiply both slope endpoints by \(d\). Multiplication by a positive number preserves their order, while multiplication by a negative number reverses it. When \(d=0\), the two mean responses are at the same predictor value and their difference is exactly zero.

Result: A confidence interval \([L,U]\) for the population slope transforms to the following confidence interval for \(\Delta=\mu(x_2)-\mu(x_1)\):

If \(d>0\), the interval is \([dL,dU]\). If \(d<0\), the interval is \([dU,dL]\). If \(d=0\), the interval is \([0,0]\).

The interval has the same confidence level as the slope interval, provided the regression model and slope-inference conditions are appropriate.

The estimate and standard error transform in parallel. The estimated difference is \(\hat{\Delta}=db_1\), and its standard error is \(SE(\hat{\Delta})=|d|SE(b_1)\). The absolute value is needed because a standard error cannot be negative.

$$ \operatorname{Var}(db_1)=d^2\operatorname{Var}(b_1) \quad\Longrightarrow\quad SE(db_1)=|d|SE(b_1). $$

For \(d\neq0\), this gives the same \(t\)-based interval as transforming the slope interval. For example, if the slope interval is \(b_1\pm t^*SE(b_1)\), scaling its endpoints gives an interval centered at \(db_1\), with margin \(t^*|d|SE(b_1)\). For \(d=0\), the difference is fixed at zero, so there is no sampling uncertainty about the difference between a mean response and itself.

Worked Example: A Positive Predictor Separation

In a hypothetical study of 12 participants, a researcher models an endurance score as a linear function of weekly training hours. The fitted slope is \(b_1=1.60\) score points per training hour, and \(SE(b_1)=0.350\) score points per training hour. A 95% slope interval uses \(df=n-2=10\) and \(t^*=2.228\). Estimate the difference in population mean endurance score between 4 and 10 training hours per week, and form a 95% confidence interval for that difference.

Assume that the hypothetical data show an approximately linear mean relationship, independent observations, roughly constant residual spread, and residuals consistent with the normal model. Both predictor values, 4 and 10 hours per week, are within the observed range. These conditions make the usual slope interval appropriate for this calculation.

First calculate the slope interval:

$$ 1.60\pm 2.228(0.350) =1.60\pm0.7798 =[0.8202,\ 2.3798] $$

Here \(x_1=4\) hours and \(x_2=10\) hours, so \(d=10-4=6\) hours. The estimated mean-response difference is:

$$ \hat{\Delta}=db_1=6(1.60)=9.60\text{ score points}. $$

Since \(d>0\), multiply the lower and upper slope limits by 6 in their existing order:

$$ [6(0.8202),\ 6(2.3798)] =[4.9212,\ 14.2788]\text{ score points}. $$

The estimated population mean endurance score at 10 training hours per week is 9.60 points higher than at 4 hours per week. The 95% confidence interval indicates that the mean difference, in this order, is plausibly between about 4.92 and 14.3 score points under the model. It is an interval for a difference in population means, not a range expected to contain 95% of individual score differences.

Worked Example: A Negative Predictor Separation

In a second hypothetical regression, response time is modeled against a predictor measured in units. The fitted slope is \(b_1=0.300\) seconds per predictor unit, with \(SE(b_1)=0.250\) seconds per predictor unit. For \(n=10\), a 95% slope interval has \(df=8\) and \(t^*=2.306\). Compare the population mean response at \(x_2=4\) units with the mean response at \(x_1=8\) units.

Suppose the observations are independent, the mean relationship is adequately linear, residual variability is roughly constant, residuals are reasonably consistent with a normal model, and 4 and 8 units are within the observed predictor range. Then the usual slope interval is suitable.

The slope interval is:

$$ 0.300\pm2.306(0.250) =0.300\pm0.5765 =[-0.2765,\ 0.8765]\text{ seconds per unit}. $$

Here \(d=x_2-x_1=4-8=-4\) units. The estimated difference is:

$$ \hat{\Delta}=(-4)(0.300)=-1.20\text{ seconds}. $$

Because \(d<0\), multiplying by \(d\) reverses the endpoint order. The transformed interval is:

$$ [dU,dL] =[(-4)(0.8765),\ (-4)(-0.2765)] =[-3.506,\ 1.106]\text{ seconds}. $$

The point estimate says the mean response at 4 units is 1.20 seconds lower than at 8 units. The interval includes zero, so these data do not rule out no difference in population mean response at the two values at the 95% confidence level. Reversing the comparison would change the signs: the difference for 8 units minus 4 units would have estimate \(1.20\) seconds and interval \([-1.106,3.506]\) seconds.

The Zero-Separation Case and What the Interval Means

If \(x_1=x_2\), then \(d=0\). The two terms in the comparison refer to the same population mean response, so their difference is zero by definition, regardless of the estimated slope or its uncertainty. This is not an approximation: the interval for the difference is exactly \([0,0]\). It would be incorrect to choose either endpoint-order rule for a nonzero separation in this case.

Worked Example: Comparing the Same Predictor Value

A hypothetical analysis considers the population mean response at \(x_1=15\) units and \(x_2=15\) units. Suppose the slope estimate is \(b_1=-0.80\) response units per predictor unit, with a 95% slope interval \([-1.30,-0.30]\). Find the estimated mean-response difference and its interval, defining the difference as the mean at \(x_2\) minus the mean at \(x_1\).

The separation is \(d=15-15=0\). Therefore:

$$ \hat{\Delta}=db_1=0(-0.80)=0\text{ response units}, \qquad CI_{\Delta}=[0,0]\text{ response units}. $$

Although the slope is estimated to be negative, it cannot create a difference between the same mean response and itself. Multiplying the slope interval endpoints by zero also gives \([0,0]\). This result concerns only the comparison at the identical predictor value; it does not say that the slope itself is known without uncertainty.

Common Mistakes and Interpretation

  • Reversing the comparison without changing the sign. The defined difference is \(\mu(x_2)-\mu(x_1)\). Swapping \(x_1\) and \(x_2\) changes \(d\), the estimate, and both interval signs.
  • Multiplying a negative separation and leaving the endpoints in the old order. If \(d<0\), then \(dU\leq dL\); report \([dU,dL]\), not \([dL,dU]\).
  • Forgetting the zero case. When \(d=0\), the transformed interval is \([0,0]\). The positive- and negative-separation rules do not apply.
  • Calling the interval an individual prediction interval. This procedure estimates a difference between two population mean responses. Individual responses vary around those means and are not described by this interval.
  • Subtracting endpoints from two separate mean-response intervals. The interval for a difference should be built from the slope interval and the specified separation. Subtracting separate interval endpoints does not, in general, give the confidence interval for this difference.
  • Interpreting a fitted comparison as causal. A regression-based difference describes the modeled association between predictor values and mean response. It does not establish that changing the predictor would cause the response to change.
Key takeaway: For the ordered comparison \(\mu(x_2)-\mu(x_1)\), calculate \(d=x_2-x_1\). The estimated difference is \(db_1\), and a slope interval \([L,U]\) becomes \([dL,dU]\) for \(d>0\), \([dU,dL]\) for \(d<0\), and \([0,0]\) for \(d=0\). Interpret the result in response units and in the comparison's stated order.

Check Your Understanding

Try these questions without looking back.

  1. Write the formula for the population mean-response difference \(\mu(x_2)-\mu(x_1)\) in terms of the population slope and the predictor separation.
  2. A slope interval is \([0.4,1.1]\), and \(x_2-x_1=3\). What is the transformed interval, and why does its endpoint order stay the same?
  3. A slope interval is \([-0.5,0.2]\), and \(x_2-x_1=-2\). Give the transformed interval with its endpoints in the correct order.
  4. What is the interval for the difference if \(x_1=x_2\), and why does that result not imply that the slope is known exactly?
  5. In one sentence, distinguish an interval for a difference between two population mean responses from an interval for an individual response.