Algebraic Expression
We can just as easily reshape the linear equation you have below (I changed $a$ to $\beta_0$ for consistency in notation):
$$
y = \beta_0 + \beta_1{X} + \beta_2{Z} + \beta_3{W} + \beta_4{XZ} + \beta_5{XW} + \epsilon
$$
Into this congruent equation, re-expressed with $X$ as the conditional effect (see Aiken & West, 1991, p.13):
$$
y = (\beta_1 + \beta_4Z + \beta_5{W})X + \beta_0 + \beta_2Z + \beta_3W + \epsilon
$$
You can then see that the intercept and individual main effects of $\beta_2Z$ and $\beta_3W$ are unchanged (and algebraically, neither is $\beta_1X$). The only parts that are not additive here are the products formed from $\beta_4XZ$ and $\beta_5XW$. We are only estimating the products of $X$ with $W$ and $Z$ explicitly for interactions. So to be explicit, the $XW$ here is an interaction, albeit a simple two-way interaction between $X$ and $W$. I assume here that three-way interactions have not been modeled in this equation, else it would be included as another coefficient.
The interpretation for this model is still the same. You set all the $\beta$ coefficients to zero, thereafter a change in one coefficient is conditional on all the rest being equal to zero. To find out what the effect of $X$ is on the outcome, we can just plug this into our earlier re-expressed equation like so, leaving only our $\beta_0$ and $\beta_1$ alone:
$$
y = (\beta_1 + 0 + 0)X + \beta_0 + 0 + 0 + \epsilon
$$
Which simplifies to:
$$
y = \beta_0 + \beta_1{X} + \epsilon
$$
Simulated Example
Using your example above, we can simulate this directly in R, setting all of the mean and standard deviations to their defaults with $n = 1000$.
#### Simulate Data ####
set.seed(123)
n <- 1000
x <- rnorm(n)
y <- rnorm(n)
z <- rnorm(n)
w <- rnorm(n)
Then we can fit the data into a regression which explicitly models the main effects of $X$,$W$,and $Z$, along with the interactions with $X$.
#### Fit Data ####
fit <- lm(
y ~ x + z + w + x:z + x:w
)
summary(fit)
The results can be shown below:
Call:
lm(formula = y ~ x + z + w + x:z + x:w)
Residuals:
Min 1Q Median 3Q Max
-2.7916 -0.6280 -0.0261 0.6446 3.4334
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.01657 0.03105 -0.534 0.5937
x 0.02560 0.03073 0.833 0.4050
z 0.05043 0.03112 1.620 0.1055
w -0.01367 0.03104 -0.440 0.6598
x:z -0.05401 0.03003 -1.798 0.0724 .
x:w -0.05447 0.03035 -1.795 0.0730 .
Signif. codes: 0 ‘*’ 0.001 ‘’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.9761 on 994 degrees of freedom
Multiple R-squared: 0.009623, Adjusted R-squared: 0.004641
F-statistic: 1.932 on 5 and 994 DF, p-value: 0.08655
Using the example I gave earlier, we can simply set $W$ and $Z$ to zero and $X$ to an arbitrary value of $2$. By creating new data, we simply fill this into our linear equation and use predict to see what it should come out as:
#### Create New Data ####
new.data <- data.frame(
z = 0,
w = 0,
x = 2
)
Predict New Data
pred <- predict(fit,
newdata = new.data)
The estimated value of the prediction is $0.03462692$. If we calculate our coefficients the same way we spoke about earlier, we should get the same result as the pred object (I have commented which of our $\beta$ coefficients go where in hash comments next to the R code, as by default R codes the coefficients by their sequential order):
#### Check if Predicted Outcome Matches Coefficients ####
pred == (
fit$coefficients[1] # beta 0
+ (fit$coefficients[2] * 2) # beta 1
+ (fit$coefficients[3] * 0) # beta 2
+ (fit$coefficients[4] * 0) # beta 3
+ (fit$coefficients[5] * 0) # beta 4
+ (fit$coefficients[6] * 0) # beta 5
)
By doing so, our prediction comes true:
1
TRUE
Citation
Aiken, L. S., & West, S. G. (1991). Multiple regression: Testing and interpreting interactions. Sage Publications.