# Linear mixed-effects regression on longitudinal data: Multicollinearity

Panel data: subjects' value are repeatedly measured over time points. Suppose the first half was the pretest (grp=0) and the second half received the intervention (grp=1).

Take this post as an example:

  ID | time | grp | value |
s_1| 1    |  0  | Q_11  |
s_1| 2    |  0  | Q_12  |
s_1| 3    |  0  | Q_13  |
s_1| 4    |  1  | Q_14  |
s_1| 5    |  1  | Q_15  |
s_1| 6    |  1  | Q_16  |


Now, run a linear mixed-effecs regression value ~ time * factor(grp) + (time | ID). Each subject ID will have its own intercept and slope over time.

However, my concern is that grp can be derived from time, i.e., grp = ifelse(time <=3, 0, 1). This may be collinearity (I wonder if that's the exact word to use because one variable is categorical).

How do I fix the issue or even conduct another model? Thanks.

You don't need to be concerned. Multicolinearity occurs when one column of the design matrix (the matrix of values of predictor variables) can be derived as a linear combination of the other columns. Your variable grp does not fall into that category.
As another example, consider the case of a polynomial regression model with the continuous predictors $$x$$ and $$x^2$$. The latter can be derived from the former -- and the two are correlated -- but multicolinearity isn't usually a problem (e.g., parameter estimates and their SEs are usually stable).