# General linear model with a quantitative covariate in the presence of a repeated-measures factor

Suppose that we have a response variable that is measured on each subject. There are 2 categorical variables (factors): one between-subject factor Group with two levels (control and treatment) and one within-subject factor Category with three levels (high, moderate, and low). Such a 2 $\times$ 3 mixed ANOVA can be analyzed through a general linear model (GLM) by dummy coding the factors.

To demonstrate the GLM formulation, assume there are six subjects, three in each group, and we have the following equation with effect coding:

$$\begin{bmatrix} y_{11} \\ y_{12} \\ y_{13} \\ y_{21} \\ y_{22} \\ y_{23} \\ y_{31} \\ y_{32} \\ y_{33} \\ y_{41} \\ y_{42} \\ y_{43} \\ y_{51} \\ y_{52} \\ y_{53} \\ y_{61} \\ y_{62} \\ y_{63} \end{bmatrix} = \begin{bmatrix} 1 & 1 & 1 & 0 & 1 & 0 & 1 & 0 & 0 & 0\\ 1 & 1 & 0 & 1 & 0 & 1 & 1 & 0 & 0 & 0\\ 1 & 1 & -1 & -1 & -1 & -1 & 1 & 0 & 0 & 0\\ 1 & 1 & 1 & 0 & 1 & 0 & 0 & 1 & 0 & 0\\ 1 & 1 & 0 & 1 & 0 & 1 & 0 & 1 & 0 & 0 \\ 1 & 1 & -1 & -1 & -1 & -1 & 0 & 1 & 0 & 0 \\ 1 & 1 & 1 & 0 & 1 & 0 & -1 & -1 & 0 & 0\\ 1 & 1 & 0 & 1 & 0 & 1 & -1 & -1 & 0 & 0\\ 1 & 1 & -1 & -1 & -1 & -1 & -1 & -1 & 0 & 0 \\ 1 & -1 & 1 & 0 & -1 & 0 & 0 & 0 & 1 & 0 \\ 1 & -1 & 0 & 1 & 0 & -1 & 0 & 0 & 1 & 0\\ 1 & -1 & -1 & -1 & 1 & 1 & 0 & 0& 1 & 0 \\ 1 & -1 & 1 & 0 & -1 & 0 & 0 & 0& 0 & 1 \\ 1 & -1 & 0 & 1 & 0 & -1 & 0 & 0& 0 & 1 \\ 1 & -1 & -1 & -1 & 1 & 1 & 0 & 0& 0 & 1 \\ 1 & -1 & 1 & 0 & -1 & 0 & 0 & 0& -1 & -1 \\ 1 & -1 & 0 & 1 & 0 & -1 & 0 & 0& -1 & -1 \\ 1 & -1 & -1 & -1 & 1 & 1 & 0 & 0& -1 & -1 \end{bmatrix}\\ \begin{bmatrix} \beta_0 \\ \beta_1 \\ \beta_2 \\ \beta_3 \\ \beta_4 \\ \beta_5 \\ \beta_6 \\ \beta_7 \\ \beta_8 \\ \beta_9 \end{bmatrix}+\begin{bmatrix} \epsilon_{11} \\ \epsilon_{12} \\ \epsilon_{13} \\ \epsilon_{21} \\ \epsilon_{22} \\ \epsilon_{23} \\ \epsilon_{31} \\ \epsilon_{32} \\ \epsilon_{33} \\ \epsilon_{41} \\ \epsilon_{42} \\ \epsilon_{43} \\ \epsilon_{51} \\ \epsilon_{52} \\ \epsilon_{53} \\ \epsilon_{61} \\ \epsilon_{62} \\ \epsilon_{63} \end{bmatrix}$$

The $F$-statistic for each effect (e.g., main effects and interactions) is formulated with terms each of which is associated with a partial model with some columns removed from the model matrix.

Suppose I would like to also consider each subject's body weight as a covariate. I barely see any discussions of modeling such a covariate under the GLM framework. This is not really an ideal approach because it would presume that all the three categories have the same body weight effect. So what is exactly the difficulty here when a covariate is incorporated in a GLM? Broken orthogonality or something else?