categorical and continuous fixed effects in a linear mixed model I heard that you can not combine continuous and categorical predictors in a linear mixed model. Is that true? Also, I was told to use continuous variables as random effects. Does that make sense? As far as I know, random effects are always categorical. Thanks for your help!
 A: A mixed-effect model is usually written as:
$$
\mathbf{y} = \mathbf{X\beta} + \mathbf{Zu} + \mathbf{e},
$$
where $\mathbf{y}$ is of shape $n\times 1$, the design matrix $\mathbf{X}$ for fixed effects is of shape $n\times m$ for some $m\in\mathbb{N}$, the design matrix $\mathbf{Z}$ for random effects is of shape $n\times r$ for some $r\in\mathbb{N}$, and $n\in\mathbb{N}$ is the number of your measurements. Furthermore, $\beta$ are your fixed effects of shape $m\times 1$ and $\mathbf{u}$ are your random effects of shape $r\times 1$. Finally, $\mathbf{e}$ is the noise vector of shape $n\times 1$.
Internally, the learning algorithm will fit $\beta$ and $\mathbf{u}$ differently, and that's why they become different types of learned parameters (aka effects).
You can now combine fixed and random and continuous and categorical predictors in one model, simply by deciding which variables go into which design matrix: the fixed ones become columns in $\mathbf{X}$, the random ones become columns in $\mathbf{Z}$.
E.g. you can have fixed continuous effects together with random categorical effects. A linear model with fixed slope and random offset would be an example.
Furthermore, continuous variables are often, actually more often than not, modeled as fixed effects. An example would be the standard no-frills linear model.
Finally, you can also have continuous random effects, e.g. random slopes.
