Stack Exchange
Root mean square error in R - mixed effect model
Could you please tell me how to get/compute the value RMSE (root mean square error) in R when you perform a mixed effect model
Data: na.omit(binh) 
       AIC      BIC    logLik
  888.6144 915.1201 -436.3072

Random effects:
 Formula: ~1 | Study
        (Intercept) Residual
StdDev:    3.304345 1.361858

Fixed effects: Eeff ~ ADF + CP + DE + ADF2 + DE2 
                Value Std.Error  DF   t-value p-value
(Intercept)  -0.66390 18.870908 158 -0.035181  0.9720
ADF           1.16693  0.424561 158  2.748556  0.0067
CP            0.25723  0.097524 158  2.637575  0.0092
DE          -36.09593 12.031791 158 -3.000046  0.0031
ADF2         -0.03708  0.011014 158 -3.366625  0.0010
DE2           4.77918  1.932924 158  2.472513  0.0145
 Correlation: 
     (Intr) ADF    CP     DE     ADF2  
ADF  -0.107                            
CP   -0.032  0.070                     
DE    0.978 -0.291 -0.043              
ADF2  0.058 -0.982 -0.045  0.250       
DE2  -0.978  0.308  0.039 -0.997 -0.265

Standardized Within-Group Residuals:
        Min          Q1         Med          Q3         Max 
-2.28168116 -0.45260885  0.06528363  0.57071734  2.54144168 

Number of Observations: 209
Number of Groups: 46 


This should be on crossvalidated.com.

@RomanLuštrik: not if it's just about how to compute the RMSE, right?  (As opposed to "what is an appropriate pseudo-R^2 measure for mixed models", which would certainly be for crossvalidated and which is discussed at http://glmm.wikidot.com/faq ...

You don't give details of what function you used to make your model, but they tend to store their residuals using the same name, which you could check with str(), and RMSE is easily calculated from the residuals:
#make a model
library(nlme)
r <- lme(conc ~ age, data=IGF)

#get the RMSE
r.rmse <- sqrt(mean(r$residuals^2))

And in comments below, Ben Bolker points out that objects made by model fitting functions should have a residuals method, making it possible to do this (although some types of models may return residuals that have been transformed):
r.rmse <- sqrt(mean(residuals(r)^2))


more generally, well-behaved modeling functions should implement a residuals() method, although you do have to be a bit careful in some cases as to what kind of residuals are being returned (scaled, Pearson, deviance, studentized ...)

@BenBolker what kind of residuals are most appropriate for rmse calculations?

It depends why you are computing the RMSE.  How do you want to interpret it?  That might be a CrossValidated question ...

The same result can be obtained from:
library(nlme)
library(sjstats)

fit <- lmer(Yield  ~ Species + (1|Population/variety), data = df1,REML=T)
rmse(fit)

