- [[statistics]], [[confounding variables when measuring value|confounding variables]], [[covariate]]
# Idea
> When the coefficient of interest is an interaction, and confounds are a concern, _interacted_ controls are needed.
> If the effect of interest in a regression is an interaction, the control variables addressing possible confounds should be interactions as well.
Let's say we're interested in the interaction between variables $x_1$ and $x_2$:
$y = b_0 + b_1x_1 + b_2x_2 + b_3 x_1x_2$
If we think a third variable $x_3$ is correlated with both $x_1$ (predictor) and $y$ (outcome), it's not enough to just include the main effect of $x_3$:
$y = b_0 + b_1x_1 + b_2x_2 + b_3 x_1x_2 + (b_4 x_3)$
Instead, we must estimate the following (**interacted controls**):
$y = b_1e + b_2f + b_3ef + b_4g + b_5gf$
$y = b_0 + b_1x_1 + b_2x_2 + b_3 x_1x_2 + (b_4 x_3 + b_5 x_3 x_2)$
## Example
We're interested in $b_3$, the interaction between $treatment$ and $x_1$:
$y = b_0 + b_1treatment + b_2 x_1 + b_3 treatment \times x_1$
There's a variable $x_2$ we want control for when interpreting the effect of $treatment$ (which covaries with $x_2$). So we need **interacted controls**:
$y = b_0 + b_1treatment + b_2 x_1 + b_3 treatment \times x_1 + (b_4x_2 + b_5 x_1 \times x_2)$
```r
m_base <- lm(y ~ repetition * treatment)
m_control <- lm(y ~ repetition * (treatment + age + gender + role))
```
# References
- [data colada](https://datacolada.org/80)
- [[Yzerbyt 2004 adjusting researchers approach to adjustment - on the use of covariates when testing interactions]]
![[bafkreihwwk5bl6pudoawcoo2vdyumgnflc7du7lhkf5mkqscrbunhjzt4u.jpg]]