Tutorials › Regression Analysis (Undergraduate) › Confidence Intervals for Conditional Slopes

Simple Slopes and Marginal Effects · Tutorial 376 of 991

Confidence Intervals for Conditional Slopes

Use a conditional-slope estimate and its standard error to construct and interpret a confidence interval at a chosen moderator value.

Intermediate 10 min read

What You'll Learn

  • Write the conditional slope for a continuous predictor at a chosen moderator value.
  • Calculate its standard error using coefficient variances and covariance.
  • Construct a t-based confidence interval with the model’s residual degrees of freedom.
  • Interpret the interval in the outcome’s units and in the specified moderator context.
  • Recognize why omitting the covariance term can give the wrong interval.

Why Conditional-Slope Intervals Matter

In an interaction model, the slope relating one predictor to the outcome depends on the value of another predictor, called the moderator. A single coefficient in the regression equation may therefore not describe the slope for every case. A confidence interval for a conditional slope summarizes the uncertainty about the slope at one stated moderator value, in the outcome’s units.

The central calculation combines two coefficient estimates. Its uncertainty depends not only on the uncertainty in each estimate, but also on how the estimates vary together. This covariance term is essential: leaving it out can make the interval too wide or too narrow.

Model and Conditional Slope

Consider observations \((X_i,Z_i,Y_i)\) described by the two-predictor interaction model

$$ Y_i=\beta_0+\beta_1X_i+\beta_2Z_i+\beta_3X_iZ_i+\varepsilon_i. $$

Here \(X_i\) is the predictor whose slope is of interest, and \(Z_i\) is the moderator. The model’s conditional mean at a fixed value \(Z_i=z\) is

$$ E(Y_i\mid X_i,Z_i=z) =(\beta_0+\beta_2z)+(\beta_1+\beta_3z)X_i. $$

Thus, at moderator value \(z\), the slope for \(X\) is \(\beta_1+\beta_3z\). Its estimate is \(b_1+b_3z\), where \(b_1\) and \(b_3\) are the fitted regression coefficients. If \(Z\) is a group indicator coded 0 and 1, the same expression gives the slope for each group by substituting its code.

Definition: A conditional-slope confidence interval is an interval estimate for the slope of \(X\) in the model’s conditional mean at a specified moderator value \(z\). Its point estimate is \(b_1+b_3z\), and its units are units of \(Y\) per unit of \(X\).

Standard Error and Confidence-Interval Formula

The estimated conditional slope is a linear combination of two estimated coefficients. Its estimated variance is

$$ \widehat{\operatorname{Var}}(b_1+b_3z) =\widehat{\operatorname{Var}}(b_1) +z^2\widehat{\operatorname{Var}}(b_3) +2z\widehat{\operatorname{Cov}}(b_1,b_3). $$

The standard error, denoted \(SE(b_1+b_3z)\), is the square root of this estimated variance. For a two-sided confidence level \(100(1-\alpha)\%\), the interval is

$$ (b_1+b_3z)\ \pm\ t_{1-\alpha/2,\,df}\,SE(b_1+b_3z), $$

where \(t_{1-\alpha/2,\,df}\) is the appropriate critical value from the \(t\) distribution, and \(df\) is the regression model’s residual degrees of freedom. In the four-coefficient model above, \(df=n-4\), provided the model is estimable and includes an intercept.

This usual \(t\)-interval is exact under the classical linear-model assumptions: the conditional mean has the specified linear form, the errors are independent with mean zero and a common variance, and the errors are normally distributed for exact small-sample inference. The model matrix must have full rank so its coefficients are estimable. In applications, assess whether the model form and error assumptions are plausible using the design, subject-matter knowledge, and appropriate residual diagnostics. The formula does not repair a misspecified mean model or dependent errors.

Why the Covariance Term Appears

The variance formula follows from the variance of a sum. For any random quantities \(A\) and \(B\), and fixed constants \(c\) and \(d\),

$$ \operatorname{Var}(cA+dB) =c^2\operatorname{Var}(A)+d^2\operatorname{Var}(B) +2cd\operatorname{Cov}(A,B). $$

Substitute \(A=b_1\), \(B=b_3\), \(c=1\), and \(d=z\). This gives the estimated variance of \(b_1+b_3z\), including the covariance term \(2z\widehat{\operatorname{Cov}}(b_1,b_3)\). The covariance can be positive, negative, or zero, so it may increase or decrease the variance. It cannot generally be discarded.

Under the stated normal-error model, the coefficient estimate \(b_1+b_3z\), after centering at its true value and scaling by its standard error, follows a \(t\) distribution with the residual degrees of freedom. Multiplying the standard error by the corresponding critical value gives a margin of error; adding and subtracting that margin produces the interval above.

Worked Example: A Conditional Slope at a Continuous Moderator Value

Suppose a hypothetical dose-response analysis fits the interaction model with dose \(X\) measured in milligrams and a continuous moderator \(Z\) measured in years. At \(z=3\) years, the fitted coefficients are \(b_1=0.50\) and \(b_3=-0.10\). The estimated variances are \(\widehat{\operatorname{Var}}(b_1)=0.020\) and \(\widehat{\operatorname{Var}}(b_3)=0.002\), and their estimated covariance is \(-0.001\). The model has \(df=46\). Construct a 95% interval.

The estimated slope at \(Z=3\) is

$$ b_1+b_3z=0.50+(-0.10)(3)=0.20 $$

outcome points per milligram. Its estimated variance is

