Search code examples
lmer

How to get rid of lmer warning message?


I have made some changes to the lmer. It works as it should but I could not get rid of the warning message that pops when I run the program. I have added the following options which allows the program run without stopping but with the warning message. I believe it is the check.nobs.vs.rankZ = "warningSmall" part. How could I get rid of this, any suggestions? Thank you.

   lmerControl(check.nobs.vs.nlev = "ignore",check.nobs.vs.rankZ =   
   "warningSmall",check.nlev.gtreq.5 = "ignore",check.nobs.vs.nRE="ignore",
   check.rankX =    c("ignore"),check.scaleX = "ignore",check.formula.LHS="ignore",
   ## convergence checking options
   check.conv.grad   = .makeCC("warning", tol = 1e-3, relTol = NULL),
   check.conv.singular = .makeCC(action = "ignore",     tol = 1e-4),
   check.conv.hess   = .makeCC(action =    "warning", tol = 1e-6)

Warning Message from R:

Warning message:
   In checkZrank(reTrms$Zt, n = n, control, nonSmall = 1e+06) :
     number of observations (=300) <= rank(Z) (=300); the random-effects parameters and the
    residual variance (or scale parameter) are probably unidentifiable

Solution

  • You should try check.nobs.vs.rankZ="ignore".

    lmerControl doesn't need to specify anything other than the non-default options: at a quick glance, these are your non-default values:

    lmerControl(check.nobs.vs.nlev = "ignore",check.nobs.vs.rankZ =   
       "ignore",check.nlev.gtreq.5 = "ignore",check.nobs.vs.nRE="ignore",
       check.rankX =    c("ignore"),
       check.scaleX = "ignore",
       check.formula.LHS="ignore",
       check.conv.grad   = .makeCC("warning", tol = 1e-3, relTol = NULL))
    

    In general I would suggest it's wise to turn off only the specific warnings and errors you know you want to override -- the settings above look like they could get you in trouble.

    I haven't checked this since you didn't give a reproducible example ...