1
$\begingroup$

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?

$\endgroup$
3
  • $\begingroup$ coef returns coefficients and ranef returns modes of random effects - what i not clear in it for you? $\endgroup$
    – Tim
    Commented Oct 20, 2015 at 19:36
  • $\begingroup$ @Tim Why doesn't coef = ranef. Shouldn't the coefficient = mode of random effect = mean of random effect? $\endgroup$
    – OuijiBoard
    Commented Oct 20, 2015 at 19:41
  • $\begingroup$ @Tim Then what information is being given to me when coef() returns a coefficient of a random effect? $\endgroup$
    – OuijiBoard
    Commented Oct 20, 2015 at 19:47

1 Answer 1

5
$\begingroup$

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.

$\endgroup$
1

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.