# Difference between two lmer model

Can you please explain where is the difference between the following two models :

fm1 <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy)
fm2 <- lmer(Reaction ~ Days + (1|Subject) + (0+Days|Subject), sleepstudy)


I noticed there is some discrepency in the estimate for random effect between model fm1 and fm2 . But don't know why ?

summary(fm1)$varcor Groups Name Std.Dev. Corr Subject (Intercept) 24.7404 Days 5.9221 0.066 Residual 25.5918 summary(fm2)$varcor
Groups    Name        Std.Dev.
Subject   (Intercept) 25.0513
Subject.1 Days         5.9882
Residual              25.5653


And the fixed effect estimates are same for the both model .

## 1 Answer

The second model includes random intercepts and slopes, under the assumption that the correlation between them is 0. The first model also estimates that correlation and thus has one more parameter.

• +1 -- but don't you mean to say one more parameter and therefore one less degree of freedom? – whuber Jul 27 '15 at 16:59
• @Pavel But I see both have same number of parameter , in first model (Intercept) and Days also , in the second model (Intercept) and Subject.1 Days , though I don't understand what is meant by Subject.1  ? – user81411 Jul 28 '15 at 11:25
• And how is to see the degrees of freedom? – user81411 Jul 28 '15 at 11:26
• @Munira: But there is an additional parameter in the first model which is the correlation. It's in the right-most column (0.066, in your example). "Subject.1" is just a minor technicallity - it's R's way of dealing with two rows with the same name. – Pavel Jul 30 '15 at 9:26
• @Munira: Degrees of freedom appear to be a problematic issue when you model random effects: stat.ethz.ch/pipermail/r-help/2006-May/094765.html – Pavel Jul 30 '15 at 9:30