## Linear Mixed Model

### Linear Mixed Model - a brief demo:

In a GLM setting,

y=Xβ+ε

only *ε* is the random effect:

*ε* is normally distributed and has a mean of zero. If you applied regression with such assumption, then it doesn't matter your data is actually from multiple subjects:

*The data are the same as above, with each subject outlined in different color*

In real life research, things usually get messy, for example:

or

And these situations can be handle perfectly in a Linear Mixed Model, which expressed these effect as random:

y=Xβ+Zb+ε

In , we can expressed the subject intercept as the random effect, which gives us a random intercept model.

In , we just add the fixed predictor as a separate column into the **Z** from above, returning a random intercept and slope model.

And the same could be applied with categorical predictor, for example, a random slope model below (with no random intercept):

Using linear mixed model, you can take into account effects such as mixed-effect (i.e., both within- and between- subject effect) and repeated measurements. And with *i*Map4, you can now apply this powerful model on your eye tracking data as well!

Mixed model is a complex subject, and many underlying details are beyond the scope of this paper. For a general thoughtful introduction to mixed models, users of the toolbox should refer to Raudenbush & Bryk (2002) and McCulloch, Searle & Neuhaus (2011).

### Linear Mixed model in Matlab

*i*Map4 calls *LinearMixedModel* from Matlab for model estimations. You can find the relate concepts in Matlab help file:

Linear Mixed-Effects Models

This page explains the basic concept of Linear Mixed Model.

Estimating Parameters in Linear Mixed-Effects Models

This page explains the methods for estimating parameters in Matlab: Maximum likelihood estimation (ML) and Restricted maximum likelihood estimation (ReML).

Linear formula notation (Wilkinson Notation)

This page explains how to express your linear formula.