# Interpretation of various output of “lmer” function in R

library(lme4)
fm1 <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy)


The notation (Days | Subject) says to allow the intercept and Days to vary randomly for each level of Subject .

Can you please explain me the result of the following commands ?

attr(summary(fm1)$varcor$Subject,"stddev")
(Intercept)        Days
24.740448    5.922133

c(sd(ranef(fm1)$Subject[,1]),sd(ranef(fm1)$Subject[,2]))
[1] 21.595943  5.455217

summary(fm1)$sigma [1] 25.59182 residuals(summary(fm1)) sd(residuals(summary(fm1))) [1] 0.9183965  What is the INTERPRETATION of the results found from various commands? That is , if one asks me what is the meaning of the results that you have found from sd(ranef(fm1)$Subject[,1]) and attr(summary(fm1)$varcor$Subject,"stddev")[1] ? Both are standard deviation of Intercept but of course there is difference between these two results . But I don't know what is this ?

In ?getMe , it is said that from summary(fm1)$sigma , we found residual standard error . But why doesn't the result match with sd(residuals(summary(fm1))) ? Also , In summary(fm1)$varcor there is value 0.066 under the column Corr . Does it mean correlation between two random effects (Intercept) and Days is 0.066 ?

Any help is appreciated . Thank you .

• You probably want to calculate sd(residuals(fm1)) and not sd(residuals(summary(fm1)). – Qaswed Apr 27 '16 at 10:08

attr(summary(fm1)$varcor$Subject,"stddev")[1] gives you the estimated standard deviation of your random intercepts. This is the square-roots of the first main diagonal element of your estimate for the random effects variance-matrix $G$ (in Wikipedia's notation). You get $\hat{G}$ directly with VarCorr(fm1)$Subject[,]. With sd(ranef(fm1)$Subject[,1]) you manually calculate the standard deviation from your estimated random intercepts. A fundamental difference is, that $\hat{G}$ estimates a population parameter, and sd(ranef(fm1)$Subject[,1]) a parameter in a subset of the population. The same for 25.59182 = summary(fm1)$sigma vs. sd(residuals(fm1)) = 23.50343 (and not sd(residuals(summary(fm1))! I would say, this in an error in your code).
Yes, 0.066 is the correlation between the random effects.