4

I'm trying to apply a linear mixed model to my dataset and I keep getting a strange message:

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

Right now my model code is:

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

where y is a numeric response variable and variables 1-4 are factors.

What could this possibly mean?

user2846211
  • 909
  • 5
  • 16
  • 24

1 Answers1

0

I had the same issue with my initial run so I checked the variables I had included and one of them (a factor variable) only had 1 level. So I removed it and it worked. Also make sure you don't have NA's in your variables.

To check for NA's:

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

To drop NA's:

data_no_NAs <- na.omit(data[, c(variable_names), with = FALSE])
Billal Begueradj
  • 17,880
  • 38
  • 105
  • 123