0

I am trying to build a linear mixed-effect model (lmm) using the lme() function. To give some context, the research project looked at changes in reaction time of athletes as a function of number of digits they were asked to remember during their reaction task (either 0, 3, 5, 7, 9, 11 digits), each of which is coded for each observation in my data frame.

Currently my code is this:

ref_0_rxn <- lme(fixed = rxn ~ dig3+dig5+dig7+dig9+dig11+trial+c.hx, 
                 random = list(pt=~1),
                 data = all_data_lmm, 
                 na.action = na.exclude,
                 control = lmeControl(opt = "optim", 
                                      maxIter = 200, 
                                      msMaxIter = 200, 
                                      niterEM = 50, 
                                      msMaxEval = 400))

dig3-11 are the variables that have the condition dummy coded (i.e. whether they had to remember 0, 3, etc digits), rxn is the reaction time in seconds, c.hx is a binary variable defining whether the participant has had a concussion before, and the random variable is the participant id (coded as a factor). When I run this model I get the error message that says:

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

What am I doing wrong? Do need to use the lmer() function from the lme4 package? I did not understand the R-documentation files.

I tried changing the binary variables like concussion history, and the dummy coded condition (number of digits). One blog post I read said that the Singularity error was the result of issues with "numerical stability."

I was also able to run the "null" intercept only model:

null_rxn <- lme(fixed = rxn ~ 1, 
                random = list(pt=~1), 
                data= all_data_lmm, 
                na.action = na.exclude,
                control = lmeControl(opt = "optim", 
                                     maxIter = 200, 
                                     msMaxIter = 200, 
                                     niterEM = 50, 
                                     msMaxEval = 400))

The only thing that's different is the addition of something to regress rxn against. Something must be wrong with the variables then.

L Tyrone
  • 1,268
  • 3
  • 15
  • 24
domwill
  • 11
  • 3
  • It will be much easier to diagnose your issue if you include an example of your data, enough to make your issue, [reproducible](https://stackoverflow.com/help/minimal-reproducible-example). You can use `dput(all_data_lmm)` and add the result to your question. Thanks – L Tyrone Apr 30 '23 at 01:49

1 Answers1

0

This is very likely due to multicollinearity in your fixed effects. The most likely culprit would be that you included a full set of dummy variables (i.e. encoding all possibilities of a categorical variables, in which case the sum of the dummy variables for any row would be 1, thus confounded with the intercept term), but from your description it looks like you excluded the zero-digit (dig0) dummy variable, so (provided that category really exists) that wouldn't be the problem. Another common cause is an interaction term with missing levels, i.e. a non-fully-crossed design (see some of the examples below).

Some options:

  • fit in lme4 or another package that automatically handles multicollinear terms.

(glmmTMB will also work, although you need to specify glmmTMBControl(rank_check = "adjust"))

There is lots more information on Stack Overflow and elsewhere about rank-deficiency in fixed effect model matrices (another way to describe this situation), and how to use caret::findLinearCombos() to detect them, e.g. see here or here

Ben Bolker
  • 211,554
  • 25
  • 370
  • 453