In the mixed effects models, we have

$$ y = X\beta + Zu + \epsilon $$

where $u$ : mixed effects unknown vector, and $Z$: mixed effects design matrix.

I assume $\mathbb{u}_p \sim N(0, \sigma I_p)$ and would like to know how much freedom I have with respect to the choice of $Z$.

I know that in many cases $Z = \begin{bmatrix} 1_{q_1} & 0 & 0 &\cdots & 0 \\ 0 & 1_{q_2} & 0 &\cdots & 0 \\ \vdots & \vdots & \vdots & & \vdots \\ 0 & 0 & 0 &\cdots & 1_{q_p} \\ \end{bmatrix}$ where $q_i$'s are vectors of $1$.

But is there any constraint that prevents me from choosing $Z$ other than the above? Any example will be appreciated


1 Answer 1


In general, you do not have any restrictions in the specification of the $Z$ matrix, but making it too complex often makes the model unstable.

In the typical case, this is a block diagonal matrix with each block corresponding to a level of your grouping variable. For each block, you can include multiple random effects, e.g., random slopes. This can be extended to a nested design in which you have inner block diagonal parts within outer block diagonal parts. Then you can also have crossed random effects in which case you do not have the block diagonal structure anymore. Often with these designs, the resulting matrix is sparse (i.e., containing many zeros).


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.