Moscatelli et al provide the equation behind generalized linear mixed-effect models, and their paper is available online:


They say:

"We included three random-effects parameters (the random intercept, the random slope and their correlation)" --- See Results section, Example 1

Fine. My question is, where is the third random-effect parameter which estimates the correlation between the intercept and slope? Can anyone write the full equation behind glmer, including the correlation parameter?

See equation 12 in their paper, reproduced here.

$Y_{ij}^{*} = \theta_{0} + u_{i}^{0} + x_{ij}(\theta_{1} + u_{i}^{1}) + d_{ij}\theta_{2} + (x_{ij}d_{ij})\theta_{3}$

"...$x_{ij}$ is the stimulus duration, $d_{ij}$ is the dummy variable for the experimental condition (0 for Downward and 1 for Upward), $x_{ij}d_{ij}$ is the interaction between the stimulus duration and the dummy variable, $\theta_{0}...\theta_{3}$ are the fixed-effects coefficients, $u_{i}^{0}$, $u_{i}^{1}$ are the random-effect coefficients." --- see Example 1, equation 12.

From that I see the random intercept, $u_{i}^{0}$ and random slope, $u_{i}^{1}$ but not the correlation parameter.

Many thanks!

EDIT: The model could be written without the correlation parameter using double bar notation:

$y \sim x*d + (x||Subject)$ would expand to the regression equation

$y_{ij} = \theta_{0} + u_{i}^{0} + x_{ij}(\theta_{1} + u_{i}^{1}) + d_{ij}\theta_{2} + (x_{ij}d_{ij})\theta_{3}$


$\theta_{0}$: fixed effect coefficient (intercept),

$\theta_{1}$: fixed effect for $x$

$\theta_{2}$: fixed effect for $d$

$\theta_{3}$: fixed effect for $xd$ interaction

and random effects for intercept and slope: $u_{i}^{0}$ and $u_{i}^{1}$.

But using single bar notation, $y \sim x*d + (x|Subject)$, there will be a correlation parameter in addition. The trouble is, every time I see the equation written in regression form, I never see the correlation parameter (the paper cited is just an example that I found is freely available, other examples come from textbooks which are not online). The documentation for lme4 uses Matrix notation, and I am continuing to look through it for answers, and it seems the correlation param might be part of the Sigma variance-covariance matrix, but it is not always clear how that translates to the regression style which is more familiar to psychologists (and hence used in the Moscateilli paper).

I hope that is a little clearer about what I mean regarding the correlation param, but if not please ask for more references/info :)


2 Answers 2


Maybe this will help you: in lme4 you can specify correlated intercept and slope:

y ~ x + (x | g) that translates to: y ~ 1 + x + (1 + x | g)

where y is a response variable and x is a predictor, while g is some grouping variable for random effects. lme4 by default assumes that the terms could be correlated, but you can also define them as uncorrelated:

y ~ x + (x || g) that translates to: y ~ 1 + x + (1 | g) + (0 + x | g)

In the second case intercept and slope are treated as independent, i.e. their correlation is constrained to be zero. So yes, correlated parameter is a part of variance-covariance matrix. Check the article by Bates et al. (in press) for more information on this.

  • $\begingroup$ Hi. Thanks for your response. They may mix up the terms, but there is normally a correlation parameter measuring the correlation between the intercept and slope. This would be parameter P5 in the first example here: stats.stackexchange.com/questions/13166/rs-lmer-cheat-sheet $\endgroup$
    – trev
    Commented Dec 10, 2014 at 12:39
  • $\begingroup$ Sorry, there is a misunderstand there. $x_{ij}d_{ij}$ is the interaction term, with coefficient $\theta_{3}$. It is the interaction betwen condition (d = 0 or 1) and stimulus duration. That would be there also without the correlation parameter! I can try to write some more examples to clarify... $\endgroup$
    – trev
    Commented Dec 10, 2014 at 12:52
  • $\begingroup$ It seems we misunderstood each other, and also the notation in the paper you quote seems blurry to me, however I re-wrote my response so now maybe it will be more help for you. $\endgroup$
    – Tim
    Commented Dec 10, 2014 at 13:59
  • 1
    $\begingroup$ @Tim, the y ~ 1 + x + (1|g) + (x|g) should be y ~ 1 + x + (1|g) + (0 + x|g) to suppress the implicit intercept term. Otherwise, it fits an additional intercept term and isn't quite the same as y ~ x + (x||g). $\endgroup$ Commented Feb 22, 2015 at 0:40

A model of type LMM/GLMM is defined by two equations: An equation including the linear combination of fixed and random effect predictors (as for example Eq. 12 in Moscatelli et al. (2012)) and a second equation for the variance-covariance matrix of the error term. The cross-correlation parameter is in the variance-covariance matrix of the between-subject error term (i.e., the variance-covariance matrix of the random effect).

In (Moscatelli et al 2012) these are Eq. 3 and Eq. 5, respectively. In Eq. 5 there is no cross-correlation parameter because the model has only one random-effect parameter


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.