Linear Mixed Model - Rank Matrix Insufficient

I am trying to apply a linear mixed model to my dataset and I keep getting a weird message:

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

Now my model code is:

 m0 <- lmer(y ~ var1 + var2 + var3 + (1|var4))

where y is the numerical response variable, and variables 1-4 are factors.

What does this mean?

+4
source share
1 answer

I had the same problem with my initial run, so I checked the variables that I turned on, and one of them (factor variable) had only 1 level. So I deleted it and it worked. Also make sure you do not have NA in your variables.

To check for NA:

sapply(data[, c(variable_names), with=FALSE], function(x) sum(is.na(x)))

To reset NA:

data_no_NAs <- na.omit(data[, c(variable_names), with = FALSE])
0
source

Source: https://habr.com/ru/post/1534460/


All Articles