The design matrix contains the predictors in a matrix (X) with n rows, where n is the number of observations. There is a column for each linearly independent coefficient in the model. Because one coefficient is linearly dependent on the others, the number of columns to represent the batch term is one less than the number of batches. Batches use −1, 0, 1 coding.
To calculate the columns for an interaction term, multiply all of the corresponding values for the predictors in the interaction. For example, suppose the first observation has a value of 4 for predictor A and a value of 2 for predictor B. In the design matrix, the interaction between A and B is represented as 8 (4 x 2).