Solved – Linear mixed model notation with categorical and continuous fixed effects and relation to function output

lme4-nlmemixed modelnotation

I am trying to understand how the linear mixed models output from the lmer function maps to the statistical notation for these models.

Lets assume to have a categorical (with 3 levels) fixed effect, a continuous fixed effects, the interaction between them and a random effect for the individual.

This is the equation i am used to see for linear mixed models, although i know there is also a matrix notation:

$y_{ij} = \beta_0 + \beta _1 CATG_{ij} + \beta _2 CONT_{ij} + \beta _3 CATG\cdot CONT_{ij} + b_i+\epsilon_{ij}$

The output of lmer would give me estimates for the following:

$Intercept$
$Level2$
$Level3$
$Slope$
$Level2:Slope$
$Level2:Slope$

I do understand what they mean, just can't map it to the equation as it seems that the categorical covariate is encoded in dummy variables both for the intercept and for the slope.

Any thoughts?

Best Answer

If you are using treatment contrasts for your categorical variable (the default in R and as implied by your lmer output), the intercept represents the value of the response variable at the reference level (Level1) of the categorical variable and at a value of 0 for the continuous variable. As you have written the equation there are then 2 different coefficients hiding in what you have written as $\beta_1$, representing separately the difference of each of Level2 and Level3 from Level1 (again, at a value of 0 for the continuous variable). For $\beta_2$, the value reported is for cases when the categorical variable is at Level1. Thus there are 2 different coefficients hiding in what you have written as $\beta_3$, representing how much to add or subtract from $\beta_2$ when the categorical variable is at either Level2 or Level3 instead.

Implied in your equation is that the random effect is only involved in the intercept; note that you can also include random slopes.

There are other ways to report such results, but you have to specify other contrasts in your call to the regression function.