# 12 Mixed-effects models

The multi-level linear modeling approach (sometimes called ’hierarchical modeling’ or ’derived variable analysis’ in other contexts) to longitudinal data analysis is conducted in two steps. First, linear models are used to examine the relationship between the dependent variable ($Y_{ij}$) and time ($T$) for every subject within the study. This is the level 1 model. Secondly, a linear model is used to examine the relationship between each of the parameters from these linear models and the treatment variable ($G$), which can be categorical or continuous (e.g., with treatment doses). This approach is equivalent to conducting the analogous mixed-effects model. The following illustrates the relationship between the two approaches.

The level 1 model,

$$Y_{ij}=\pi _{0}+\pi _{1}T_{ij}+\epsilon _{ij} \label{eq0} \tag{1}$$

with level 2 models,

\begin{align} \pi _{0} &=\gamma _{00}+\gamma _{01}G+\xi _{0i} \label{eq1} \tag{2} \\ \pi _{1} &=\gamma _{10}+\gamma _{11}G+\xi _{1i} \label{eq2} \tag{3} \end{align}

will be rewritten as a linear, mixed-effects model. First, substitute \eqref{eq1} and \eqref{eq2} into \eqref{eq0},

$$Y_{ij}=\gamma _{00}+\gamma _{01}G+\xi _{0i}+ (\gamma_{10}+\gamma _{11}G+\xi _{1i}) T_{ij}+\epsilon _{ij}$$

which can be rearranged,

$$Y_{ij}=\gamma _{00}+\gamma _{01}G+\gamma _{10}T_{ij}+ \gamma _{11}GT + \xi _{0i}+\xi _{1i}T_{ij}+\epsilon _{ij}$$

Then, relabel the parameters to fit the mixed model notation.

$$Y_{ij}= \underbrace{\beta _{1}+\beta _{2}G+\beta_{3}T_{ij}+\beta _{4}GT}_{fixed} + \underbrace{b_{i1}+b_{i2}T_{ij}+\epsilon _{ij}}_{random}$$