Factorial Design Model Matrix
For a $2^3$ design, the model matrix typically contains the columns
$$ 1,\ A,\ B,\ C,\ AB,\ AC,\ BC,\ ABC, $$where the factor columns are coded as $\pm 1$ and interaction columns are formed by multiplying the corresponding factor columns.
This matrix can be used to compute factorial effects. For example, in a $2^3$ design,
$$ \text{effect}(A) = \frac{1}{4}\sum_{r=1}^{8} x_{A,r} y_r. $$The same pattern applies to $B$, $C$, $AB$, $AC$, $BC$, and $ABC$.