$$ 0.020+3^2(0.002)+2(3)(-0.001) =0.020+0.018-0.006 =0.032. $$

Therefore \(SE=\sqrt{0.032}\approx0.1789\) outcome points per milligram. For 95% confidence with 46 degrees of freedom, \(t^*\approx2.013\). The margin of error is

$$ 2.013\sqrt{0.032}\approx0.3601. $$

The interval is

$$ 0.20\pm0.3601=(-0.1601,\ 0.5601) $$

outcome points per milligram. Under the model and its assumptions, the method used to construct intervals this way captures the true dose slope at \(Z=3\) years in 95% of repeated samples. For these hypothetical data, the interval is compatible with slopes from about \(-0.1601\) to \(0.5601\) outcome points per milligram at that moderator value. It is not a statement that there is a 95% probability that this fixed, unknown slope lies in this particular interval.

The hypothetical analysis is assumed to have a plausible linear conditional mean, independent errors, roughly constant residual spread, and residual behavior consistent with the normal-error model. These assumptions are needed for the stated interval procedure; the coefficient calculations alone do not establish them.

Worked Example: A Second Moderator Value in the Same Model

Use the same hypothetical fitted model and covariance information, but now find a 95% interval at \(Z=-1\) year. Assume this value is represented in the data and the model assumptions remain plausible.

The estimated conditional slope is

$$ 0.50+(-0.10)(-1)=0.60 $$

outcome points per milligram. Its estimated variance is

$$ 0.020+(-1)^2(0.002)+2(-1)(-0.001) =0.020+0.002+0.002 =0.024. $$

Thus \(SE=\sqrt{0.024}\approx0.1549\) outcome points per milligram. Using \(t^*=2.013\) for 46 degrees of freedom, the margin is \(2.013\sqrt{0.024}\approx0.3119\). The interval is

$$ 0.60\pm0.3119=(0.2881,\ 0.9119) $$

outcome points per milligram. This interval describes the slope at \(Z=-1\) year, not at \(Z=3\) years. Both intervals use the same fitted coefficients, but their centers and standard errors differ because the moderator value changes the conditional slope and the linear combination of coefficient estimates.

Worked Example: A Slope for One of Two Groups

Suppose a hypothetical study codes group A as \(Z=0\) and group B as \(Z=1\). The model uses \(X\) as a weekly activity measure and \(Y\) as a score. The fitted coefficients are \(b_1=1.20\) and \(b_3=-0.35\). For group B, the estimated coefficient variances are \(\widehat{\operatorname{Var}}(b_1)=0.0400\), \(\widehat{\operatorname{Var}}(b_3)=0.0225\), and \(\widehat{\operatorname{Cov}}(b_1,b_3)=-0.0100\), with \(df=28\). Assume the interaction model and error assumptions are reasonable for these data.

For group B, substitute \(z=1\). The estimated slope is \(1.20-0.35=0.85\) score points per weekly-activity unit. Its standard error is

$$ SE=\sqrt{0.0400+1^2(0.0225)+2(1)(-0.0100)} =\sqrt{0.0425} \approx0.2062. $$

For a 95% interval with 28 degrees of freedom, \(t^*\approx2.048\). The margin of error is \(2.048\sqrt{0.0425}\approx0.4222\). Therefore,

$$ 0.85\pm0.4222=(0.4278,\ 1.2722) $$

score points per weekly-activity unit. In the model, this gives a range of plausible values for the group B slope. The units are score points per unit of the weekly-activity measure; they are not score points per group or a difference between groups.

Interpreting and Reporting the Interval

A useful report identifies the outcome, predictor, moderator value, estimate, interval, and units. For example: “At a moderator value of 3 years, the estimated dose slope was 0.20 outcome points per milligram, with a 95% confidence interval from \(-0.1601\) to \(0.5601\) outcome points per milligram.” This wording makes clear which conditional slope is being described.

The interval’s width reflects the uncertainty in that particular linear combination of coefficients. It can change across moderator values even when the same model is used. Moderator values should be substantively meaningful and supported by the data; an interval calculated at a value far outside the observed range does not make extrapolation reliable.

Confidence intervals are useful because they show a range of effect sizes compatible with the fitted model and its assumptions, rather than reporting only a point estimate. Their interpretation depends on the model, sampling process, and error conditions; a narrow interval is not evidence that those conditions are satisfied.

Common Mistake

Common mistake: Treating the conditional slope’s standard error as \(\sqrt{\widehat{\operatorname{Var}}(b_1)+z^2\widehat{\operatorname{Var}}(b_3)}\), as though the coefficient estimates were necessarily unrelated. Correction: Include \(2z\widehat{\operatorname{Cov}}(b_1,b_3)\). The covariance is part of the variance of the sum, and omitting it changes the interval unless it is exactly zero.

A second interpretation error is to say that the interval gives the range of individual outcomes. It does not: it estimates a slope in the conditional mean. Individual outcomes also vary around that mean, which is a different kind of uncertainty.

Check Your Understanding

Use the model and interval ideas above to answer these questions.

  1. In the interaction model, what is the estimated slope for \(X\) at moderator value \(z\)?
  2. Why does the standard-error formula include \(2z\widehat{\operatorname{Cov}}(b_1,b_3)\)?
  3. If \(z=0\), which coefficient determines the conditional slope, and what terms remain in its estimated variance?
  4. State the units of a conditional slope if \(Y\) is measured in kilograms and \(X\) in hours.
  5. What does a 95% confidence procedure mean across repeated samples, and what does it not mean about the probability for one fixed interval?