rmodelnlmemixed

Error in MEEM(object, conLin, control$niterEM) : Singularity in backsolve at level 0, block 1... Linear mixed model, nlme, R


m1 =lme(fixed=Hour~Age*Ethnicity*GHUsedFlag*Disability,
   random=~Age|Id, data=mydf)

In my model I am checking multi level interactions. Age- numeric repeated measure, Ethnicity- character factor, GHUsedFlag- logical, Disability- Character- factor , Hour- numeric, outcome variable. I am getting this error when introduced Disability in the model. Can not really understand why is error is occurring and how to counter it. Any help is appreciated. I am using nlme package in R.

Error in MEEM(object, conLin, control$niterEM) : Singularity in backsolve at level 0, block 1


Solution

  • This is almost always caused by collinearity in the model. In particular, this will happen (I think) if there are combinations of your factor variables that aren't present in the data. (1) Try the model with lme4::lmer() and see if you get a warning about rank deficiency:

    lme4::lmer(Hour~Age*Ethnicity*GHUsedFlag*Disability + (Age|Id), data=mydf)
    

    (2) Build the fixed effect model matrix and use caret::findLinearCombos

    X <- model.matrix(~Age*Ethnicity*GHUsedFlag*Disability, data=mydf)
    caret::findLinearCombos(X)