[R-sig-ME] standardized coefficients in lme4 package

Simon Sun simons6831 at gmail.com
Sat May 3 11:29:40 CEST 2014

Dear Ben,

I am a user of your excellent work lme4. While during my work I realized the 
problem that the package doesn't provide function to return standardized 

I found a section of code on your website:
lm.beta.lmer <- function(mod) {
  b <- fixef(mod)[-1]              ## fixed-effect coefs, sans intercept
  sd.x <- apply(mod @ X[,-1],2,sd) ## pull out model (design) matrix,
                                   ## drop intercept column, calculate
                                   ## sd of remaining columns
  sd.y <- sd(mod @ y)              ## sd of response

But I couldn't make it work, every time it showed:

 Error in apply(Mod at x[, -1], 2, sd) : no slot of name "x" for this object of 
class "lmerMod"

Could you please help me figure it out? Thank you very much!

More information about the R-sig-mixed-models mailing list