Hide warning message in lme4

89_Simple

I have this warning message when I run lmer. I know why this is happening. Is there any way I can hide it?

fixed-effect model matrix is rank deficient so dropping 1 column / coefficient

Ben Bolker

It's a message (a milder form of informational message than a warning: warnings use the prefix Warning message:), so you can use suppressMessages():

library(lme4)
ss <- transform(sleepstudy,Days2=Days)  ## create duplicate variable
m1 <- lmer(Reaction~Days+Days2+(1|Subject),ss)
## fixed-effect model matrix is rank deficient so dropping 1 column / coefficient
m2 <- suppressMessages(lmer(Reaction~Days+Days2+(1|Subject),ss))

However, you can tell lmer to suppress just this message by including control=lmerControl(check.rankX="silent.drop.cols"):

m3 <- update(m1, control=lmerControl(check.rankX="silent.drop.cols"))

In general I would say it's better to avoid these collinear terms in your model in the first place if possible (although they're harmless). (I see that the OP says they know what's happening, so this information is more for future readers.) You can see what variables are being dropped by looking at the attributes of the model matrix:

attr(getME(m2,"X"),"col.dropped")
## Days2 
#3    3 

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related