Why a Conditional Slope Has Its Own Standard Error
In an interaction model, the slope for one quantitative predictor depends on the value of the other predictor. A fitted slope at a specified value is therefore a combination of estimated regression coefficients, not simply one coefficient read from an output table. Its standard error must account for the uncertainty in each coefficient and how their estimates vary together.
This matters when describing how a fitted relationship changes across predictor values. A coefficient table may report standard errors for individual coefficients, but those entries alone are not enough to calculate the standard error of every conditional slope. The covariance between the relevant coefficient estimates is also needed.
The Model and Conditional Slope
Consider a regression model with response \(Y\), quantitative predictors \(x_1\) and \(x_2\), and their product:
Here, \(\beta_0,\beta_1,\beta_2,\beta_3\) are population regression coefficients, and \(\varepsilon_i\) is the error for observation \(i\). For the usual ordinary least squares standard errors, assume the conditional mean is correctly represented by this model, errors have mean zero, observations have independent errors, and the errors have a common variance \(\sigma^2\). The model matrix must have enough independent information to estimate the coefficients. Normal errors are not needed just to calculate the standard error; they are relevant to some exact small-sample inferential results.
Holding \(x_2\) at a particular value \(z\), the conditional mean is
Thus the slope of the conditional mean with respect to \(x_1\), when \(x_2=z\), is \(\beta_1+z\beta_3\). Replacing population coefficients with their estimates gives the estimated conditional slope \(\hat{\beta}_1+z\hat{\beta}_3\).
Deriving the Variance
The variance of a sum depends on both the variances of its terms and their covariance. For two random quantities \(A\) and \(B\), and a fixed number \(z\),
Apply this identity to \(A=\hat{\beta}_1\) and \(B=\hat{\beta}_3\). The value \(z\) is the specified predictor value, not an estimated coefficient.
The hats on the variance and covariance indicate that these quantities are estimated from the fitted model. The standard error is the nonnegative square root:
This expression can also be obtained by writing the coefficient combination as a vector product. The variance of a linear combination is the coefficient vector multiplied by the coefficient covariance matrix and then by the vector's transpose. For this slope, the vector is \((1,z)\), so multiplying out the two-by-two covariance matrix gives the same three terms above. This derivation shows why a coefficient covariance matrix, rather than only separate coefficient standard errors, is required.
If a regression output gives standard errors \(SE(\hat{\beta}_1)\) and \(SE(\hat{\beta}_3)\), their squared values provide the two estimated variances. The covariance is a separate quantity; it is not generally zero. Some outputs provide it directly in a covariance matrix. If the output instead provides the correlation between the two estimates, multiply that correlation by their standard errors to obtain their covariance.
Worked Example: Standard Error at a Specified Predictor Value
Suppose a hypothetical model predicts exam score \(Y\), measured in points, from weekly study hours \(x_1\) and a preparation score \(x_2\), also measured in points. The model includes the product \(x_1x_2\). At \(x_2=4\), calculate the estimated conditional slope of study hours and its standard error using these hypothetical coefficient estimates and covariance entries:
- \(\hat{\beta}_1=1.60\), with \(\widehat{\operatorname{Var}}(\hat{\beta}_1)=0.2025\)
- \(\hat{\beta}_3=0.080\), with \(\widehat{\operatorname{Var}}(\hat{\beta}_3)=0.0009\)
- \(\widehat{\operatorname{Cov}}(\hat{\beta}_1,\hat{\beta}_3)=-0.006\)
The estimated conditional slope is
At preparation score 4, the fitted mean exam score increases by an estimated 1.92 points for each additional weekly study hour. To calculate its standard error, substitute \(z=4\) and the supplied variance and covariance estimates:
Therefore,
The covariance is negative, so its contribution reduces the estimated variance at this positive value of \(z\). The resulting variance remains positive, as required for a variance.
The Predictor Value Changes the Calculation
The variance formula depends on \(z\). Its second term grows with \(z^2\), while the covariance contribution changes with \(z\) and with the sign of the covariance. Consequently, the standard error need not increase steadily as the predictor value moves away from zero. Its pattern depends on all three entries: the two coefficient variances and their covariance.
At \(z=0\), the conditional slope of \(x_1\) is \(\beta_1\), and its standard error reduces to \(SE(\hat{\beta}_1)\). At other values, both the interaction coefficient's variance and its covariance with \(\hat{\beta}_1\) contribute. The specified value must be in the same units and scale used to fit the model. If the predictor was centered or rescaled, use values on that transformed scale.
Worked Example: A Different Value and a Negative Covariance
In another hypothetical fitted interaction model, suppose the estimated slope of \(x_1\) at \(x_2=6\) is formed from \(\hat{\beta}_1=0.75\) and \(\hat{\beta}_3=-0.040\). Suppose the estimated variances are \(0.0900\) and \(0.000400\), respectively, and their estimated covariance is \(-0.00300\). Calculate the slope estimate and its standard error.
The estimated conditional slope is
Its estimated variance is
Therefore the standard error is
If \(Y\) is measured in response units and \(x_1\) in its own units, this standard error has units of response units per \(x_1\) unit. It describes the sampling variability of the estimated slope at \(x_2=6\); it is not a measure of the spread of individual responses around the fitted mean.
The Other Conditional Slope
The same reasoning applies when calculating the slope of \(x_2\) at a specified value \(x_1=c\). Holding \(x_1=c\), the slope is \(\beta_2+c\beta_3\), so its estimated variance uses the variances of \(\hat{\beta}_2\) and \(\hat{\beta}_3\), together with their covariance:
Worked Example: Standard Error for the Other Predictor's Slope
For a separate hypothetical fit, suppose the estimated slope of \(x_2\) at \(x_1=3\) is based on \(\hat{\beta}_2=-0.50\) and \(\hat{\beta}_3=0.080\). The estimated variances are \(0.250\) and \(0.00160\), and the estimated covariance is \(0.0100\). Calculate the conditional slope and standard error.
The estimated slope is
Its estimated variance and standard error are
This standard error is in response units per unit of \(x_2\). The positive covariance increases the variance here because the specified value \(c=3\) is positive.
A Common Mistake: Dropping the Covariance
A tempting calculation is to combine the two coefficient standard errors as though \(\hat{\beta}_1\) and \(\hat{\beta}_3\) were independent. That reasoning omits the covariance term. In the first example, omitting it would give a variance of \(0.2025+16(0.0009)=0.2169\) and a standard error of about \(0.4657\), rather than the correct \(0.4110\). The error can go in either direction: a positive covariance may increase the variance for positive \(z\), while a negative covariance may decrease it.
The correct procedure is to use the covariance estimate from the fitted model, along with both coefficient variances. A negative covariance does not make a variance invalid by itself; it is one contribution to the full expression. The combined result must be nonnegative, apart from possible tiny rounding discrepancies in reported output.
Check Your Understanding
Use the variance-of-a-linear-combination rule to answer these questions.
- Write the estimated conditional slope of \(x_1\) when \(x_2=z\), and state which two estimated coefficients determine it.
- If \(z=0\), what does the conditional slope standard error reduce to?
- For positive \(z\) and negative covariance between \(\hat{\beta}_1\) and \(\hat{\beta}_3\), does the covariance term increase or decrease the estimated variance?
- Suppose the covariance is not reported, but the correlation and both coefficient standard errors are available. How can you obtain the covariance?
- Explain why the standard error of a conditional slope is not the standard deviation of individual responses around the fitted mean.