Why Test a Conditional Effect?
An interaction model allows the relationship between a predictor and an outcome to vary with another variable. A fitted model can therefore imply different slopes or group differences at different moderator values. A confidence interval describes uncertainty about one such conditional effect; a hypothesis test asks whether that effect is consistent with a particular specified value.
For example, a researcher might ask whether the association between exercise and a well-being score is zero among people who sleep five hours per night. Or the question might be whether a tutoring group’s predicted test score differs from the comparison group by exactly zero points for students who study ten hours per week. These are tests about effects at chosen moderator settings, not necessarily tests about a single interaction coefficient.
Model and Test
Consider a continuous predictor \(X\) and a moderator \(M\), with the interaction model
Here, the conditional mean of \(Y\) at \(X=x\) and \(M=m\) is \(\beta_0+\beta_1x+\beta_2m+\beta_3xm\). Holding \(M=m\) fixed, the slope for \(X\) is \(\beta_1+\beta_3m\). Its estimated value at a chosen setting \(m_0\) is \(b_1+m_0b_3\), where \(b_j\) denotes the fitted estimate of \(\beta_j\).
A related model uses a binary group indicator \(G\), coded 0 or 1, and a continuous moderator \(X\):
At \(X=x_0\), the predicted mean for group 1 minus the predicted mean for group 0 is \(\beta_2+x_0\beta_3\). Its estimate is \(b_2+x_0b_3\). The same testing method applies to either conditional slope or group contrast.
The usual regression t test relies on the model being correctly specified for the conditional mean, independent errors, constant error variance, and normally distributed errors for exact small-sample inference. Under these conditions, the fitted coefficient estimates have a covariance matrix estimated from the regression. Residual plots and knowledge of the data collection can help assess whether the assumptions are plausible. If the conditions are seriously questionable, the usual standard error and t reference distribution may not be suitable.
The test statistic compares the estimated effect with the null value, measured in standard-error units. For a model with \(p\) fitted coefficients and \(n\) observations, the residual degrees of freedom are \(df=n-p\). Under the stated classical model assumptions, the statistic follows a t distribution with these degrees of freedom when \(H_0\) is true.
The covariance matrix matters because estimates of different regression coefficients can vary together. In the special case of the slope \(\beta_1+m_0\beta_3\), its estimated variance is
For a two-sided alternative, the p-value is the probability, under \(H_0\) and the assumed t distribution, of a statistic at least as far from zero as the observed one:
A small p-value is evidence against the stated null value under the model assumptions. It is not the probability that \(H_0\) is true, nor does it measure the size or practical importance of the effect.
Calculating and Interpreting Conditional Tests
Worked Example: Testing a Conditional Slope Against Zero
In a hypothetical sample of 28 adults, a researcher fits an interaction model for a well-being score \(Y\), weekly exercise hours \(X\), and nightly sleep hours \(M\). The fitted conditional slope for exercise is \(b_1+m b_3\). At \(m_0=5\) hours of sleep, suppose \(b_1=1.20\) well-being points per exercise hour and \(b_3=-0.08\) well-being points per exercise hour per sleep hour. The estimated variances are \(\widehat{\operatorname{Var}}(b_1)=0.0400\), \(\widehat{\operatorname{Var}}(b_3)=0.000400\), and \(\widehat{\operatorname{Cov}}(b_1,b_3)=-0.00100\). Test whether the conditional slope is zero.
The sample is described as having one independently observed outcome per adult. Suppose the fitted mean pattern is judged reasonable and residual checks do not show major departures from constant variance or normality. These conditions make the usual t procedure plausible for this hypothetical analysis. The chosen sleep value of five hours is within the observed moderator range.
The hypotheses are \(H_0:\beta_1+5\beta_3=0\) and \(H_a:\beta_1+5\beta_3\ne 0\). First calculate the conditional slope estimate:
Its standard error includes the covariance term:
There are four fitted coefficients and 28 observations, so \(df=28-4=24\). The test statistic is
The two-sided p-value from a t distribution with 24 degrees of freedom is approximately 0.00053. This is strong evidence that the exercise slope among adults sleeping five hours per night is not zero under the model. The estimated slope is positive: the fitted mean well-being score increases by 0.80 points per additional weekly exercise hour at that moderator setting. The result does not establish that exercise causes the increase.
Worked Example: Testing a Group Contrast at a Chosen Value
Suppose a hypothetical study models a test score \(Y\) using weekly study hours \(X\), tutoring status \(G\) (1 for tutoring and 0 for comparison), and their interaction. There are 40 independent students. The estimated tutoring-minus-comparison contrast at \(X=10\) study hours is \(b_2+10b_3\), with \(b_2=3.00\) points and \(b_3=-0.200\) points per study hour. Suppose \(\widehat{\operatorname{Var}}(b_2)=0.640\), \(\widehat{\operatorname{Var}}(b_3)=0.00250\), and \(\widehat{\operatorname{Cov}}(b_2,b_3)=-0.0200\). Test whether the group contrast at ten study hours is zero.
Assume the model’s conditional mean is adequate and the residual checks support independent, approximately constant-variance, approximately normal errors. The setting of ten hours lies within the study-hour range for both groups, so this contrast is not obtained by extrapolating beyond the observed data. The hypotheses are \(H_0:\beta_2+10\beta_3=0\) and \(H_a:\beta_2+10\beta_3\ne 0\).
The estimated contrast is
Its standard error is
With four coefficients and 40 observations, \(df=36\). Thus,
The two-sided p-value is approximately 0.162. At a significance level of 0.05, this is not sufficient evidence that the tutoring and comparison groups differ in mean test score among students studying ten hours per week. The estimated difference is one point in favor of the tutoring group, but the test does not establish that the true conditional difference is exactly zero.
Why the Covariance Term and the Null Value Matter
The standard error is not generally found by adding coefficient standard errors, and it is not generally correct to ignore covariance. The variance formula follows from the variance of a sum. For random estimates \(B_1\) and \(B_3\), and a fixed value \(m_0\),
To see the covariance contribution, subtract the means and expand the squared deviation:
The same reasoning gives \(L\widehat{\operatorname{Cov}}(\mathbf{b})L^{\mathsf T}\) for any linear combination. The null value \(c\) also matters: a test of whether a conditional slope equals 1.0 is not the same test as whether it equals zero.
Worked Example: Testing a Nonzero Slope Value
In another hypothetical interaction analysis, the estimated slope of \(X\) at moderator value \(m_0=4\) is \(b_1+4b_3\), where \(b_1=0.90\) and \(b_3=0.10\). Suppose the estimated variances are 0.0900 and 0.00250, respectively, and their covariance is 0.00300. There are 34 observations and four fitted coefficients. Test the two-sided hypothesis that the conditional slope equals 1.0 outcome point per unit of \(X\).
Assume the conditional mean specification and the independent, constant-variance, normally distributed error conditions are plausible based on the design and residual checks. The chosen moderator value is within the range studied. The estimate is
The standard error and test statistic are
The residual degrees of freedom are \(34-4=30\), and the two-sided p-value is approximately 0.450. The data do not provide strong evidence that this conditional slope differs from 1.0 outcome point per unit of \(X\). This conclusion concerns the specified value 1.0; it is not a test that the slope is zero.
Common Mistakes and Practical Interpretation
- Testing only the interaction coefficient. Testing \(H_0:\beta_3=0\) asks whether the slope changes with the moderator. It does not test whether the slope at a particular \(m_0\) equals zero or another value. The conditional-effect test uses the full combination, such as \(\beta_1+m_0\beta_3\).
- Leaving out covariance. Adding only the two variance terms can produce the wrong standard error. Include \(2m_0\widehat{\operatorname{Cov}}(b_1,b_3)\), or use the full coefficient covariance matrix.
- Comparing the estimate directly with the null. A difference such as \(1.00-0\) does not show whether that difference is large relative to its uncertainty. Divide by the standard error to obtain the t statistic.
- Reading a large p-value as proof of equality. A large p-value means the data do not provide strong evidence against the tested value; it does not show that the effect equals that value exactly.
- Ignoring the choice of moderator setting. State the chosen value, its units, and the conditional effect being tested. A result at one setting does not automatically describe the effect at other settings.
If several moderator values are tested and only the most favorable result is reported, the nominal p-value can give an overly optimistic picture of evidence. The chosen setting and hypothesis should be motivated and reported clearly. Always interpret the estimated effect and uncertainty in the outcome’s units, alongside the p-value.
Check Your Understanding
Use the model and assumptions described above to answer these questions.
- In the model with continuous \(X\) and \(M\), write the conditional slope for \(X\) at \(M=m_0\), and state the null hypothesis for testing whether it equals \(c\).
- Why does the variance of \(b_1+m_0b_3\) include a covariance term?
- In a group-by-continuous interaction model, what does testing \(\beta_3=0\) ask, and how does that differ from testing the group contrast at \(X=x_0\) equals zero?
- A two-sided test gives \(t=2.1\) with a small p-value. What does that p-value describe under the null and model assumptions?
- Why is it incorrect to interpret a nonsignificant test of \(H_0:L\boldsymbol{\beta}=c\) as proof that the conditional effect equals \(c\)?