Amelia Nicodemus
Amelia Nicodemus

Reputation: 123

fixed-effect model matrix is rank deficient so dropping 5 columns / coefficients (lme4 package) after grouping age into four categories

This question appears to be a duplicate, I am however unable to resolve my case by looking at the existing suggestions on my model. I am trying to fit the three-level random intercept model. The idea is to establish factors that shape practice, with the understanding that individuals are nested in households and the latter in the zones. My dataset is accessible through this URL https://drive.google.com/file/d/1rY7n_pNh4TQ6B7SKCo03-TfmGnxzYRMf/view?usp=sharing

Here is the model:

model <- glmer(
  Practice ~ Zone + Access + Age + Gender + Education + Employnment + (1 | ZoneID/HouseID),
  data = OshingaliMLM,family = binomial(link = "logit"),nAGQ = 0

)

And I get the following results:

Generalized linear mixed model fit by maximum likelihood (Adaptive Gauss-Hermite Quadrature, nAGQ = 0) ['glmerMod']
 Family: binomial  ( logit )
Formula: Practice ~ Zone + Access + Age + Gender + Education + Employnment +      (1 | ZoneID/HouseID)
   Data: OshingaliMLM

     AIC      BIC   logLik deviance df.resid 
    36.0    108.3      0.0      0.0      392 

Scaled residuals: 
      Min        1Q    Median        3Q       Max 
-1.49e-08  1.49e-08  1.49e-08  1.49e-08  1.49e-08 

Random effects:
 Groups         Name        Variance Std.Dev.
 HouseID:ZoneID (Intercept) 0.054    0.2324  
 ZoneID         (Intercept) 0.000    0.0000  
Number of obs: 410, groups:  HouseID:ZoneID, 121; ZoneID, 5

Fixed effects:
                        Estimate Std. Error z value Pr(>|z|)
(Intercept)           -3.957e+01  6.711e+07       0        1
ZonePeri-urban         7.908e+01  7.158e+07       0        1
ZoneRemote rural       7.897e+01  7.149e+07       0        1
ZoneRural              7.917e+01  7.139e+07       0        1
ZoneUrban              7.912e+01  7.200e+07       0        1
AccessNo              -1.560e-01  1.893e+07       0        1
Age10-30               2.233e-02  2.073e+07       0        1
Age31-51              -4.631e-02  1.998e+07       0        1
Age52-72              -2.009e-02  1.613e+07       0        1
GenderFemale           6.587e-02  7.014e+06       0        1
EducationNo_education  2.096e-01  1.919e+07       0        1
EducationPrimary       2.307e-01  1.599e+07       0        1
EducationSecondary     1.194e-01  1.507e+07       0        1
EmploynmentEmployed    2.006e-01  1.825e+07       0        1
EmploynmentLeaners    -1.119e-01  1.097e+07       0        1
EmploynmentPensioners -9.502e-02  1.628e+07       0        1

Correlation matrix not shown by default, as p = 16 > 12.
Use print(x, correlation=TRUE)  or
    vcov(x)        if you need it

fit warnings:
fixed-effect model matrix is rank deficient so dropping 5 columns / coefficients
optimizer (bobyqa) convergence code: 0 (OK)
boundary (singular) fit: see help('isSingular')

This problem appeared after I grouped Age into four different categories and read it as a factor but even after deleting Age just to test, it gave the same problem but now says dropping 4 columns. I tried to delete different predictors columns and it seems to be complaining about all of them. I tried `OshingaliMLM$Age <- as.numeric(as.character(OshingaliMLM$Age)) and now complaining about invalid grouping factor specification. dput(head(OshingaliMLM,50)) shows that there are NAs for age and I am unable to solve it yet.

Upvotes: 1

Views: 39

Answers (1)

Amelia Nicodemus
Amelia Nicodemus

Reputation: 123

rank deficient so dropping 5 columns / coefficients was solved by not categorizing the Age predictor and reading it as a numeric value and not as a factor, whereas the rank deficient was solved by removing ZoneID from the model because there is no variation.

Upvotes: 0

Related Questions