A two-level model, with one explanatory variable at the individual level $(X)$ and one explanatory variable at the group level $(Z)$ :

$Y_{ij}=\gamma_{00}+\gamma_{10}X_{ij}+\gamma_{01}Z_{j}+\gamma_{11}X_{ij}Z_{j}+u_{0j}+u_{1j}X_{ij}+e_{ij}\tag 1$

correlation between $u_{0j}$ and $u_{1j}$ is $0$ .

The matrix form of a mixed model collects the fixed effects in a vector $\boldsymbol \beta$, and the random effects in a vector $\boldsymbol u$ , and finally the random error term, which is also a random effect factor in the vector $\boldsymbol e$. A formal definition is $\boldsymbol Y=\boldsymbol X\boldsymbol\beta+\boldsymbol Z\boldsymbol u+\boldsymbol e\tag 2$

with $X$ the known design matrix for fixed effects and $Z$ the known design matrix for random effects .

Now I want to write down equation (1) in matrix form. But I wonder that the matrix equation does not capture the entire effect. It is missing the $X_{ij}Z_j$ term.

Say, in equation (1), I have 3 groups (J=3) and 2 individuals (i=2) in each group so that the total sample size, N=6 .

Then equation (2) will be,

$\boldsymbol Y= \begin{bmatrix} y_{11}\\ y_{21}\\ y_{12}\\ y_{22}\\ y_{13}\\ y_{23}\\ \end{bmatrix},\quad\quad \boldsymbol e= \begin{bmatrix} e_{11}\\ e_{21}\\ e_{12}\\ e_{22}\\ e_{13}\\ e_{23}\\ \end{bmatrix} $ , and is $\boldsymbol\beta= \begin{bmatrix} \gamma_{00} \\ \gamma_{10} \\ \gamma_{01}\\ \gamma_{11}\\ \end{bmatrix} ? $

How will be $\boldsymbol X$ , $\boldsymbol Z$ and $\boldsymbol u$ in equation (2) look like ? How can I conform the matrix equation of equation (1) ?

Any help is appreciated. Many thanks.

  • 2
    $\begingroup$ Take a look at Hox & Roberts (2011), they work through an example in matrix notation on pages 6-7. They collect all individual, group, and cross-level terms in $X$. $\endgroup$ – hplieninger Aug 14 '15 at 11:24
  • $\begingroup$ @hplieninger Would you like to post your comment as answer. Thank you very much for the link. $\endgroup$ – user81411 Aug 14 '15 at 12:39
  • $\begingroup$ The link , books.google.de/…, helps a lot. But how did they get $u_{1j}$math$_{ij}$ ? $\endgroup$ – user81411 Aug 14 '15 at 13:17
  • 1
    $\begingroup$ They simply call it $u_{1j}$ (but see their Eq (1.9)). $\endgroup$ – hplieninger Aug 14 '15 at 13:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.