I am hoping to get some advice for examining differences in reaction times (repeated sampling) as a measure of cognitive load between groups.

Dataset: The response variable I am using is reaction times in ms relative to the mean(baseline RT) collected at multiple time points during a task. A small number (~.7%) includes negative reaction times given that RT = RT during task - mean baseline RT. Range of dataset is -125 to 3000 ms. Additionally, there are some missing response data points (177 out of 1764).

Plan: I am interested in using a generalized mixed-effect regression model (lme4::glmer) to examine differences between groups across time (fixed effects), with subjects as the random effects: RT ~ group:time + (1|subject). My plan is to use Inverse Gaussian GLMM with identity link function (as suggested in Lo and Andrews 2015).

However, I am running into two issues:

  1. First issue that my dataset includes negative response times and I am wondering if anyone has suggestions for how to deal with this? My thoughts are to shift the data by adding a constant (e.g., Y + min(Y)) however I am not sure if this is appropriate. Does anyone have any advice or articles on how to handle this?
  2. Even when dealing with all positive values (Y + min(Y)), I get the below error. I see that other people are also having this error with lme4::glmer but I haven't been able to find a clear reason for why this is happening other than it may be because of the NaN values. Does anyone know of the reasoning for this and/or any other packages to use for this type of analysis?

Error in (function (fr, X, reTrms, family, nAGQ = 1L, verbose = 0L, maxit = 100L, :
(maxstephalfit) PIRLS step-halvings failed to reduce deviance in pwrssUpdate

Any insights into issues 1 and/or 2 would be much appreciated!


1 Answer 1


Rather than add an arbitrary constant, I would consider not subtracting the mean in the first place.

As for the error, this could be due to many things. A few things to check are:

  • does it work if you set nAGQ = 0 ?

  • does it work if you set nAGQ = 10 ?

  • does it work if you use the mixed_model function in package GLMMAdaptive ?

  • does it work with a regular Gamma GLM (ie without random effects)

  • does it work with a log link instead instead of the inverse Gaussian ? This obviously requires that all the responses must be positive.

  • does it work with the linear model using a log-transormed response ? ie lmer(log(Y) ~ ...

  • $\begingroup$ Thank you @Robert for your help with my question. I took your advice and decided not to subtract the mean. The model fit worked but I was still getting a warning so I tried using nAGQ = 0 and the warning went away. I was wondering though if you could explain what is happing when this is set to 0? I read that this can make the model fit less precise but am not sure if this is true and/or whether this is commonly done or appropriate? Thanks in advance! $\endgroup$ Commented Jun 21, 2021 at 18:07
  • 1
    $\begingroup$ You're welcome. Yes, that will make the estimates less precise, so it's not the preferred solution. Did it converge with nAGQ = 10 ? What exactly was the warning [You said there was an error in your question, not a warning]. Did you try mixed_model and the other suggestions I gave ? $\endgroup$ Commented Jun 21, 2021 at 18:34
  • $\begingroup$ Does this answer your question ? If so please consider marking it as the accepted answer. If not, please let us know why. Also, if you haven't already, please consider upvoting it. $\endgroup$ Commented Jun 26, 2021 at 12:21
  • $\begingroup$ Sorry for the delayed response. I get an error when I run the model with nAGQ = 10... "Error in pwrssUpdate(pp, resp, tol = tolPwrss, GQmat = GQmat, compDev = compDev, : (maxstephalfit) PIRLS step-halvings failed to reduce deviance in pwrssUpdate". But this does not occur for nAGQ = 0 or when I do not specify anything. $\endgroup$ Commented Jun 29, 2021 at 21:48
  • $\begingroup$ That's a strange error from mixed_model $\endgroup$ Commented Jun 30, 2021 at 8:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.