2
$\begingroup$

I have a procedure for generating the design matrix of an experiment that uses only fixed effect predictors.

The procedure depends on knowing the relationship between all pairs of predictors in the experiment: crossed or nested. Then, based on these pairwise crossed/nested relationships, the design matrix is constructed in a series of steps.

The procedure is described here:


Step 1 - Intercept Column

Create a single column that has N elements, where N is the total number of data points collected for the experiment, and write a 1 in every element.

Step 2 - Simple Effects of Non-Nested Categorical Predictors

A categorical unordered predictor that is not nested within any other predictors has (P-1) simple effect columns, where P is equal to the number of levels of the predictor. For each column, write 1's for the data points that are associated with the level that is associated with that column.

Step 3 - Nested Simple Effects of Nested Categorical Predictors

A categorical unordered predictor that is nested within one or more other predictors has (L * (Q-1)) nested simple effect columns, where L is the number of levels or level combinations of the nesting predictor or predictors, and Q is the number of nested levels per each nesting level/level combination.

Step 4 - Simple Effects of Numerical Predictors

Create a single column, and fill in the column elements with the numerical values of the predictor associated with the data points of the experiment.

Step 5 - Two-Way Interactions

For every pair of simple effect columns between different predictors, multiply them together.

Step 6 - Three-way Interactions

For every trio of simple effect columns between different predictors, multiply them together.


My question is: Does this procedure appear correct? Am I missing any important concepts for the construction of fixed effect design matrices?

$\endgroup$

1 Answer 1

2
$\begingroup$

It does appear correct, however it is only one of infinitely many possible approaches, as when you have a $n\times p$ design matrix $X$ then any $n\times p$ matrix $X'$ with the same image, i.e. the span(https://en.wikipedia.org/wiki/Linear_span) of its columns, would define the same model, with a different parameterization. The image of $X$ can be thought of as the set of all possible linear predictors you could fit.

The only really common deviation from what you describe would be using contrasts (https://en.wikipedia.org/wiki/Contrast_(statistics)) instead of the R-default of dummy-variables (https://en.wikipedia.org/wiki/Dummy_variable_(statistics)).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.