In specifying a crossed mixed effects model, I am trying to include interactions. However, I get the following error message:

Error in lme.formula(rate ~ nozzle, random = ~nozzle | operator, data = Flow) : 
nlminb problem, convergence error code = 1
message = iteration limit reached without convergence (10)

The model has the following: 1. 3 nozzle types (fixed effect) 2. 5 operators, each with 3 repeat measures on fuel flow from the 3 nozzle types.

I was asked to include the interaction between nozzle type and operator in the model. This is my code for the model:

flow.lme <- lme(rate ~ nozzle, error= nozzle|operator, data=Flow)

Why would I get this error message??

  • $\begingroup$ Don't you want operator|nozzle random? $\endgroup$ Commented Oct 18, 2012 at 12:40
  • $\begingroup$ No, operator is the random effect. $\endgroup$
    – f1r3br4nd
    Commented Oct 18, 2012 at 14:11
  • 2
    $\begingroup$ you can use > crtl=lmeControl(opt='optim',optimMethod = "SANN") $\endgroup$ Commented Sep 14, 2017 at 6:42
  • $\begingroup$ You should make @f1r3br4nd's response as answer $\endgroup$
    – JetLag
    Commented Dec 1, 2017 at 3:57
  • $\begingroup$ @AliRezaAfshariSafavi what are the benefits of using "SANN" versus the default BFGS ? $\endgroup$
    – gcamargo
    Commented Jan 4, 2018 at 19:54

2 Answers 2


I haven't heard of the error argument to lme and I don't see it in the documentation. Are you sure that isn't a typo? But, to answer the question you asked:

Try ?lmeControl

Setting the maxIter, msMaxIter, niterEM, and/or msMaxEval arguments to higher values than the default may fix this. Capture the output from lmeControl to an object and then pass that object to the control argument of lme.


The new default optimizer lme uses is flaky. Half the time these sorts of problems get solved for me when I change it back to the old optimizer. You do this by setting the opt argument for lmeControl to 'optim'.

So, putting it together:

ctrl <- lmeControl(opt='optim');
flow.lme <- lme(rate ~ nozzle, error= nozzle|operator, control=ctrl, data=Flow);
  • 1
    $\begingroup$ In some cases it might be worth knowing, that lmeControl is a function from the nlme package $\endgroup$
    – Qaswed
    Commented Nov 26, 2018 at 18:22
  • $\begingroup$ +1. This answer solved my issues too when I got the same error $\endgroup$
    – E. Rei
    Commented May 29, 2020 at 13:30

First, this is an ANOVA model, not a mixed model.

Second, it seems to me that your model is not identified. In equation form, you have

$$ \mbox{response}_{ij} = \beta_1 \mbox{nozzle type}_{1ij} + \beta_2 \mbox{nozzle type}_{2ij} + \beta_3 \mbox{nozzle type}_{3ij} + \mbox{operator}_i + \mbox{nozzle within operator}_{ij} $$ where nozzle types are fixed effects (dummy variables), operator is a random effect, and nozzle within operator is a random effect, too.

The last term has 15 separate values for 15 observations that you have. There are no degrees of freedom left to get any other terms in the model. Including interactions was a poor advice. You'd have to drop them whatsoever; even including them as crossed effects won't help, as they will then be perfectly collinear with the fixed effects, and won't be estimable. A maximum likelihood or REML model with 15 observations does not make sense; the asymptotic results of maximum likelihood theory simply won't work: this is a Ferrari you are trying to drive on a plowed field.

  • 5
    $\begingroup$ If there are both random and fixed effects in a model then by definition it's a mixed-effect model. Whether you call it ANOVA or regression is a separate issue and sort of a semantics question. I am a little puzzled, though, by what the OP means by an interaction. As far as I can tell, he's already doing that by using random=~nozzle|operator instead of random=~1|operator. $\endgroup$
    – f1r3br4nd
    Commented Oct 18, 2012 at 14:25
  • 1
    $\begingroup$ Some literatures do refer to the nested random effects as interactions between different levels of nesting; I think I've even seen this in Pinheiro & Bates. I agree that terming this properly is a matter of semantics, but I am just thinking of introducing this-does-not-have-to-be-a-mixed-model tag. On about two-thirds of the mixed-models question that I get to see, saying something to that effect is a part of my answer. $\endgroup$
    – StasK
    Commented Oct 18, 2012 at 18:36
  • 1
    $\begingroup$ Funny, I spend a good chunk of my time telling people they aren't using mixed models enough. I actually would like to be wrong, because it would simplify my life somewhat. What would you tell the OP the rule of thumb is for determining when a mixed model is needed? $\endgroup$
    – f1r3br4nd
    Commented Oct 19, 2012 at 4:25
  • 3
    $\begingroup$ Oh, so you are the villain, then. This one has a single categorical predictor, so it is an ANOVA model to me, as I said earlier. If you had information at different levels (e.g., state \ school \ students, with data on states, on school, and on students), that would sound more like a mixed model to me. Basically, if you can do this as sums of squares, that's ANOVA; if you can do this as a regression model, that's a regression model. If doing the maximum likelihood/REML is absolutely unavoidable (as it is in binary response case), that's a mixed model alright to me. $\endgroup$
    – StasK
    Commented Oct 19, 2012 at 15:52

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.