How to get BLUPS in brms


I am using mixed effects models of the following form, see below.

reaction_time ~ x + y + z + (1 + x + y | participant)

Is there a way to get BLUPS here to predict the random effects using brms?

Perhaps the coef() or ranef() functions will get you what you’re looking for.

Are the above functions just returning the random effect value sampled from N(0, Sigma) or are the above functions actually estimating the effect on a particular participant?

If the latter, then how accurate is the estimation using coef() of a mixed effects model compared to a fixed effects with model with interaction terms such as x:participant and y:participant, which of course would create an extremely complex model and is not feasible in my case since I have 200+ participants?

ranef() gives this.

coef() gives the population-level effects (a.k.a. “fixed effects”)

Yeah, don’t treat something with 200+ levels as a fixed effect. And your wording implies you think such a model will be more “accurate”, but this is not the case. I don’t have the links handy (afk atm) but search for the case studies on “partial-pooling” for how you can achieve greater accuracy by treating random effects as such.

I believe @mike-lawrence is a bit off, on this. With brms, the fixef() function is how you get the fixed effects. ranef() returns the participant-specific estimates in the deviance metric. coef(), however, returns the participant-specific estimates in the metric of the fixed effects plus the participant-level deviations.


Ah! That’s embarrassing; I’ll have to remember to double-check myself before commenting on brms stuff. Thanks @Solomon for the correction!

1 Like


Hi @Solomon , thanks so much for your help here, just wanting to check if you agree that above is the correct interpretation of ranef() and coef()'s ouput.

Yes, ranef() and coef() both give the participant-specific effects, just in different metrics.

1 Like

Thank you!

1 Like