I am running mixed effects regression in R, utilizing glmer
, and am hoping someone can help clarify the difference between using coef
and ranef
on the results. Specifically, I have fixed effects $f_1,f_2,f_3$ and random effects $r_1,r_2,r_3.$ When I run coef
I get certain coefficent values for each of the fixed and random effects. Additionally when I use the ranef
function I get coefficients for my random effects. These two coefficients are not equal for each respective random effect $r_1,r_2,r_3.$ Why are these coefficients different and what information each coefficient tells us?
$\begingroup$
$\endgroup$
3
1 Answer
$\begingroup$
$\endgroup$
1
From lme4 documentation you can learn that
coef:
Computes the sum of the random and fixed effects coefficients for each explanatory variable for each level of each grouping factor
and ranef
is
A generic function to extract the conditional modes of the random effects from a fitted model object. For linear mixed models the conditional modes of the random effects are also the conditional means.
-
$\begingroup$ Hi Tim, can I have your opinion with this model ? stats.stackexchange.com/questions/570281/cross-mixed-model $\endgroup$ Commented Apr 4, 2022 at 7:05
coef
returns coefficients andranef
returns modes of random effects - what i not clear in it for you? $\endgroup$