[R] Linear model vs Mixed model

Utkarsh Singhal
Tue, 12 Jul 2016 13:35:14 -0000

Hi experts,

While the slope is coming out to be identical in the two methods below, the
intercepts are not. As far as I understand, both are formulations are
identical in the sense that these are asking for a slope corresponding to
'Days' and a separate intercept term for each Subject.

# Model-1
library(lmer)
coef(lmer(Reaction ~ Days + (1| Subject), sleepstudy))

# Model-2
coef(lm(Reaction ~ Days + Subject, sleepstudy))

Can somebody tell me the reason? Are the above formulations actually
different or is it due to different optimization method used?

Thank you.

Utkarsh Singhal
91.96508.54333