Your approach is correct.
I often see the code written more explicitly with two multiplicative terms—only. To be clear, the following three models produce identical output:
# 1. Hard on the eyes, but it works
lm(Connectivity ~ (Complex-Attention + Memory) * MDD, data = D)
# 2. Explicit, but requires too many keystrokes
lm(Connectivity ~ Complex-Attention + Memory + Complex-Attention * MDD + Memory * MDD, data = D)
# 3. Less explicit, but allows software to do most of the work for you
lm(Connectivity ~ Complex-Attention * MDD + Memory * MDD, data = D)
I am partial to the third equation. R will return the constituent terms for you—for free.
What is even more important is your interpretation. The other variable (e.g.,
Memory) is held fixed—at 0. If you dropped the multiplicative term(s) entirely (i.e., no interaction), then the coefficient associated with your measure of "attention" is interpreted appropriately. However, in the presence of the interaction term(s), your coefficient of interest is now the effect of
Connectivity conditional on
Memory $= 0$. If your "memory" measure never equals 0, then this interpretation might be a bit quirky. Consider "centering"
Memory at its mean to improve the interpretive value of the model.
A meaningful main effect may exist in the presence of an interaction—even when the coefficient on the interaction term is itself not significant.